Valentine's day greetings card generator
C
What can be more romantic than syntax highlighting?
*xx= "De"
"ar %" "s:\n"
"Consta" "nts ar"
"e red, " "variable"
"s are blue.\nIf lo"
"ve had a syntax, I"
"'d highlight you"
".\n",n[9];main(
){printf(xx,
gets(n))
;xx;
}
Output:
$ echo Ilana | ./vanentine
Dear Ilana:
Constants are red, variables are blue.
If love had a syntax, I'd highlight you.
Java 8, 500 lines of code
This is the longest entry that I had ever did here in codegolf. It is in the form of a java program constituted from the concatenation of the lyrics of 7 different songs that I composed just for this competition. Looking back in time, I am convicted that I am really crazy to create this thing just for this competition, and some verses are still repeating over and over with rhymes in my head.
Comments were very abused, so I could write everything in the program to be within verses, except for a short guitar solo in the end of the second song. There is no blobs of characters left hidden somewhere. In fact, I did not thought that to write music as poems with rhymes that could be compiled and run by a java compiler to do something not trivial was damn so hard, specially writing poems with terms like AffineTransform
, BufferedImage
, Graphics2D
and newScheduledThreadPool
.
The program itself is somewhat complex. It does show a screen with an animation of a rotating heart, some stars and a message for your beloved-one. All of that is done with linear algebra, primitives drawing, setting pixels, text drawing and sprites.
EDIT: Bugfix to reduce the font size to avoid text cuttings.
To run it:
java that_day <The name of your girlfriend/boyfriend>
If you omit your girlfriend/boyfriend name, it will show the usage and default to my name (Victor) instead. This is some sort of mark I left as a form of some personal signature.
Here is its source:
// ******************************************
// TRACK 1: THE GREAT LOVE IN THE JAVA ISLAND
// ******************************************
/* Do you ever */ import /* ?
|* If in the */ java /* island */.
/* There was a sign that once said:
*/ awt. /* what is this crazyness?*/*;
/* Or maybe instead,
|* Do you really */ import /* if in the */ java /* island */.
/* they really said */ awt.geom. /* instead? */*;
// Or even maybe,
/* Do you */ import /* if all that */ java.awt. /* had some */ image/*? */.*;
/* Do you */ import /* if that */ java /* has a */ .util.concurrent/*? */.*;
/* Do you */ import /* if that */ java /* has some */ .util.Random; // game?
/* Do you */ import /* if that */ static java /* has some */. lang/*uage or */. Math /* class? */.*;
// And then
/* We do */ import /* about all those */ javax // stuff
/* So, lets play in the school */ .swing /* like the old times, oh my honey?*/.*;
// In the school
/* I were in my */ class that_day{ //
/* And some */ Random stuff // the teacher were saying
=/* all that I wanted was a*/ new Random /* game to play*/(
); // But then you came!!!! */
/* And I felt the */ GreatLove /* in my */ heart,
/* you, were my */ star, /* you were all my */ life;
/* In that */ class
/* I saw my */ GreatLove // in your face
/* I was so happy that i wanted to */ extends /* a */ BufferedImage //!!!
{/* that */ GreatLove /* was */( int resting, /* and so */ int tense
/* i felt */){ super(//!!!
/* no */ resting, /* I was so */ tense,
/* I was sure that I wanted*/ 2 /*love you*/);
}}/* I would */ boolean your_heart(
/* a day */ long /*in*/ YourArms, long /*in*/ your_arms, long /*IN*/ YOUR_ARMS // OH YEAH!
){ /* I want to*/ return /*to*/ YourArms * /*, to return to */ YourArms +/* to return to*/ your_arms // OH YEAH!
/* to return to*/* your_arms </* to return to*/ YOUR_ARMS /*to return to*/* YOUR_ARMS;} // OH YEAH
// *******************************************
// TRACK 2: THE STRING GUIDING MY LIFE, PART I
// *******************************************
/* In the */ public//, you said you did not wanted me!
/* I frooze */ static /* and felt a */ void /* inside */
/* coz you were the */ main (String[] guiding_my_life
){ if (guiding_my_life /* was a string with such */ .length
/* I felt like I was */ == 0 // in that date.
){ /* That was the */ System. /* and i were */ out.
/* So i */ print//d this letter for you,
/* Remember, */( "usage is java that_day and-put-here-yours-love-name");
/* I was in a cinema's */} EventQueue.
/* I got your number, was going to */ invokeLater(()
-> /* But this day is a */ new //day
/* A day like */ that_day
/* Are you */ ((guiding_my_life/*? Even when its */. length == 0?
/* You are the */ new String[] /* of my life?
Would I be a */ {"Victor"} : /* with my string */guiding_my_life)//?
[ 0-0-0-0-0-0/*HHHHHH YEAH!*/]))
;} that_day
/* you are the */( String guiding_my_life) {
/* a */ int tense /* feeling with a level */ = 1000;
/* a */ long missed /* one with a number */ = 466,
/* I looked for your */ door /*. Now I know, its number is */ = 279,
/* but missed */ because /* I was looking for */ = 379,
/* I was so */ crazy /* that i looked even at the number */= 261, /* and */ number = 534;
/* And my */ heart /* was */ = /* that */ new GreatLove
/* Oh I was so */(tense, /* Oh I was so */ tense); // Oh yeah!
/* And then I am */ for/*ever*/ (int erested /* in you */ =000000000 ;// YEAH;
/* int*/erested </*in your in*/tense /*love*/;
/* int*/erested ++ // forever!
){ for/*ever */(int/*erested */ i_was =0-0-0-0-0-0//0-0-0-0-H-H-H-H-H-H YEAH
; i_was </*so*/ tense; i_was ++ // so tense, oh yeah!
){/* but, I knew that */ if (i_was +/* so */ missed >// by you
/* and you were too int*/erested
& i_was -/* so */ missed </* and */ tense-
/* so int*/erested
& (/*in*/ your_heart(
i_was -/* looking at that */door,
/* int*/erested /*in you*/- because, /* i am */ crazy /* for you */)|
your_heart
( i_was -/* so */ tense +/*at your*/ door,
/* int*/erested /*in you*/- because, /* i am */ crazy )/* for you */|
/* int*/erested /*in your*/> number
|( i_was /**/> missed /* that much */ & i_was </* so */ tense
- missed /* you too much */ & /*I am so int*/erested /*and*/> crazy)))
/* To your */ heart.
/* I would */ setRGB /* there */(
/* because */ i_was, /*int*/erested,
// GUITAR SOLO:
0XFFFF000___0 //0XF00_00X0__XF0F_0F0F0___00 F0X_F0F0X__FFF0X0__F000!!!
); //F0000 0XF0_0XF0_0XF0 F0F0F0__F0F0F0__F0F0F000000000!
}} // 0xFFFFFF000000000-0-0-0-00000000000000 X0_X0_X0_X000 YEAH!
/* You are my */ star=
// like you, no one will go so far
/* my */ new GreatLove( // you are
/* I was so */ tense, /* I was so */ (int)tense);
// OH YEAH!
// ****************************************
// TRACK 3: INTREPID INTUITIVE INTELLIGENCE
// ****************************************
int[]repid /* I am, this is */ = /* my */ new int/*elligence*/[
/* Just */ 5 /* days I wait */];
/* This is my new */ int[]elligence
=/* my */ new int/*elligence*/
[ 5 /* years */]; for // now
( /* Is this */ int uitive // or nah?
= 0//r nah?
; /*int*/uitive </*for*/ 5 //years
; /*int*/ uitive
++ // Or nah?
){ /*int*/repid [/* or int*/uitive]
/* Is this */ = /* to */ (int)//elligence?
( cos /* the */ (toRadians( 90+ // aliens came
// They came! they came!
/* From the */ 144 *
/* How this is int*/uitive)) /* how???
1- Oh, this */ * /* is so */ tense /
2- /* It is so */ -tense /( /*
3- /* It is so tense */
4- /* It is like */ 2 /* times so tense.*/)
); /* This is my int*/elligence[
/* My int*/uitive /* intelligence*/]=
( int/*elligence*/)
(/* And the */ sin /* of the */( toRadians (90+ // aliens
/* is that they did not got my int*/uitive * // intelligence
1__44 /* times */)) /* that was so */* tense /
2 + /* the times this was so in*/tense /
2 /* intense*/);}
// *******************************************
// TRACK 4: THE GRAPHICS OF THE LOVE IS A STAR
// *******************************************
/* The */ Graphics of_the_love /* is */ = /* to a */ star.
getGraphics /**/();/**/ of_the_love /* and then */.setColor( // of the star
/* A */ Color /* that was something like */ .YELLOW
); /* The shape */ of_the_love /* is draw when you */.fillPolygon // of the star.
/* You have your reputation id, its the */( repid,
/* And you use it with much d*/elligence,
5 /* times each day */);
/* You do discover */ life // again
= /* Its happy to see my */ new GreatLove // everyday
(/* I am so excited and a bit*/ tense,
/* I had that feeling so in*/tense);
/* The */ Graphics of_your_heart /* is*/ = /* to the */ life // of a star
. getGraphics /**/();/**/ of_your_heart /* and then */.setColor( // of the sky
/* A */ Color /* that was something like */ .CYAN
); /* In the letters */ of_your_heart /* you */ .setFont
(/* And when you remember */ of_the_love /* you */.getFont().
/* In the happiness, please */ deriveFont /* everyday */(
/* You might do it only */ 1 /* time or even */, 67));
/* But do remember */ of_your_heart /* everyday */.
// ********************************************
// TRACK 5: THE STRING GUIDING MY LIFE, PART II
// ********************************************
/* Yesterday, I have */ drawString
( "Hey, " + /* I have to say that you are the string that was */ guiding_my_life
+ /* I say, plus I say, hey: */ ", I love you",
20 /* times that I will say */,
/* it was so */ tense /* but i will say it *// 2 -
50 /* times that I will say */);
/* John */ JFrame /* is the name of my */ neighbour // in the next door
= // him, I had no such friend as before
/* Some day I asked him for some */ new//s
/* Then */ JFrame /* said I got a letter and the sender was: */(
"I love you, "+
/* it was nobody else but the string */ guiding_my_life);
/* I am so grateful to my */ neighbour /* coz he */ .setBounds(
/* I was */ 10 /* times excited and */, 10 // times happy
/* My emotion was at */, 500 /* percent */,
/* When I read the letter I falled in love */ 500 /* rounds */);
MY_TRUE_LOVE /* was */ back_for_me
/* There is nothing */ = /* or even like this */
/* So I had a */ new /* chance, */ MY_TRUE_LOVE(); // finally came
/* And was my */ neighbour /* who */ .add(/* she */ back_for_me);
/* My */ neighbour. /* was great, he */ setVisible( /* me again
|| my */ true /* love was back to me! */);
// So I defined a new plan
/* and */ Executors /* it then */.
/* with a */ newScheduledThreadPool( /* For */ 1 /* time I had my love back again */).
/* and I */ scheduleWithFixedDelay(()
-> /* back in the cinema's */ EventQueue. /* I came
|| and then I */ invokeLater(() // her cellphone again!
-> /* She was finally */ back_for_me /*,
|| and the only difference was that her hair got a */ .repaint()),
/* I was feeling as a */ 0 /* before */,
/* Now I feel */ 50 // times more worth.
/* in each */, TimeUnit. /* of just some */ MILLISECONDS /* I'm love.*/);
/* And I won't forget my */ neighbour.
/* Just to */ setDefaultCloseOperation(
/* Now that I have a love and a great friend, we */ 3 /* really rocks!*/);}
// *************************************
// TRACK 6: HOMEWORK ABOUT A BORING BOAT
// *************************************
/* Last year in my */ class I_MET{ /* my */ GreatLove
she; /* was so lovely that I knew: */ I_MET( /* my */ GreatLove
/* I was sure that she was really */ my_love
){ she /* is */ = /* to an angel, she is all */ my_love;}
/* Oh yeah, man she is */ double pretty, very_nice, /* and much */ talented,
/* She just should be my, beloved */ girl,friend;
/* But the teacher would */ void /* my weekend, he gave a homework:
/* to */ draw /* some stupid */(Graphics2D/*, of a boring */ boat) {
/* What I didn't knew, was that weekend would, */ AffineTransform my_life
=/*that */ new AffineTransform /* happened, really */()/*vernight. */;
/* The teacher said, the homework should be done in */ double//s
// And that was really when my chance came.
// I invited she, to join me in the homework
/* And she came to my house, because a */ boring //boat
= /* And */ she ./* measured the boat and */ getHeight
(),vernight /* I managed */= she /* to */.getWidth ()/*n the same! */;
my_life /* would change and then */ .rotate(
/* When she said that she had trouble in convert */ toRadians (
/* But in that stuff, I was really */ talented//!!!
),/* And because of that */ boring /* homework *//
/* We */ 2, /* got together O*/vernight /*, working on that boat. *//
/* The life of we */ 2 /* was about to */); AffineTransform // in that day
/* When she */ kissed_my_mouth // at midnight and ten.
/* For us both, that feelling was */ =/*lly*/ new
/* An */ AffineTransform ()/*n that night, that was for real */;
/* When she */ kissed_my_mouth/*, the feeling I can't */ .translate(-
my_life. /* was */ transform/*ed*/( /* to a */ new // plane!
/* Working in a */Point2D. /*A homework in */Double(
/* She was really */ talented /*, but with */ >90 // percent done
/* I was so sad when she needed to go back to her home!
*/ & /* had i already said how she is */ talented/*?*/<
/* Had we kissed in */ 6 /* hours and */* 45 /* minutes of work*/?
/* O*/vernight /* working */: 0/*n the same boat.*/,
/* Man, had I already said how she is */ talented/*?*/<
/* Without her, could that be */ 180 /* times or worse of boring homework*/?
/* So */ boring: 0/*n that boat in an otherwise */), null // weekend
). /*But I had to */getX ()/*n*/ ,-my_life /*and*/. transform(
/* In a much better thing a */new Point2D /*homework to be done in */.Double//s
(/* Was she */ talented /* like something */ >180 /*percent*/?
/* O*/vernight : 0/*n the boat, I and my */, talented /* girl finished */ > 90 /* percent.
*/ & /* she is so*/ talented /* that in */ < 6 /*hours and */*45 /* minutes of */ ?boring /* homework
*/: 0/*n an otherwise */), null // weekend, we got a love!
)./* And now, we both */ getY//a new life!
()/*n that night */); my_life /* was */. preConcatenate//d
/* She */( kissed_my_mouth /* and she though me CorelDraw */);
/* However, she didn't knew about */ BufferedImage/*!!!
*/ i_knew =/*lly well right from the start */
/* that I would had a */ new AffineTransformOp /* in */( my_life,
/* and */ 2 /* that working to */).filter( /* out the boringness */
she /* too did not got a */, null /* weekend */);
/* I had an */ AffineTransform on_my_life
/* She */ =/*lly had a */ new AffineTransform ()/*n*/ ,her_life
/* Oh, she really */ =/*lly had a */ new AffineTransform ()/*n*/ ;her_life
// OH YEAH!
/* I can't */.translate (/* how */ very_nice, /* and */ pretty /* she is.*/);
/* I got */ on_my_life /* a new */ .scale( /* of bliss. */
/* with a */ girl /* that kissed me, *// /* working a */ boring /* homework */,
/* got a girl*/friend /*O*//vernight )/* in a work about a boat. */;
on_my_life /* I can't */.translate
/* How I became so live */((
/* from a */ boring -/* homework,
*/ i_knew. /* how to */getWidth(
)) /* We *// 2, /* working */( /*O*/vernight
- // Until the night was high
i_knew /* to */.getHeight
()//n the night when she came
)/ /* We gotta to be */ 2//gether
); //OH YEAH!
on_my_life /* I */.preConcatenate(
/* And */ her_life // Would never be the same
); /* Looking the net for a */ boat. // page
/* To finally */ drawImage(
i_knew, /* that with this girl */ on_my_life, /* I would never get a */ null // weekend!!!
); /* OH YEAH! */}}
/* And monday back in the */ class
MY_TRUE_LOVE extends /* the */ JComponent
{ I_MET a_great_love
/* And */ =/*lly for her was this a */ new // love
I_MET /* with her */( heart
); I_MET love // in her heart
/* And I */ =/*lly met a */ new // life!
I_MET /* a new */ (life);
// *****************************************************
// TRACK 7: DOUBLE TROUBLE IN MY GIRL'S FATHER CARD SHOP
// *****************************************************
/* I was in */ double trouble, last_year, at_my_phone;
// The dad of my girl had a shop in his home.
/* He were open to the */ public // that day. But no customers came
/* Just a */ void // on the shop, that was all then.
/* He */ paintComponent/*s of some */(Graphics cards){
/* But */ trouble /* is */ = trouble + /* all that */ stuff.
/* The */ nextDouble /* trouble */ ()//ff the week
/* Was like */* 5 /* times as so big */-
5 /* times *// 2. /* the dad of my girl. */
; if (/* he was really bad to sell all that */ stuff.
/* The */ nextDouble /* trouble he had was */ ()/*nce a big */</**/ 1./
/* He had bad sells for more than */ 20 /* days */)
/* The truth is that */ trouble /* is */ = /* to */- trouble; // no matter when
/* As */ a_great_love /* my girl is so */. talented
/* To */ =lize (a_great_love/*,*/. talented // also I am!
/* But love */ + /* all that */ trouble // is really hard then
); /* And */ last_year /* to */ =lize(// the bills, that was a real pain
last_year + 1 /* or maybe *//2. // months
); at_my_phone /* her dad called to */ =lize(// the bills ongoing
at_my_phone /* he complained, and asked money to*/-/* give back in */ 7 /* days or maybe *// 10.);
// And that put me in trouble with my girlfriend!
/* But that */ Graphics2D CARDS // were really cool stuff!
=/*But that */(Graphics2D)cards;// were really-really cool stuff!
int eresting // they were
=/* You could */ getWidth ()//f that
, a_great_card_pile =/*lly was possible to make it */ getHeight /* very high*/
()/*n all those*/; CARDS. /* They */ setColor // very careful.
(/* and the */ new Color//s her father painted, all of them were very cool.
(/* But in the end, they only selled */ 15 /* or */* 17, // each day
/* But could produce more then */ 200 // everyday
/* And I counted */, 225 /* boxes of cards and paint abandoned in the store at that day. */));
/* Her dad in the */ CARDS/*, he did it */.fillRect
/* All that stuff was very */((int)eresting
- (int)eresting, (int)eresting -/* very */ (int)eresting, /* really really */ (int)eresting,
// OH YEAH!
/* But my heart broke with such */ a_great_card_pile
);/* he weren't selling enough, and I had */ a_great_love /* to my */.girl
= /* I could not see a great */ (int)eresting // card shop end
; /* And I had */ a_great_love. /* to my girl*/friend
= /* And I decided that such */ a_great_card_pile /* should finally get an end! */;
/* My girl had */ a_great_love /* in */ .draw/*ing all those */(CARDS);
// OH YEAH!
for (/* that situation, i did needed */int elligence
=/*from n*/0/*w on, I used my */; (int)elligence
< 2 /* sell everything*/ + /* handle all the bills and */ stuff.
/* my */ nextInt//elligent move was to buy the card shop! */
(/*My girl was surprised, */ 5 /* times she said*/);
/* And she admired all that my int*/elligence /**/++
){ I_MET her_father /* he was */ =//lly surprised!
/* And after that I got to the shop a */ new // life. OH YEAH!
// But he imposed a condition: We had to merry, that was the reason
/* So in that church */ I_MET (/* my loving */star /*!!!!*/);
// OH YEAH!
/* And */ her_father. /* was my */ friend
= /* And to */ a_great_card_pile /* I had it to end. *//
/* For */ 6 /* dollars each card, */ + /* a few cents. */
/* With that */ stuff // done,
/* the */ .nextDouble /* trouble was gone! */
()/*n that day */* a_great_card_pile /* will never again be the reason to ring my phone! *//6;/*
*/ her_father /* was happy */.
/* His */ girl // was married!
=/*And how int*/eresting
/ 6+ /* times we are selling all that */stuff.
nextDouble /* tr*/()/*uble we had no more. */*
/* and look how */(int)eresting /
/* For just */ 6 /* bucks a card we selled */;
her_father. /* was */ very_nice
=// The man was very nice.
// OH YEAH!
/* And */ stuff. /* was done. */
/* The */ nextDouble /* tr*/()/*uble was gone. */*(
/* And how int*/eresting-
her_father /* was happy */.
/* coz his */ girl /* was married. */
); her_father/*s cards are */ .pretty
= /* he produces all that */stuff.
// And then I selled everything
// Until the last one!
/* The */ nextDouble /* tr*/()/*uble was gone. */*(
/* And to sell such */ a_great_card_pile // was a job done.
- her_father /* were my old */. friend
); her_father /* were so much */ .talented
=/*And all those */ stuff // we happy worked together!
/* But indeed the */.nextDouble /* tr*/()/*uble then come! */*
/* For */ 360 /* days I could even not imagine! */;
her_father /* used to */.draw( /* all those */ CARDS);}
// He did it pristine!
/* But now my */ love.girl /* was crying! */=
// Because her father was died.
/* And see how */ (int)eresting;
/* Is to feel */ love /* to a */ .friend
// But we do only perceive this
/* when it had come to the end */=
// But live goes on now.
a_great_card_pile /* entirely new was set on now. */;
/* That was my */ love.
/* A girl very */ talented
/* She */ =lize//d her father
// artistic scent.
(/*My */ love /* girl is so */.talented
+5 // times pround her father would now be then.
); /* And she */ love /* to */.draw(/* all those */ CARDS);}
/* She do it */ double // better
// of what did the old man.
/* Sometimes we rea*/lize(double /* times */ indeed){
/* That could her father has */ return//d
(( indeed </* in */0/*ur first kid*/)?
/* The boy is */ indeed //an artist.
+/* As was his grandpa */ 360 // months in the past.
:// When we do sell all those cards
/* I am very grateful */ indeed)
%// To that old man
// who once married his daughter to me.
/* I am */ 360 // times so grateful forever.
;} /* This is why I love so much his daughter
in his memory respect. */ }}
Befunge-93
Run as echo '[NAME]!' | ./befungee.py test
(assuming the code below is in a file named 'test') for the output "Happy Valentine's day [NAME]!"
The top few lines are for reading in the name; if you remove them and just leave the heart it will simply say "Happy Valentine's day".
v
v _ v _v# 1<
>~:"!"-^ >10g1+:10p0p:^>" "37*2+2p"v"63*2+:"g"\2p2+2p" "10p^
| -" "<
v <
> 92+:*91+9*v v:+19*2*5+<
v*66*5+2*37*<>7+v v1*<>*91+9*7v^29<
v3<>*7+89*v 4 <>9v v+<>*3^ >+9v^*<
v<>9^ v,_@^8*:+<>v v<>9^ >1v^<
v*+ *>:^ ^<>v v<>^ +.^
>v^< ^<>v v<>^ v<>^
>v^1< ^1<**>4^ v4<>^
>+v^9< v*<>4^
>9v^*7< v+3<>+^
>1+v^*< v2<>*1^
>:v^44< v8*<>7^
>*1v^*< v4<>*4^
>+v^7*< v9*<>7^
>92v^4< v2<>5*^
>+v^4< v+<>3^
>5v^*:<>*^
>*v>2^
>^