The best cose to ever exist!
Posted: Thu May 03, 2007 3:57 pm
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
The following will save lives and make people millions of dollarsCode: Select all
<?php
function get_input($length = 255) {
$fr = fopen("php://stdin", "r");
$input = fgets($fr, $length);
$input = rtrim($input);
fclose($fr);
return $input;
}
echo "Pikachu attacks!\n";
$pikhealth = 100;
$pikattack = 4;
echo "attack , pokeball , flee\n";
echo "Choose a move: ";
$move = get_input(10);
if ($move == attack){
echo "Pikachu has Fainted!\n";
}
else if ($move == pokeball){
echo "You catch the wild Pikachu!\n";
echo "Give it a name?\n";
echo "Answer yes or no\n";
$yesno = get_input(10);
if ($yesno == yes){
echo "Enter a name: ";
$name = get_input(20);
echo "$name was transfered to box1 in someones pc!\n";
}
if ($yesno == no){
echo "Pikachu was transfered to box1 in someones pc!\n";
}
else if ($move == flee){
echo "You fail to escape!\n";
echo "Pikachu uses thunderbolt!\n";
echo "You get killed\n";
}
}
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]