bbuchalter/tictactoe_core

View on GitHub
lib/tictactoe/game/board.rb

Summary

Maintainability
A
0 mins
Test Coverage
module TicTacToe
  class Game
    module Board
      def move_at(position)
        board.at(position)
      end

      def board_state
        board.reduce({}) do |state, position|
          at = position.at.to_s
          state[at] = position.empty? ? {} : position.player.to_hash
          state
        end
      end

      def corners
        board.corners
      end

      def sides
        board.sides
      end
    end
  end
end