Module: Games::MovablePiece
- Included in:
- Chess::Game
- Defined in:
- lib/boardgame_engine/game_modules.rb
Overview
Module for games where game pieces are moved
Instance Method Summary collapse
-
#play_move ⇒ void
Execute a single move according to player input.
Instance Method Details
#play_move ⇒ void
This method returns an undefined value.
Execute a single move according to player input
19 20 21 22 23 24 25 26 27 |
# File 'lib/boardgame_engine/game_modules.rb', line 19 def play_move puts 'Select your piece' piece, start_loc = select_piece_from_input puts "Select where to move \"#{piece}\" to. Type \"back\" to reselect piece" end_loc = select_destination(piece, start_loc) return play_move if end_loc == 'back' @board.move_piece(start_loc, end_loc) end |