This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player | |
def play_turn(warrior) | |
warrior.walk! warrior.direction_of_stairs | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player | |
def play_turn(warrior) | |
direction = warrior.direction_of_stairs | |
warrior.feel(direction).empty? ? warrior.walk!(direction) : warrior.attack!(direction) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player | |
def initialize | |
@directions = [:backward, :left, :right, :forward] | |
end | |
def play_turn(warrior) | |
direction = warrior.direction_of_stairs | |
@directions.each do |d| | |
return warrior.bind! d if warrior.feel(d).enemy? and d != direction | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player | |
def play_turn(warrior) | |
@dir = warrior.direction_of_stairs | |
if not enemies_around(warrior).empty? | |
warrior.bind! warrior.direction_of enemies_around(warrior).first | |
else | |
warrior.feel(@dir).empty? ? warrior.walk!(@dir) : warrior.attack!(@dir) | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player | |
def play_turn(warrior) | |
@units, @enemies, @captives = warrior.listen, warrior.listen.select {|s| s.enemy?}, warrior.listen.select {|s| s.captive?} | |
[@enemies, @captives].each do |units| | |
next if units.empty? | |
act warrior, warrior.direction_of(units.first) | |
break | |
end | |
act warrior, warrior.direction_of_stairs if @units.empty? | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player | |
def play_turn(warrior) | |
@units, @enemies, @captives = warrior.listen, warrior.listen.select {|s| s.enemy?}, warrior.listen.select {|s| s.captive?} | |
@hurry_captives = @captives.select {|s| s.ticking?} | |
[@hurry_captives, @enemies, @captives].each do |units| | |
next if units.empty? | |
act warrior, warrior.direction_of(units.first) | |
break | |
end | |
act warrior, warrior.direction_of_stairs if @units.empty? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player | |
def play_turn(warrior) | |
@units = warrior.listen | |
@enemies = @units.select {|s| s.enemy?} | |
@captives = @units.select {|s| s.captive?} | |
@hurry_captives = @captives.select {|s| s.ticking?} | |
[@hurry_captives, @enemies, @captives].each do |units| | |
next if units.empty? | |
act warrior, warrior.direction_of(units.first) | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player | |
def play_turn(warrior) | |
@units = warrior.listen | |
@enemies = @units.select {|s| s.enemy?} | |
@captives = @units.select {|s| s.captive?} | |
@hurry_captives = @captives.select {|s| s.ticking?} | |
[@hurry_captives, @enemies, @captives].each do |units| | |
next if units.empty? | |
act warrior, warrior.direction_of(units.first) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player | |
def play_turn(warrior) | |
@units = warrior.listen | |
@enemies = @units.select {|s| s.enemy?} | |
@captives = @units.select {|s| s.captive?} | |
@hurry_captives = @captives.select {|s| s.ticking?} | |
[@hurry_captives, @enemies, @captives].each do |units| | |
next if units.empty? | |
act warrior, warrior.direction_of(units.first) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reading ./composer.json | |
Loading config file ./composer.json | |
Executing command (CWD): git describe --exact-match --tags | |
Executing command (CWD): git branch --no-color --no-abbrev -v | |
Reading /home/kevinkdpm/.composer/composer.json | |
Loading config file /home/kevinkdpm/.composer/composer.json | |
Executing command (CWD): git describe --exact-match --tags | |
Executing command (CWD): git branch --no-color --no-abbrev -v | |
Loading composer repositories with package information | |
Downloading https://packagist.org/packages.json |