Thanks for all the assistance, now I'm working on doing the reverse (along with a few other PhP-related items which I'll bring up after i've tackled the following two:
First - I'm trying to write the same game, but in reverse. Where the user guesses a number, and the computer guesses it. The computer should be able to guess the answer in 7 attempts if the user correctly uses the right buttons:
PHP Code:
<html>
<head>
<title>
Reverse "Thinking of a Number"
</title>
</head>
<body>
<form action="<?php $_SERVER['PHP_SELF']?>" method="post"> <?
//check to see if this is the first time here $GuessNumber = $_POST['GuessNumber'];
if ($_POST['Correct']) { echo "The Computer Succeeded!" }
//HTML Forms print <<<HERE
<input type = "hidden" name = "GuessNumber" value = "<?php echo($GuessNumber); ?>"">
<input type = "submit" value = "Too High"> <input type = "submit" value = "Too Low"> <input type = "submit" value = "Correct">
$GuessNumber
HERE;
?> </form>
</body>
</html>
Obviously it isn't finished yet, however I am looking for assistance. Compared to my posts above, I am curious as to how I would go about this. I believe it would look something like this:
1) Assign a random number to a value.
2) Depending on whether the user selects "Too High", or "Too Low", would depend on the change in the number. ((How would that look in code?))
3) Finally finishing in seven steps.
Second - Alright, after that I am attempting to build a 'poker hand', which randomly deals out five cards to the player. I have the images I need, I just need to get the coding perfect. A few hints are all I need for this one:
1) How would I assign the images//cards to a certain value?
2) Randoming the cards I don't understand how that would be processed or explained via PhP.
PS: Thanks for all the assistance with the project above. Any further help would be appreciated.
Last edited by MGT-Evelath : 10-16-2007 at 02:11 PM.
|