Class: SergeantSimple::SergeantSimple
- Inherits:
-
Object
- Object
- SergeantSimple::SergeantSimple
- Defined in:
- lib/sergeant_simple/sergeant_simple.rb
Instance Attribute Summary collapse
-
#enemy_targeted_sectors ⇒ Object
readonly
Non API methods #####################################.
-
#targets ⇒ Object
readonly
Non API methods #####################################.
Instance Method Summary collapse
- #battleship_placement ⇒ Object
- #carrier_placement ⇒ Object
- #destroyer_placement ⇒ Object
- #enemy_targeting(coordinates) ⇒ Object
- #game_over(result, disqualification_reason = nil) ⇒ Object
-
#initialize ⇒ SergeantSimple
constructor
A new instance of SergeantSimple.
- #name ⇒ Object
- #new_game(opponent_name) ⇒ Object
- #next_target ⇒ Object
- #patrolship_placement ⇒ Object
- #submarine_placement ⇒ Object
- #target_result(coordinates, was_hit, ship_sunk) ⇒ Object
Constructor Details
#initialize ⇒ SergeantSimple
Returns a new instance of SergeantSimple.
51 52 53 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 51 def initialize reset end |
Instance Attribute Details
#enemy_targeted_sectors ⇒ Object (readonly)
Non API methods #####################################
49 50 51 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 49 def enemy_targeted_sectors @enemy_targeted_sectors end |
#targets ⇒ Object (readonly)
Non API methods #####################################
49 50 51 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 49 def targets @targets end |
Instance Method Details
#battleship_placement ⇒ Object
16 17 18 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 16 def battleship_placement return "B1 horizontal" end |
#carrier_placement ⇒ Object
12 13 14 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 12 def carrier_placement return "A1 horizontal" end |
#destroyer_placement ⇒ Object
20 21 22 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 20 def destroyer_placement return "C1 horizontal" end |
#enemy_targeting(coordinates) ⇒ Object
41 42 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 41 def enemy_targeting(coordinates) end |
#game_over(result, disqualification_reason = nil) ⇒ Object
44 45 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 44 def game_over(result, disqualification_reason=nil) end |
#name ⇒ Object
4 5 6 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 4 def name return "Sergeant Simple" end |
#new_game(opponent_name) ⇒ Object
8 9 10 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 8 def new_game(opponent_name) reset end |
#next_target ⇒ Object
32 33 34 35 36 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 32 def next_target target = target_for_current_shot @shots_taken += 1 return target end |
#patrolship_placement ⇒ Object
28 29 30 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 28 def patrolship_placement return "E1 horizontal" end |
#submarine_placement ⇒ Object
24 25 26 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 24 def submarine_placement return "D1 horizontal" end |
#target_result(coordinates, was_hit, ship_sunk) ⇒ Object
38 39 |
# File 'lib/sergeant_simple/sergeant_simple.rb', line 38 def target_result(coordinates, was_hit, ship_sunk) end |