public void R20_a_player_must_leave_the_opponent_with_a_legal_move_at_the_start_of_their_turn_if_it_is_possible_to_do_so() { var board = new AwariBoard( B: 4, F: 1, southAwari: 21, northAwari: 22); board.CanSow("B").Should().BeFalse(); board.CanSow("F").Should().BeTrue(); }
public void Returns_the_best_score_for_14_stones_after_4_moves() { var board = new AwariBoard( D: 1, E: 1, F: 11, a: 1, southAwari: 17, northAwari: 17); board.Evaluate(_evaluator, 8).Should().Be(2); }
public void Returns_the_best_score_for_6_stones() { var board = new AwariBoard( A: 1, E: 1, F: 2, a: 2, southAwari: 21, northAwari: 21); board.Evaluate(_evaluator, 12).Should().Be(4); }
public void Returns_the_best_score_when_game_ended_after_repetition_of_position() { var board = new AwariBoard( F: 1, f: 1, southAwari: 22, northAwari: 24); board.Evaluate(_evaluator, 12).Should().Be(-2); }
public void Returns_the_best_score_in_case_of_a_grand_slam() { var board = new AwariBoard( F: 2, a: 1, b: 2, southAwari: 24, northAwari: 19); board.Evaluate(_evaluator, 12).Should().Be(10); }
public void Can_correctly_calculate_with_three_stones() { // F can be played, gain of 12 var board = new AwariBoard( A: 1, D: 1, f: 1, southAwari: 0, northAwari: 45); board.Evaluate(_evaluator, 4).Should().Be(-42); }
public void Leaving_North_with_no_legal_move_is_allowed_and_move_played() { // F can be played, gain of 12 var board = new AwariBoard( F: 4, a: 2, b: 2, c: 2, d: 2, southAwari: 18, northAwari: 18); board.Evaluate(_evaluator, 4).Should().Be(12); }
public void Illegal_move_is_recognized_by_the_evaluator_and_not_played() { // F cannot be played, no gain for South var board = new AwariBoard( D: 2, F: 4, a: 2, b: 2, c: 2, d: 2, southAwari: 17, northAwari: 17); board.Evaluate(_evaluator, 4).Should().Be(0); }
public void R14_the_original_pit_is_skipped_whenever_it_is_encountered() { var board = new AwariBoard( f: 3, e: 3, d: 3, c: 3, b: 3, a: 3, A: 3, B: 0, C: 3, D: 3, E: 15, F: 3, southAwari: 1, northAwari: 2); board.Sow("E"); board.Pits["E"].Should().Be(0); }
public void R12_a_pit_may_be_sown_if_it_contains_one_or_more_stones() { var board = new AwariBoard( f: 3, e: 3, d: 3, c: 3, b: 3, a: 3, A: 3, B: 0, C: 3, D: 3, E: 3, F: 3, southAwari: 6, northAwari: 9); board.CanSow("A").Should().BeTrue(); board.CanSow("B").Should().BeFalse(); board.CanSow("C").Should().BeTrue(); }
private void CaptureTest(int stonesInEndPit, int expectedStonesLeftInEndPit, int expectedStonesInSouthAwari) { var board = new AwariBoard( a: 0, b: 4, c: 4, d: stonesInEndPit, e: 4, f: 4, A: 4, B: 4, C: 4, D: 4, E: 4, F: 4, southAwari: 0, northAwari: 8 - stonesInEndPit); board.Sow("F"); board.Pits["d"].Should().Be(expectedStonesLeftInEndPit); board.SouthAwari.Should().Be(expectedStonesInSouthAwari); }
public void R19_a_game_will_be_ended_by_a_player_being_unable_to_move_in_which_case_the_remaining_stones_on_the_board_belong_to_the_opponent() { var board = new AwariBoard( A: 2, B: 1, C: 1, southAwari: 21, northAwari: 23); board.Sow("A"); board.Pits["A"].Should().Be(0); board.Pits["B"].Should().Be(0); board.Pits["C"].Should().Be(0); board.GameHasEnded.Should().BeTrue(); board.SouthAwari.Should().Be(25); }
public void R16_if_the_previous_pit_then_contains_a_group_of_two_or_three_stones_these_stones_are_also_captured_and_so_forth() { var board = new AwariBoard( f: 4, e: 4, d: 4, c: 1, b: 2, a: 1, A: 11, B: 4, C: 6, D: 4, E: 4, F: 3, southAwari: 0, northAwari: 0); board.Sow("C"); board.Pits["a"].Should().Be(0); board.Pits["b"].Should().Be(0); board.Pits["c"].Should().Be(0); board.SouthAwari.Should().Be(7); }
public void R21_a_game_will_also_be_ended_by_repetition_each_player_captures_the_stones_on_their_side_of_the_board() { var board = new AwariBoard( f: 1, F: 1, southAwari: 22, northAwari: 24); board.Sow("F").Sow("f").Sow("A").Sow("a").Sow("B").Sow("b").Sow("C").Sow("c").Sow("D").Sow("d").Sow("E"); board.GameHasEnded.Should().BeFalse(); board.SouthAwari.Should().Be(22); board.NorthAwari.Should().Be(24); board.Sow("e"); board.GameHasEnded.Should().BeTrue(); board.SouthAwari.Should().Be(23); board.NorthAwari.Should().Be(25); }
public void R18_Stones_may_not_be_sown_for_a_grand_slam_unless_no_other_move_is_possible() { var board = new AwariBoard( f: 0, e: 0, d: 2, c: 1, b: 2, a: 1, A: 2, B: 0, C: 0, D: 0, E: 0, F: 4, southAwari: 18, northAwari: 18); board.CanSow("A").Should().BeTrue(); board.CanSow("F").Should().BeFalse(); board = new AwariBoard( d: 2, c: 1, b: 2, a: 1, F: 4, southAwari: 20, northAwari: 18); board.CanSow("F").Should().BeTrue(); }
public void R17_the_set_of_pits_which_are_captured_is_on_the_opponents_side_of_the_board_reachable_by_captures_from_the_last_pit_sown() { // Arrange var board = new AwariBoard( f: 4, e: 4, d: 4, c: 1, b: 2, a: 1, A: 13, B: 4, C: 6, D: 4, E: 4, F: 1, southAwari: 0, northAwari: 0); // Act board.Sow("C"); // Assert board.Pits["F"].Should().Be(2); board.Pits["a"].Should().Be(0); board.Pits["b"].Should().Be(0); board.Pits["c"].Should().Be(0); board.SouthAwari.Should().Be(7); }
public void I_can_get_the_best_score_for_the_initial_board_4_moves() { var board = AwariBoard.GetInitialBoard(); board.Evaluate(_evaluator, 8).Should().Be(0); }
public void Initialize() { _initialBoard = AwariBoard.GetInitialBoard(); }