Jump to content

Can't figure out what to do..


Hate

Recommended Posts

Pick up a PHP book, read it and do the exercises at the end of the chapters. That way you get practice, solutions, learn, there won't be designing to do, and you won't have to spend extreme amounts of time developing code you won't use again.

Pick up a PHP book, read it and do the exercises at the end of the chapters. That way you get practice, solutions, learn, there won't be designing to do, and you won't have to spend extreme amounts of time developing code you won't use again.

 

I don't have a PHP book though... I looked into it at one point, but I really don't have that kind of money to spend on a book.  :(

 

 

How about something like a mail class. For example that would allow you to do something like

 

$mailer = new HateMailer()

$mailer->addRecipient('Mr Hate', '[email protected]');
$mailer->setFrom('[email protected]');
$mailer->setSubject('testing...');
$mailer->setBody('some text...');
$mailer->send();

 

It's difficult to give suggestions really because just as in the real world, one man's inspired project/app can be another man's nightmare.

Write the game of life.

 

Prompt the user for the number of generations to run for.

Enter the number of generations:
42<enter>

 

Generate a random grid and display to the user:

****************************************
*********.******************************
******************************.*********
****************************************
***.*****.******************************
****************************************
****************************************
****************************************
****************************************
****************************************
********************.*******************
****************************************
****************************************
****************************************
****************************************
*********.**********.*******************
****************************************
****************************************
****************************************
****************************************
******************************.*********
****************************************
****************************************
****************************************

 

An asterisk denotes a dead node and a dot denotes a live node.

 

Now update the grid for the number of generations with the following rules:

1) A live node surrounded by 5 or more other live nodes dies due to over crowding.

2) A dead node surrounded by 3 or less live nodes is reborn into a live node.

 

Each time you update the grid, display it to the user.

 

You can keep the borders dead for the sake of simplicity if you'd like.

 

And you can add arbitrary rules such as:

A live node with exactly 4 living neighbors relocates to a random dead spot within 9 units of travel.

 

Have fun!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.