.josh Posted October 29, 2006 Share Posted October 29, 2006 Okay I have been inspired by one of steelman's (though it pains me to admit it ) posts to make a game. P.s. - Don't be jealous of the awesomeness of my game name! Okay here's how it works: It's just like those threads on other message boards where everybody contributes to making a story by posting the next sentence/few sentences/paragraph or whatever, except for we are gonna take the script and the next poster adds his/her little piece to it. The code you add doesn't have to really 'conform' to any particular theme or situation or goal or whatever, but it does have to be somehow useable or relavent to the script as a whole. In other words, if you wish to create a new arm for Frankenstein-Code, that's fine and dandy, but it has to be attached to his body, not just some random arm laying there. Also, the script has to be "self-contained." No database stuff. No flatfile stuff. I don't want people to have to go setting up and altering databases all the time, or having to mess with dir structures/permissions/whatever. Also no cookies. And keep it strictly PHP, as in, no adding in javascript or some other such thing. These rules may or may not be relaxed, depending on how this game progresses and what comes of it. Also, it should go without saying, but I'm gonna say it anyways, so that one cannot argue they "didn't know" : No malicious code, no vulgar or pornographic content, etc.. Now, in order to keep the code consistent and not have like 3 different people posting 'at the same time' or something, here's what we're gonna do: If you wanna be the next person to add to the script, make a 'placeholder' post, saying "placeholder" or "I'm next" or "get off my koolaid yo" or something. Then copy the code from the previous post, add your piece to it, and then edit your placeholder post. p.s. - Please use code tags when posting. Also, even though coding styles differ, things like indenting in some way are standard, so do it. Okay so I guess I'll start with the cheezy but fitting: <?php echo "Hello World!"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/ Share on other sites More sharing options...
redbullmarky Posted October 29, 2006 Share Posted October 29, 2006 <?php class Greeting { function Greeting() { echo "Hello World!"; } } $greet = new Greeting(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116441 Share on other sites More sharing options...
448191 Posted October 29, 2006 Share Posted October 29, 2006 <?php class Greeting { function Greeting() { echo "Hello World!"; } } interface Actor { public function speak(); public function meet($person); } class Franky implements Actor { private $person; public function meet($person){ $this->person = $person; } public function speak(){ if($this->person == null){ $greet = new Greeting(); echo '<br />'; } else { echo 'Hello '.$this->person.'!<br />'; } } } $h = new Franky; $h->speak(); $h->meet('Jesus'); $h->speak(); ?> Ha! I've forced php5 upon you. Franky is born.. Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116463 Share on other sites More sharing options...
redbullmarky Posted October 29, 2006 Share Posted October 29, 2006 <?php $relatives = array('mother', 'father', 'sister', 'brother','uncle', 'auntie'); $verbs = array('dislikes', 'sits on', 'licks', 'sucks', 'looks like', 'does', 'discusses the pros and cons of Web 2.0', 'loves', 'caresses', 'slides onto', 'hates', 'kisses', 'learns PHP with', 'has an AJAX interface with'); $animals = array('dogs', 'cats', 'horses', 'birds', 'giraffes', 'elephants', 'hippos', 'hamsters', 'gerbils', 'monkeys'); function insult($secondary_person) { global $relatives; global $verbs; global $animals; $r_size = sizeof($relatives) - 1; $v_size = sizeof($verbs) - 1; $a_size = sizeof($animals) - 1; $r_rand = rand(0, $r_size); $v_rand1 = rand(0, $v_size); $v_rand2 = rand(0, $v_size); $a_rand = rand(0, $a_size); $insult = "Your {$relatives[$r_rand]} {$verbs[$v_rand1]} $secondary_person and {$verbs[$v_rand1]} {$animals[$a_rand]}"; return $insult; } class Greeting { function Greeting() { echo "Hello World!"; } } interface Actor { public function speak(); public function meet($person); } class Franky implements Actor { private $person; public function meet($person){ $this->person = $person; } public function speak($insult_them = false){ if($this->person == null){ $greet = new Greeting(); echo '<br />'; } else { echo 'Hello '.$this->person.'!<br />'; if ($insult_them) { echo insult($this->person) . '<br />'; } } } } $h = new Franky; $h->speak(); $h->meet('Jesus'); $h->speak(true); ?> edit: i am not responsible for the output of this sample program. if you find it offends, then blame PHP, not me. everything in the above code is clean, non-offensive English. Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116479 Share on other sites More sharing options...
448191 Posted October 29, 2006 Share Posted October 29, 2006 Ouch, franky learned some new phrases.. Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116485 Share on other sites More sharing options...
redbullmarky Posted October 29, 2006 Share Posted October 29, 2006 Ouch, franky learned some new phrases.. dirty little sod, aint he?! BTW, can we standardise spaces/tabs? when it gets really tempting to try this out in our fave text editor, it doesnt always work for some reason unless the tabs/spaces are deleted+replaced. no idea why... Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116487 Share on other sites More sharing options...
.josh Posted October 30, 2006 Author Share Posted October 30, 2006 crap. i meant to say no php5 as well. oh well. i can do that. i guess if someone can't do php5 then tough titties. okay do you guys' posts ^ mean to serve as placeholders or what? nevermind, i will decide for you. unless your thread specificially states "placeholder/whatever" then it doesn't count as a placeholder. okay i just added something quick cuz i have to go soon: <?php $relatives = array('mother', 'father', 'sister', 'brother','uncle', 'auntie'); $verbs = array('dislikes', 'sits on', 'licks', 'sucks', 'looks like', 'does', 'discusses the pros and cons of Web 2.0', 'loves', 'caresses', 'slides onto', 'hates', 'kisses', 'learns PHP with', 'has an AJAX interface with'); $animals = array('dogs', 'cats', 'horses', 'birds', 'giraffes', 'elephants', 'hippos', 'hamsters', 'gerbils', 'monkeys'); function insult($secondary_person) { global $relatives; global $verbs; global $animals; $r_size = sizeof($relatives) - 1; $v_size = sizeof($verbs) - 1; $a_size = sizeof($animals) - 1; $r_rand = rand(0, $r_size); $v_rand1 = rand(0, $v_size); $v_rand2 = rand(0, $v_size); $a_rand = rand(0, $a_size); $insult = "Your {$relatives[$r_rand]} {$verbs[$v_rand1]} $secondary_person and {$verbs[$v_rand1]} {$animals[$a_rand]}"; return $insult; } class Greeting { function Greeting() { echo "Hello World!"; } } interface Actor { public function speak(); public function meet($person); } class Franky implements Actor { private $person; public function meet($person){ $this->person = $person; } public function speak($insult_them = false){ if($this->person == null){ $greet = new Greeting(); echo '<br />'; } else { echo 'Hello '.$this->person.'!<br />'; if ($insult_them) { echo insult($this->person) . '<br />'; } } } } if ($_POST['name']) { $h = new Franky; $h->speak(); $h->meet($_POST['name']); $h->speak(true); } else { echo <<<FORMINT What's your best friend's name?<br/> <form action = '{$_SERVER['PHP_SELF']}' method = 'post'> <input type = 'text' name = 'name' size = '10'> <input type = 'submit' value = 'submit'> </form> FORMINT; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116582 Share on other sites More sharing options...
448191 Posted October 30, 2006 Share Posted October 30, 2006 You cheated a little C_V... You made $h->meet('Jesus'); into $h->meet($_POST['name']); ! The way I understand your rules, we can only add to the scenario, not replace anything. Anyway, you're the boss, so I guess we're keeping it.. As for using php5, I don't think it would be a real Frankenstein if it wasn't a complete and utter chaos of different styles and fashions. Meaning if you can't do php5, you can still add. You won't be able to run Franky unless you have php5 installed, obviously, but I will be happy to display the fruits of the works of those that don't! Speaking of chaos, I added some intestants to Franky starting with his stomach. Turns out Franky has quite the appetite: Hello World! Hello Mister President! Your auntie discusses the pros and cons of Web 2.0 Mister President and discusses the pros and cons of Web 2.0 giraffes Franky liky to eats elephants.. Franky liky to eats elephants.. Franky liky to eats hamsters.. Franky liky to eats gerbils.. Franky liky to eats cats.. Franky liky to eats dogs.. Franky liky to eats elephants.. Bhaarf.. Franky liky to eats birds.. Bhaarf.. LOL, "Web 2.0 giraffes"? Chaos code: <?php $relatives = array('mother', 'father', 'sister', 'brother','uncle', 'auntie'); $verbs = array('dislikes', 'sits on', 'licks', 'sucks', 'looks like', 'does', 'discusses the pros and cons of Web 2.0', 'loves', 'caresses', 'slides onto', 'hates', 'kisses', 'learns PHP with', 'has an AJAX interface with'); $animals = array('dogs', 'cats', 'horses', 'birds', 'giraffes', 'elephants', 'hippos', 'hamsters', 'gerbils', 'monkeys'); function insult($secondary_person) { global $relatives; global $verbs; global $animals; $r_size = sizeof($relatives) - 1; $v_size = sizeof($verbs) - 1; $a_size = sizeof($animals) - 1; $r_rand = rand(0, $r_size); $v_rand1 = rand(0, $v_size); $v_rand2 = rand(0, $v_size); $a_rand = rand(0, $a_size); $insult = "Your {$relatives[$r_rand]} {$verbs[$v_rand1]} $secondary_person and {$verbs[$v_rand1]} {$animals[$a_rand]}"; return $insult; } class Greeting { function Greeting() { echo "Hello World!"; } } interface Singleton { public static function getInstance(); } interface Actor { public function speak(); public function meet($person); public function eat($animalArr); } abstract class Intestant_Abstract { abstract public function input($input); abstract public function output(); } class Stomach extends Intestant_Abstract implements Singleton { private static $instance; public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self; } return self::$instance; } private function __construct(){ } public $kilosOfFood; public function input($input){ $this->kilosOfFood += strlen($input); echo 'Franky liky to eats '.$input.'..<br />'; if($this->kilosOfFood > (strlen(implode('',$GLOBALS['animals']))/1.5)){ $this->output(); } } public function output(){ echo '<br />Bhaarf..<br />'; } } class Guts implements ArrayAccess, Singleton { private static $instance; public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self; } return self::$instance; } private function __construct(){ } private $intestants; public function add($name){ $this->intestants[$name] = call_user_func(array($name, 'getInstance')); } public function remove($key) { unset($this->intestants[$key]); } public function offsetExists($offset) { return isset($this->intestants[$offset]); } public function offsetGet($offset) { return $this->intestants[$offset]; } public function offsetSet($name, $value) { $this->add($name); } public function offsetUnset($offset) { unset($this->intestants[$offset]); } } class Franky implements Actor { private $person; public function meet($person){ $this->person = $person; } function eat($animals){ shuffle($animals); $guts = Guts::getInstance(); $guts->add('Stomach'); $guts['Stomach']->input(next($animals)); } public function speak($insult_them = false){ if($this->person == null){ $greet = new Greeting(); echo '<br />'; } else { echo 'Hello '.$this->person.'!<br />'; if ($insult_them) { echo insult($this->person) . '<br />'; } } } } if (isset($_POST['name'])) { $h = new Franky; $h->speak(); $h->meet($_POST['name']); $h->speak(true); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); } else { echo <<<FORMINT What's your best friend's name?<br/> <form action = '{$_SERVER['PHP_SELF']}' method = 'post'> <input type = 'text' name = 'name' size = '10'> <input type = 'submit' value = 'submit'> </form> FORMINT; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116662 Share on other sites More sharing options...
redbullmarky Posted October 30, 2006 Share Posted October 30, 2006 oops. this line: $verbs = array('dislikes', 'sits on', 'licks', 'sucks', 'looks like', 'does', 'discusses the pros and cons of Web 2.0', 'loves', 'caresses', 'slides onto', 'hates', 'kisses', 'learns PHP with', 'has an AJAX interface with'); should be 'discusses the pros and cons of Web 2.0 with' Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116663 Share on other sites More sharing options...
448191 Posted October 30, 2006 Share Posted October 30, 2006 oops. this line: $verbs = array('dislikes', 'sits on', 'licks', 'sucks', 'looks like', 'does', 'discusses the pros and cons of Web 2.0', 'loves', 'caresses', 'slides onto', 'hates', 'kisses', 'learns PHP with', 'has an AJAX interface with'); should be 'discusses the pros and cons of Web 2.0 with' Don't worry about it, it's meant to be a little jibberish, right? It's not like what I added is "solid code", by any standard! Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116668 Share on other sites More sharing options...
.josh Posted October 30, 2006 Author Share Posted October 30, 2006 Yeah I meant no php5 on account of some people maybe people unable to test it if they don't have it installed, yes. But who cares. Cheating? Bah! I don't consider that cheating. In fact, I'm surprised the original "hello world" is still there. Why? Because I can put "Jesus" into the input field and it will in essence be do the same thing as before. p.s. - rewriting code to run more efficiently or "better" is okay too. I'm certainly not the most php saavy person here; for instance you guys' OOP skills are much better than mine. So if you feel like "Franky" is somehow being crippled because of his internals, rewriting/reorganizing is okay - to an extent. We don't want complete rewrites every single post, I guess. But, well..well for instance, exactly how redbull turned the simple "hello world" into a method inside a class. LoL, I ran the code and this is what I got: Hello World! Hello Isaac! Your mother slides onto Isaac and slides onto gerbils Franky liky to eats birds.. Franky liky to eats dogs.. Franky liky to eats giraffes.. Franky liky to eats gerbils.. Franky liky to eats monkeys.. Franky liky to eats giraffes.. Franky liky to eats gerbils.. Bhaarf.. Franky liky to eats hamsters.. Bhaarf.. Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116782 Share on other sites More sharing options...
.josh Posted October 30, 2006 Author Share Posted October 30, 2006 <placeholder> Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116788 Share on other sites More sharing options...
KevinM1 Posted October 30, 2006 Share Posted October 30, 2006 Hehe, this is pretty interesting to read from a newb's point of view. Quick question: I'm a bit lost at <?php class Guts implements ArrayAccess, Singleton ?> As I don't see ArrayAccess defined anywhere. Am I missing something, or just blind? Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116789 Share on other sites More sharing options...
448191 Posted October 30, 2006 Share Posted October 30, 2006 ArrayAccess is an SPL interface, it's build-in into 5.1+ Edit: Don't use this code as an example to learn OOP, PLEASE. It's structure is at fault, I just threw something together quickly. Consider that the disclaimer. Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116790 Share on other sites More sharing options...
redbullmarky Posted October 30, 2006 Share Posted October 30, 2006 ArrayAccess is an SPL interface, it's build-in into 5.1+ Edit: Don't use this code as an example to learn OOP, PLEASE. It's structure is at fault, I just threw something together quickly. Consider that the disclaimer. lol an "Insult" generator and a person that eats animals and chucks up - beats "Hello World" any day Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116795 Share on other sites More sharing options...
448191 Posted October 30, 2006 Share Posted October 30, 2006 Hey C_V, c'mon give us Franky back, we wanna play some more.. Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116811 Share on other sites More sharing options...
.josh Posted October 30, 2006 Author Share Posted October 30, 2006 okay I thought I'd make a new post instead of editing the last one, since it's on a new page. Okay, It's all about.. Bride of Franky! <?php $relatives = array('mother', 'father', 'sister', 'brother','uncle', 'auntie'); $verbs = array('dislikes', 'sits on', 'licks', 'sucks', 'looks like', 'does', 'discusses the pros and cons of Web 2.0', 'loves', 'caresses', 'slides onto', 'hates', 'kisses', 'learns PHP with', 'has an AJAX interface with'); $animals = array('dogs', 'cats', 'horses', 'birds', 'giraffes', 'elephants', 'hippos', 'hamsters', 'gerbils', 'monkeys'); $adjectives = array('abhorrent','abject','abnormal','abrasive','absorbed','absurd', 'abusive','acrid','agonizing','ambiguous','ancient','apathetic', 'average','bad','barbarous','bawdy','belligerent','berserk', 'bizarre','black','boorish','brash','brawny','burly', 'callous','cold','colossal','combative','crabby','craven', 'crazy','creepy','crooked','cynical','demonic','deranged', 'devilish','direful','dirty','disagreeable','draconian','drunk', 'dysfunctional','erratic','evasive','evil','filthy','flippant', 'gaudy','giant','gigantic','greedy','grotesque','grouchy', 'gruesome','grumpy','guiltless','hellish','horrible','huge', 'hulking','icky','immense','irate','jaded','jittery', 'macho','maddening','malicious','mammoth','maniacal','massive', 'mighty','mindless','moaning','moldy','murky','mysterious', 'nasty','nauseating','noxious','oafish','obscene','psychotic', 'rabid','ruthless','sassy','scary','smelly','snobbish', 'snotty','spooky','threatening','tightfisted','tough','towering', 'trashy','ugly','unbecoming','unsightly','vagabond','vengeful', 'venomous','vulgar','wicked','wrathful','wretched'); function insult($secondary_person) { global $relatives; global $verbs; global $animals; $r_size = sizeof($relatives) - 1; $v_size = sizeof($verbs) - 1; $a_size = sizeof($animals) - 1; $r_rand = rand(0, $r_size); $v_rand1 = rand(0, $v_size); $v_rand2 = rand(0, $v_size); $a_rand = rand(0, $a_size); $insult = "Your {$relatives[$r_rand]} {$verbs[$v_rand1]} $secondary_person and {$verbs[$v_rand1]} {$animals[$a_rand]}"; return $insult; } class Greeting { function Greeting() { echo "Hello World!"; } } interface Singleton { public static function getInstance(); } interface Actor { public function speak(); public function meet($person); public function eat($animalArr); } abstract class Intestant_Abstract { abstract public function input($input); abstract public function output(); } class Stomach extends Intestant_Abstract implements Singleton { private static $instance; public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self; } return self::$instance; } private function __construct(){ } public $kilosOfFood; public function input($input){ $this->kilosOfFood += strlen($input); echo 'Franky liky to eats '.$input.'..<br />'; if($this->kilosOfFood > (strlen(implode('',$GLOBALS['animals']))/1.5)){ $this->output(); } } public function output(){ echo '<br />Bhaarf..<br />'; } } class Guts implements ArrayAccess, Singleton { private static $instance; public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self; } return self::$instance; } private function __construct(){ } private $intestants; public function add($name){ $this->intestants[$name] = call_user_func(array($name, 'getInstance')); } public function remove($key) { unset($this->intestants[$key]); } public function offsetExists($offset) { return isset($this->intestants[$offset]); } public function offsetGet($offset) { return $this->intestants[$offset]; } public function offsetSet($name, $value) { $this->add($name); } public function offsetUnset($offset) { unset($this->intestants[$offset]); } } class Franky implements Actor { private $person; public function meet($person){ $this->person = $person; } function eat($animals){ shuffle($animals); $guts = Guts::getInstance(); $guts->add('Stomach'); $guts['Stomach']->input(next($animals)); } public function speak($insult_them = false){ if($this->person == null){ $greet = new Greeting(); echo '<br />'; } else { echo 'Hello '.$this->person.'!<br />'; if ($insult_them) { echo insult($this->person) . '<br />'; } } } } if (isset($_POST['relativeName'])) { $relativeName = $_POST['relativeName']; $relativeType = $_POST['relativeType']; $h = new Franky; $h->speak(); $h->meet($relativeName); $h->speak(true); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $monstername = $adjectives[array_rand($adjectives)]; echo "<br/>Franky wants to marry your $relativeType.<br/>"; echo "$relativeName will join the monster family and<br/>"; echo "$relativeName's monster name will be $relativeName the $monstername.<br/>"; } else { $person = $relatives[array_rand($relatives)]; echo <<<FORMINT What's your $person's name?<br/> <form action = '{$_SERVER['PHP_SELF']}' method = 'post'> <input type = 'text' name = 'relativeName' size = '10'> <input type = 'hidden' name = 'relativeType' value = '$person'> <input type = 'submit' value = 'submit'> </form> FORMINT; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-116815 Share on other sites More sharing options...
fert Posted November 12, 2006 Share Posted November 12, 2006 <?php $relatives = array('mother', 'father', 'sister', 'brother','uncle', 'auntie'); $verbs = array('dislikes', 'sits on', 'licks', 'sucks', 'looks like', 'does', 'discusses the pros and cons of Web 2.0', 'loves', 'caresses', 'slides onto', 'hates', 'kisses', 'learns PHP with', 'has an AJAX interface with'); $animals = array('dogs', 'cats', 'horses', 'birds', 'giraffes', 'elephants', 'hippos', 'hamsters', 'gerbils', 'monkeys'); $adjectives = array('abhorrent','abject','abnormal','abrasive','absorbed','absurd', 'abusive','acrid','agonizing','ambiguous','ancient','apathetic', 'average','bad','barbarous','bawdy','belligerent','berserk', 'bizarre','black','boorish','brash','brawny','burly', 'callous','cold','colossal','combative','crabby','craven', 'crazy','creepy','crooked','cynical','demonic','deranged', 'devilish','direful','dirty','disagreeable','draconian','drunk', 'dysfunctional','erratic','evasive','evil','filthy','flippant', 'gaudy','giant','gigantic','greedy','grotesque','grouchy', 'gruesome','grumpy','guiltless','hellish','horrible','huge', 'hulking','icky','immense','irate','jaded','jittery', 'macho','maddening','malicious','mammoth','maniacal','massive', 'mighty','mindless','moaning','moldy','murky','mysterious', 'nasty','nauseating','noxious','oafish','obscene','psychotic', 'rabid','ruthless','sassy','scary','smelly','snobbish', 'snotty','spooky','threatening','tightfisted','tough','towering', 'trashy','ugly','unbecoming','unsightly','vagabond','vengeful', 'venomous','vulgar','wicked','wrathful','wretched'); function insult($secondary_person) { global $relatives; global $verbs; global $animals; $r_size = sizeof($relatives) - 1; $v_size = sizeof($verbs) - 1; $a_size = sizeof($animals) - 1; $r_rand = rand(0, $r_size); $v_rand1 = rand(0, $v_size); $v_rand2 = rand(0, $v_size); $a_rand = rand(0, $a_size); $insult = "Your {$relatives[$r_rand]} {$verbs[$v_rand1]} $secondary_person and {$verbs[$v_rand1]} {$animals[$a_rand]}"; return $insult; } class Greeting { function Greeting() { echo "Hello World!"; } } interface Singleton { public static function getInstance(); } interface Actor { public function speak(); public function meet($person); public function eat($animalArr); } abstract class Intestant_Abstract { abstract public function input($input); abstract public function output(); } class Stomach extends Intestant_Abstract implements Singleton { private static $instance; public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self; } return self::$instance; } private function __construct(){ } public $kilosOfFood; public function input($input){ $this->kilosOfFood += strlen($input); echo 'Franky liky to eats '.$input.'..<br />'; if($this->kilosOfFood > (strlen(implode('',$GLOBALS['animals']))/1.5)){ $this->output(); } } public function output(){ echo '<br />Bhaarf..<br />'; } } class Guts implements ArrayAccess, Singleton { private static $instance; public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self; } return self::$instance; } private function __construct(){ } private $intestants; public function add($name){ $this->intestants[$name] = call_user_func(array($name, 'getInstance')); } public function remove($key) { unset($this->intestants[$key]); } public function offsetExists($offset) { return isset($this->intestants[$offset]); } public function offsetGet($offset) { return $this->intestants[$offset]; } public function offsetSet($name, $value) { $this->add($name); } public function offsetUnset($offset) { unset($this->intestants[$offset]); } } class Franky implements Actor { private $person; public function meet($person){ $this->person = $person; } function eat($animals){ shuffle($animals); $guts = Guts::getInstance(); $guts->add('Stomach'); $guts['Stomach']->input(next($animals)); } public function speak($insult_them = false){ if($this->person == null){ $greet = new Greeting(); echo '<br />'; } else { echo 'Hello '.$this->person.'!<br />'; if ($insult_them) { echo insult($this->person) . '<br />'; } } } } function say($lang1,$lang2) { echo $lang1." rocks and ".$lang2." sucks"; } if (isset($_POST['relativeName'])) { $relativeName = $_POST['relativeName']; $relativeType = $_POST['relativeType']; $h = new Franky; $h->speak(); $h->meet($relativeName); $h->speak(true); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $h->eat($animals); $monstername = $adjectives[array_rand($adjectives)]; echo "<br/>Franky wants to marry your $relativeType.<br/>"; echo "$relativeName will join the monster family and<br/>"; echo "$relativeName's monster name will be $relativeName the $monstername.<br/>"; } else { $person = $relatives[array_rand($relatives)]; echo <<<FORMINT What's your $person's name?<br/> <form action = '{$_SERVER['PHP_SELF']}' method = 'post'> <input type = 'text' name = 'relativeName' size = '10'> <input type = 'hidden' name = 'relativeType' value = '$person'> <input type = 'submit' value = 'submit'> </form> FORMINT; } if(isset($_GET[lang1]) { say($_GET[lang1],$_GET[lang2]); } else { echo "<form action=".$_SERVER[php_SELF]." method=get>Language 1:<input type=\"text\" name=\"lang1\"><p>Language 2:<input type=\"text\" name=\"lang2\"></p></form>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-123351 Share on other sites More sharing options...
dalecosp Posted August 26, 2015 Share Posted August 26, 2015 Fert: Franky doesn't parse now. You're missing a closing parenthesis here: if(isset($_GET[lang1]) { <placeholder> Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-1519689 Share on other sites More sharing options...
scootstah Posted August 27, 2015 Share Posted August 27, 2015 You know this thread is like 9 years old, right? Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-1519701 Share on other sites More sharing options...
dalecosp Posted August 27, 2015 Share Posted August 27, 2015 Yeah, I figured that out. Still wanted to see what Franky had to say though.Somehow it was more interesting that w/e the heck was going on here yday afternoon Quote Link to comment https://forums.phpfreaks.com/topic/25514-the-super-cool-mostly-official-frankenstein-code-game-thread/#findComment-1519743 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.