def test_take_action_invalid_move_returns_neg_1(): env = Environment(2, 2, 2) env.cur_player = Cell.BLACK env.take_action(0) # black moves env.take_action(1) # red moves env.take_action(0) # black moves result = env.take_action(0) # Invalid move assert result == -1
def test_get_state_red_replaced_with_M(): ''' The position R E R B should be represented as Y E Y M when playing as black (M=mine, Y=yours) ''' env = Environment(2, 2, 2) env.cur_player = Cell.RED env.take_action(0) # red moves env.take_action(1) # black moves env.take_action(0) # red moves result = env.get_state() expected = 'YYEM' # what black sees assert result == expected
def test_take_action_curplayer_RED_changes_to_BLACK(): env = Environment(2, 2, 2) env.cur_player = Cell.RED env.take_action(0) assert env.cur_player == Cell.BLACK