yandod/php-warrior

I love “ruby-warrior” which is ruby based coding game. Both web version by bloc and, original gem version are awesome work.

Also I found python-warrior. That inspired me to implement RubyWarrior into PHP.

The game is commanding warrior to climb to top of 2 type of towers. 19-floors in total are now available to hack in PHP.

In ruby, typical code of warrior look like this:

class Player def play_turn(warrior) # cool code goes here if warrior.feel.enemy? warrior.attack! else warrior.walk! end end end

In PHP, the code turn to like this player.php. the nuance of ! is lost now. (python warrior is using _ insteand of !)

<?php class Player { public function play_turn($warrior) { # add your code here if ($warrior->feel()->is_captive()) { $warrior->rescue(); } else { $warrior->attack(); } } }

it tested with even PHP7 on TravisCI, it is available on packagist. to start game, install via composer.