Skip to content

Instantly share code, notes, and snippets.

@yandod
Last active September 8, 2015 04:20
Show Gist options
  • Save yandod/35c5af104744f7745d5f to your computer and use it in GitHub Desktop.
Save yandod/35c5af104744f7745d5f to your computer and use it in GitHub Desktop.
phpwarrior/beginner-level2
<?php
class Player {
public function play_turn($warrior) {
switch (true) {
case $warrior->feel()->is_enemy():
$warrior->attack();
break;
default:
$warrior->walk();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment