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.

 

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.  :(

 

 

Link to comment
Share on other sites

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

 

$mailer = new HateMailer()

$mailer->addRecipient('Mr Hate', 'hate@phpfreaks.com');
$mailer->setFrom('somewhere@example.com');
$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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.