in

ASP.NET Weblogs

Eric Maino

System.Brain.CoreDump();

Proposal in C#

public bool Propose(Mate sigOther)
{

bool answer = false;

Conversation convo = CellPhone.Call(PhoneBook.SearchFor("Florist", "Greenville")[0]);
convo.Recieve("Hello, some florist in Greenville");
convo.Send("Could you please send a single rose...");
convo.SendThanks();
convo.End();

Car vehicle = new Car("Eric's Car");
vehicle.GetIn(me);
vehicle.DriveTo(new Location("Chicago"));
vehicle.ValletPark();

Hotel hotel = new Hotel("Renaissance Hotel");
hotel.CheckIn();
hotel.FindRoom();

me.Change();
me.PutOn(typeof(Shirt), "Microsoft Student Ambassador");
me.PutOn(typeof(Suit), "Ralph Lauren Polo");

me.Locate(typeof(TabletPC));

while (!me.IsReady()) 
         me.PracticeProposal();

convo = me.WaitForCall();
convo.Recieve("Hello, Mr. Maino you limo is here.");
convo.Send("Thanks, I will be down in a few moments...");
convo.End();

me.PickUp(typeof(Flower), "Rose petals");
me.PickUp(typeof(CD), "Monster Ballads Vol. 1");

Car limo = new Car("White Limousine");
limo.GetIn(me);
limo.GiveDriverInstructions("Drive to the airport and pretend I am not in here");
limo.ExplainToStupidDriver("No, it's not her birthday. I am going to propose. See this ring");

me.PrepareLimo();

limo.GiveDriverInstructions("There she is... Remember I am not in here");
limo.GetIn(sigOther);

if
(me.PopsTheQuestion(sigOther) == BigQuestionAnswer.Yes)
       answer = true;

return
answer;

}

CORRECTION: Thanks to Jeff for pointing out the error. There is no type TablePC, but yet it's of type TabletPC.

UPDATE: I noticed a few more bugs in this code, just minor spelling typo's when creating the HumanInteractionAPI this evening.

Comments

 

Bill Gates said:

Congratulations. See, women love geeks too.
November 15, 2004 8:42 AM
 

Douglas Reilly said:

Such a geek<g>. Congratulations!
November 16, 2004 1:49 PM
 

Alex said:

Dude that is aweosme...in both senses!!
November 17, 2004 10:35 AM
 

Damon said:

Nice job! So how does code resuse apply to this? *grin*
November 17, 2004 6:40 PM
 

Fabrice said:

I noticed you did not made sigOther a singleton, but instead a parameter you can change...
What that in case the return value was false, or do you still plan to reuse this method with other Mate objects? Maybe you created a class library after all?
November 19, 2004 6:22 AM
 

Srinivas Ivaturi said:

Nice one to see in C#. I coame accross such things quite often but this makes more sense.

December 7, 2004 1:31 AM
 

Kaisa M. Lindahl said:

Congratulations.
Best code I ever read!

Kaisa
December 7, 2004 3:15 AM
 

Adi Oltean said:

public void Post(Person me, Blog blog)
{

BlogComment comment = blog.GetNewComment();

comment.Title = BlogComment.DefaultTitle;
comment.Name = me.Name;
comment.Url = me.MyBlog.Url;
comment.Text = "Absolutely cool!";

comment.Submit();

}

December 7, 2004 3:21 AM
 

Anders Norås said:

public bool DecideWhetherToPropose() {
Magnoliophyta f=new Daisy();
int i=0;
while (f.HasMoreLeaves) {
f.Leaves.Pull();
i++;
}
return (i%2==0)?She.LovesMe:!She.LovesMe;
}

Get her a "I love my Geek" baby dolly tee-shirt from Think Geek: http://www.thinkgeek.com/tshirts/ladies/5981/

Congrats!
Anders
December 7, 2004 8:06 AM
 

TrackBack said:

Aaron B. Hockley's DroppedPackets &raquo; A Marriage Proposal in C#
December 7, 2004 8:29 AM
 

Dean said:

convo.Recieve("Hello, Mr. Maino you limo is here.");

should be YOUR limo!

I used to write this stuff in Pascal back in 1996

with women do begin sexings

Great fun!!
December 7, 2004 9:20 AM
 

Brian said:

This is my favorite line:

me.PickUp(typeof(CD), "Monster Ballads Vol. 1");

Awesome.
December 7, 2004 3:03 PM
 

Jota said:

damn...

doesnt compile here... whats your .net version?

nice code ;)
December 7, 2004 6:14 PM
 

nice one said:

Nice Stuff
December 8, 2004 1:21 AM
 

Anand said:

Nice Stuff.. Enjoy
December 8, 2004 1:21 AM
 

simi said:

very funny....
December 8, 2004 6:02 AM
 

Joel Martinez said:

Nice ... so what was the return value?
December 9, 2004 11:36 AM
 

Eric Maino said:

It returned true!
December 9, 2004 7:49 PM
 

TrackBack said:

Hian's Weblogs &raquo; Marriage Proposal in C# ??
December 9, 2004 8:08 PM
 

Chua Wen Ching said:

Wow... that is unique. Congrats :)
December 10, 2004 3:37 AM
 

Jens C said:

...you forgot the interesting part: the finally block??? ;-)

Congratulations!!! For both, your marriage and the code!
December 10, 2004 5:23 AM
 

kamran khan said:

mail id :k4kami@msn.com

good Excelllent keeep it up child!
:p
December 11, 2004 4:54 AM
 

TrackBack said:

December 27, 2004 11:30 AM
 

TrackBack said:

January 15, 2005 1:08 PM
 

TrackBack said:

January 16, 2005 10:26 AM

Leave a Comment

(required)  
(optional)
(required)  
Add