PHP Game of Nim problem....
Posted: Sat Nov 22, 2008 9:01 pm
I'll right I have this project for my Orginization of Programming languages and the whole point is to learn a new language we don't know and then explain a bunch of its features to our class mates. So i thought PHP! now part of this project is to create a fairly simple program and use that to explain it to the class...now ive been searching for soooo long and i can not find out how to get user input....as of now the only way ive been able to get it to work is using some html code along with it....but the submit button isn't working very well....i understand the logic but i need some help getting this input figured out....i would prefer console output but it has to work on a windows machine.....so heres what i have so far....I'm also curious if php allows classes like in java and if so could someone give me a link to how this works i looked for quite a while and found some stuff but it only seemed to be for error checking....
here's what i have right now..im using roadsend Compiler...the newest realease...Roadsend PHP is compatible with PHP 5.2.x (ZendEngine 2.x).
while($takeFromPile == 0)
{
echo "Remaining in pile: ";
echo $pile1;
?>
<form action="hahahahah.php" method="post">
How many would you like to take: <input type="text" name="num" />
<input type="submit" />
</form>
<?php
$takeFromPile2 = $_GET["num"];
if($takeFromPile2 >= $pile/2)
echo "Please insert a value less than or equal to half the remaining pile";
else
{
$takeFromPile = $takeFromPile2;
$pile1 = $pile1 - $takeFromPile;
}
}
thanks in advance...
here's what i have right now..im using roadsend Compiler...the newest realease...Roadsend PHP is compatible with PHP 5.2.x (ZendEngine 2.x).
while($takeFromPile == 0)
{
echo "Remaining in pile: ";
echo $pile1;
?>
<form action="hahahahah.php" method="post">
How many would you like to take: <input type="text" name="num" />
<input type="submit" />
</form>
<?php
$takeFromPile2 = $_GET["num"];
if($takeFromPile2 >= $pile/2)
echo "Please insert a value less than or equal to half the remaining pile";
else
{
$takeFromPile = $takeFromPile2;
$pile1 = $pile1 - $takeFromPile;
}
}
thanks in advance...