Fortune Cookie

Following up on the idea of randomly matching items from arrays. The following applet emulates the, sometimes, meaningless advise found in fortune cookies.

Some of this stuff isn't exactly articulate, or grammatically correct, but neither are the damn cookies, anyway... :)

I wonder if whoever invented fortune cookies had a program like this.



-OR-

Try It

Ugly as fuck javascript
// fortune cookie
// jon tohrs
// send me money -_-
(function($p) {

    $p.size(200, 100);
    $p.background(80);
    $p.fill(255);

    var one = ["you will", "you must", "you should", "you would", "you could", "you might", "you can", "you won't", "you mustn't", "you shouldn't", "you wouldn't", "you may not", "you can't", "it is possible you will", "it is possible you won't", "it is unlikely that you will", "you're likely to", "you're expected to", "expect to", "don't expect to", "you should try to", "you shouldn't try to", "you could try to", "you  must try to", "you must not try to"];
    var two = ["find happiness", "lose happiness", "find sorrow", "encounter hard times", "accomplish your dreams", "overcome hard times", "be troubled", "lose control", "find the meaning of your life", "find riches", "lose business", "win money", "find friendship", "lose a friend", "find a friend", "find disgrace", "find yourself in dispair", "face consequences", "shed tears", "find success", "become successful", "share your feelings"];
    var three = ["with a new love", "with an old love", "where you least expect", "exactly where you'd expect", "at work", "at home", "in good company", "in bad company", "and regret it", "in spite of yourself", "if you are stubborn", "if you aren't stubborn", "if you try", "in yourself", "if you trust yourself", "in anger", "in love", "if you are persistent", "in old company", "in loyal company", "if you are loyal"];

    var a = $p.parseInt($p.random(25));
    var b = $p.parseInt($p.random(22));
    var c = $p.parseInt($p.random(21));

    $p.text(one[a], 10, 30);
    $p.text(two[b], 10, 50);
    $p.text(three[c], 10, 70);

})

Neat and tidy processing
//fortune cookie
//jon tohrs
//send me money -_-

//dim window
size (200, 100);
background(80);
fill(255);

String[] one = {"you will", "you must", "you should", "you would", "you could", "you might", "you can", "you won't", "you mustn't", "you shouldn't", "you wouldn't", "you may not", "you can't", "it is possible you will", "it is possible you won't", "it is unlikely that you will", "you're likely to", "you're expected to", "expect to", "don't expect to", "you should try to", "you shouldn't try to", "you could try to", "you  must try to", "you must not try to"};
String[] two = {"find happiness", "lose happiness", "find sorrow", "encounter hard times", "accomplish your dreams", "overcome hard times", "be troubled", "lose control", "find the meaning of your life", "find riches", "lose business", "win money", "find friendship", "lose a friend", "find a friend", "find disgrace", "find yourself in dispair", "face consequences", "shed tears", "find success", "become successful", "share your feelings"};
String[] three = {"with a new love", "with an old love", "where you least expect", "exactly where you'd expect", "at work", "at home", "in good company", "in bad company", "and regret it", "in spite of yourself", "if you are stubborn", "if you aren't stubborn", "if you try", "in yourself", "if you trust yourself", "in anger", "in love", "if you are persistent", "in old company", "in loyal company", "if you are loyal"};

int a = int(random(25));
int b = int(random(22));
int c = int(random(21));

text(one[a], 10, 30);
text(two[b], 10, 50);
text(three[c], 10, 70);

On a side note, and a propo of nothing, Processing 2 is awesome. If I had to convince everyone to quit whatever programming language they are used to and learn a new one, I'd suggest Processing. It's awesome. :)