<s> import collections <EOL> import unittest <EOL> from pelita . datamodel import CTFUniverse <EOL> from pelita . game_master import AStarNoiser , GameMaster , ManhattanNoiser , PlayerTimeout <EOL> from pelita . player import AbstractPlayer , SimpleTeam , StoppingPlayer , TestPlayer <EOL> from pelita . viewer import AbstractViewer <EOL> class TestGameMaster ( unittest . TestCase ) : <EOL> def test_team_names ( self ) : <EOL> test_layout = ( <EOL> """<STR_LIT>""" ) <EOL> team_1 = SimpleTeam ( "<STR_LIT>" , TestPlayer ( [ ] ) , TestPlayer ( [ ] ) ) <EOL> team_2 = SimpleTeam ( "<STR_LIT>" , TestPlayer ( [ ] ) , TestPlayer ( [ ] ) ) <EOL> game_master = GameMaster ( test_layout , [ team_1 , team_2 ] , <NUM_LIT:4> , <NUM_LIT:200> ) <EOL> self . assertEqual ( game_master . game_state [ "<STR_LIT>" ] [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> self . assertEqual ( game_master . game_state [ "<STR_LIT>" ] [ <NUM_LIT:1> ] , "<STR_LIT>" ) <EOL> game_master . set_initial ( ) <EOL> self . assertEqual ( game_master . game_state [ "<STR_LIT>" ] [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> self . assertEqual ( game_master . game_state [ "<STR_LIT>" ] [ <NUM_LIT:1> ] , "<STR_LIT>" ) <EOL> self . assertEqual ( team_1 . _players [ <NUM_LIT:0> ] . current_state [ "<STR_LIT>" ] [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> self . assertEqual ( team_1 . _players [ <NUM_LIT:0> ] . current_state [ "<STR_LIT>" ] [ <NUM_LIT:1> ] , "<STR_LIT>" ) <EOL> self . assertEqual ( team_1 . _players [ <NUM_LIT:1> ] . current_state [ "<STR_LIT>" ] [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> self . assertEqual ( team_1 . _players [ <NUM_LIT:1> ] . current_state [ "<STR_LIT>" ] [ <NUM_LIT:1> ] , "<STR_LIT>" ) <EOL> self . assertEqual ( team_2 . _players [ <NUM_LIT:0> ] . current_state [ "<STR_LIT>" ] [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> self . assertEqual ( team_2 . _players [ <NUM_LIT:0> ] . current_state [ "<STR_LIT>" ] [ <NUM_LIT:1> ] , "<STR_LIT>" ) <EOL> self . assertEqual ( team_2 . _players [ <NUM_LIT:1> ] . current_state [ "<STR_LIT>" ] [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> self . assertEqual ( team_2 . _players [ <NUM_LIT:1> ] . current_state [ "<STR_LIT>" ] [ <NUM_LIT:1> ] , "<STR_LIT>" ) <EOL> def test_team_names_in_simpleteam ( self ) : <EOL> test_layout = ( <EOL> """<STR_LIT>""" ) <EOL> team_1 = SimpleTeam ( '<STR_LIT>' , TestPlayer ( [ ] ) , TestPlayer ( [ ] ) ) <EOL> team_2 = SimpleTeam ( '<STR_LIT>' , TestPlayer ( [ ] ) , TestPlayer ( [ ] ) ) <EOL> game_master = GameMaster ( test_layout , [ team_1 , team_2 ] , <NUM_LIT:4> , <NUM_LIT:200> ) <EOL> game_master . set_initial ( ) <EOL> self . assertEqual ( game_master . game_state [ "<STR_LIT>" ] [ <NUM_LIT:0> ] , "<STR_LIT>" ) <EOL> self . assertEqual ( game_master . game_state [ "<STR_LIT>" ] [ <NUM_LIT:1> ] , "<STR_LIT>" ) <EOL> def test_too_few_registered_teams ( self ) : <EOL> test_layout_4 = ( <EOL> """<STR_LIT>""" ) <EOL> team_1 = SimpleTeam ( TestPlayer ( [ ] ) , TestPlayer ( [ ] ) ) <EOL> self . assertRaises ( ValueError , GameMaster , test_layout_4 , [ team_1 ] , <NUM_LIT:4> , <NUM_LIT:200> ) <EOL> def test_too_many_registered_teams ( self ) : <EOL> test_layout_4 = ( <EOL> """<STR_LIT>""" ) <EOL> team_1 = SimpleTeam ( TestPlayer ( [ ] ) , TestPlayer ( [ ] ) ) <EOL> team_2 = SimpleTeam ( TestPlayer ( [ ] ) , TestPlayer ( [ ] ) ) <EOL> team_3 = SimpleTeam ( TestPlayer ( [ ] ) , TestPlayer ( [ ] ) ) <EOL> self . assertRaises ( ValueError , GameMaster , test_layout_4 , [ team_1 , team_2 , team_3 ] , <NUM_LIT:4> , <NUM_LIT:200> ) <EOL> class TestUniverseNoiser ( unittest . TestCase ) : <EOL> def test_uniform_noise_a_star ( self ) : <EOL> test_layout = ( <EOL> """<STR_LIT>""" ) <EOL> universe = CTFUniverse . create ( test_layout , <NUM_LIT:2> ) <EOL> noiser = AStarNoiser ( universe . copy ( ) ) <EOL> position_bucket = collections . defaultdict ( int ) <EOL> for i in range ( <NUM_LIT:100> ) : <EOL> new = noiser . uniform_noise ( universe . copy ( ) , <NUM_LIT:1> ) <EOL> self . assertTrue ( new . bots [ <NUM_LIT:0> ] . noisy ) <EOL> position_bucket [ new . bots [ <NUM_LIT:0> ] . current_pos ] += <NUM_LIT:1> <EOL> self . assertEqual ( <NUM_LIT:100> , sum ( position_bucket . values ( ) ) ) <EOL> expected = [ ( <NUM_LIT:1> , <NUM_LIT:2> ) , ( <NUM_LIT:7> , <NUM_LIT:3> ) , ( <NUM_LIT:1> , <NUM_LIT:3> ) , ( <NUM_LIT:3> , <NUM_LIT:3> ) , ( <NUM_LIT:6> , <NUM_LIT:3> ) , <EOL> ( <NUM_LIT:2> , <NUM_LIT:3> ) , ( <NUM_LIT:4> , <NUM_LIT:3> ) , ( <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:5> , <NUM_LIT:3> ) ] <EOL> self . assertCountEqual ( position_bucket , expected , position_bucket ) <EOL> def test_uniform_noise_manhattan ( self ) : <EOL> test_layout = ( <EOL> """<STR_LIT>""" ) <EOL> universe = CTFUniverse . create ( test_layout , <NUM_LIT:2> ) <EOL> noiser = ManhattanNoiser ( universe . copy ( ) ) <EOL> position_bucket = collections . defaultdict ( int ) <EOL> for i in range ( <NUM_LIT:200> ) : <EOL> new = noiser . uniform_noise ( universe . copy ( ) , <NUM_LIT:1> ) <EOL> self . assertTrue ( new . bots [ <NUM_LIT:0> ] . noisy ) <EOL> position_bucket [ new . bots [ <NUM_LIT:0> ] . current_pos ] += <NUM_LIT:1> <EOL> self . assertEqual ( <NUM_LIT:200> , sum ( position_bucket . values ( ) ) ) <EOL> expected = [ ( <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:1> , <NUM_LIT:2> ) , ( <NUM_LIT:1> , <NUM_LIT:3> ) , ( <NUM_LIT:2> , <NUM_LIT:3> ) , ( <NUM_LIT:3> , <NUM_LIT:3> ) , <EOL> ( <NUM_LIT:4> , <NUM_LIT:3> ) , ( <NUM_LIT:5> , <NUM_LIT:3> ) , ( <NUM_LIT:6> , <NUM_LIT:3> ) , ( <NUM_LIT:7> , <NUM_LIT:3> ) , ( <NUM_LIT:7> , <NUM_LIT:2> ) , <EOL> ( <NUM_LIT:6> , <NUM_LIT:1> ) , ( <NUM_LIT:5> , <NUM_LIT:1> ) , ( <NUM_LIT:4> , <NUM_LIT:1> ) , ( <NUM_LIT:3> , <NUM_LIT:1> ) ] <EOL> self . assertCountEqual ( position_bucket , expected , position_bucket ) <EOL> def test_uniform_noise_4_bots_a_star ( self ) : <EOL> test_layout = ( <EOL> """<STR_LIT>""" ) <EOL> universe = CTFUniverse . create ( test_layout , <NUM_LIT:4> ) <EOL> noiser = AStarNoiser ( universe . copy ( ) ) <EOL> expected_0 = [ ( <NUM_LIT:1> , <NUM_LIT:2> ) , ( <NUM_LIT:7> , <NUM_LIT:3> ) , ( <NUM_LIT:1> , <NUM_LIT:3> ) , ( <NUM_LIT:3> , <NUM_LIT:3> ) , ( <NUM_LIT:6> , <NUM_LIT:3> ) , <EOL> ( <NUM_LIT:2> , <NUM_LIT:3> ) , ( <NUM_LIT:4> , <NUM_LIT:3> ) , ( <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:5> , <NUM_LIT:3> ) ] <EOL> position_bucket_0 = collections . defaultdict ( int ) <EOL> expected_2 = [ ( <NUM_LIT:7> , <NUM_LIT:3> ) , ( <NUM_LIT:8> , <NUM_LIT:2> ) , ( <NUM_LIT:7> , <NUM_LIT:1> ) , ( <NUM_LIT:8> , <NUM_LIT:1> ) , ( <NUM_LIT:6> , <NUM_LIT:1> ) , ( <NUM_LIT:3> , <NUM_LIT:1> ) , ( <NUM_LIT:5> , <NUM_LIT:1> ) , <EOL> ( <NUM_LIT:4> , <NUM_LIT:1> ) , ( <NUM_LIT:7> , <NUM_LIT:2> ) ] <EOL> position_bucket_2 = collections . defaultdict ( int ) <EOL> for i in range ( <NUM_LIT:100> ) : <EOL> new = noiser . uniform_noise ( universe . copy ( ) , <NUM_LIT:1> ) <EOL> self . assertTrue ( new . bots [ <NUM_LIT:0> ] . noisy ) <EOL> self . assertTrue ( new . bots [ <NUM_LIT:2> ] . noisy ) <EOL> position_bucket_0 [ new . bots [ <NUM_LIT:0> ] . current_pos ] += <NUM_LIT:1> <EOL> position_bucket_2 [ new . bots [ <NUM_LIT:2> ] . current_pos ] += <NUM_LIT:1> <EOL> self . assertEqual ( <NUM_LIT:100> , sum ( position_bucket_0 . values ( ) ) ) <EOL> self . assertEqual ( <NUM_LIT:100> , sum ( position_bucket_2 . values ( ) ) ) <EOL> self . assertCountEqual ( position_bucket_0 , expected_0 , sorted ( position_bucket_0 . keys ( ) ) ) <EOL> self . assertCountEqual ( position_bucket_2 , expected_2 , sorted ( position_bucket_2 . keys ( ) ) ) <EOL> def test_uniform_noise_4_bots_manhattan ( self ) : <EOL> test_layout = ( <EOL> """<STR_LIT>""" ) <EOL> universe = CTFUniverse . create ( test_layout , <NUM_LIT:4> ) <EOL> noiser = ManhattanNoiser ( universe . copy ( ) ) <EOL> expected_0 = [ ( <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:1> , <NUM_LIT:2> ) , ( <NUM_LIT:1> , <NUM_LIT:3> ) , ( <NUM_LIT:2> , <NUM_LIT:3> ) , ( <NUM_LIT:3> , <NUM_LIT:3> ) , <EOL> ( <NUM_LIT:4> , <NUM_LIT:3> ) , ( <NUM_LIT:5> , <NUM_LIT:3> ) , ( <NUM_LIT:6> , <NUM_LIT:3> ) , ( <NUM_LIT:7> , <NUM_LIT:3> ) , ( <NUM_LIT:7> , <NUM_LIT:2> ) , <EOL> ( <NUM_LIT:7> , <NUM_LIT:1> ) , ( <NUM_LIT:6> , <NUM_LIT:1> ) , ( <NUM_LIT:5> , <NUM_LIT:1> ) , ( <NUM_LIT:4> , <NUM_LIT:1> ) , ( <NUM_LIT:3> , <NUM_LIT:1> ) , <EOL> ( <NUM_LIT:8> , <NUM_LIT:2> ) , ( <NUM_LIT:8> , <NUM_LIT:3> ) ] <EOL> position_bucket_0 = collections . defaultdict ( int ) <EOL> expected_2 = [ ( <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:1> , <NUM_LIT:2> ) , ( <NUM_LIT:2> , <NUM_LIT:3> ) , ( <NUM_LIT:3> , <NUM_LIT:3> ) , ( <NUM_LIT:4> , <NUM_LIT:3> ) , <EOL> ( <NUM_LIT:5> , <NUM_LIT:3> ) , ( <NUM_LIT:6> , <NUM_LIT:3> ) , ( <NUM_LIT:7> , <NUM_LIT:3> ) , ( <NUM_LIT:8> , <NUM_LIT:2> ) , ( <NUM_LIT:8> , <NUM_LIT:1> ) , <EOL> ( <NUM_LIT:7> , <NUM_LIT:1> ) , ( <NUM_LIT:6> , <NUM_LIT:1> ) , ( <NUM_LIT:5> , <NUM_LIT:1> ) , ( <NUM_LIT:4> , <NUM_LIT:1> ) , ( <NUM_LIT:3> , <NUM_LIT:1> ) , <EOL> ( <NUM_LIT:9> , <NUM_LIT:2> ) , ( <NUM_LIT:8> , <NUM_LIT:3> ) , ( <NUM_LIT:7> , <NUM_LIT:2> ) ] <EOL> position_bucket_2 = collections . defaultdict ( int ) <EOL> for i in range ( <NUM_LIT:200> ) : <EOL> new = noiser . uniform_noise ( universe . copy ( ) , <NUM_LIT:1> ) <EOL> self . assertTrue ( new . bots [ <NUM_LIT:0> ] . noisy ) <EOL> self . assertTrue ( new . bots [ <NUM_LIT:2> ] . noisy ) <EOL> position_bucket_0 [ new . bots [ <NUM_LIT:0> ] . current_pos ] += <NUM_LIT:1> <EOL> position_bucket_2 [ new . bots [ <NUM_LIT:2> ] . current_pos ] += <NUM_LIT:1> <EOL> self . assertEqual ( <NUM_LIT:200> , sum ( position_bucket_0 . values ( ) ) ) <EOL> self . assertEqual ( <NUM_LIT:200> , sum ( position_bucket_2 . values ( ) ) ) <EOL> self . assertCountEqual ( position_bucket_0 , expected_0 , sorted ( position_bucket_0 . keys ( ) ) ) <EOL> self . assertCountEqual ( position_bucket_2 , expected_2 , sorted ( position_bucket_2 . keys ( ) ) ) <EOL> def test_uniform_noise_4_bots_no_noise_a_star ( self ) : <EOL> test_layout = ( <EOL> """<STR_LIT>""" ) <EOL> universe = CTFUniverse . create ( test_layout , <NUM_LIT:4> ) <EOL> noiser = AStarNoiser ( universe . copy ( ) ) <EOL> expected_0 = [ ( <NUM_LIT:1> , <NUM_LIT:2> ) , ( <NUM_LIT:7> , <NUM_LIT:3> ) , ( <NUM_LIT:1> , <NUM_LIT:3> ) , ( <NUM_LIT:3> , <NUM_LIT:3> ) , ( <NUM_LIT:6> , <NUM_LIT:3> ) , <EOL> ( <NUM_LIT:2> , <NUM_LIT:3> ) , ( <NUM_LIT:4> , <NUM_LIT:3> ) , ( <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:5> , <NUM_LIT:3> ) ] <EOL> position_bucket_0 = collections . defaultdict ( int ) <EOL> bot_2_pos = ( <NUM_LIT> , <NUM_LIT:1> ) <EOL> position_bucket_2 = { bot_2_pos : <NUM_LIT:0> } <EOL> for i in range ( <NUM_LIT:100> ) : <EOL> new = noiser . uniform_noise ( universe . copy ( ) , <NUM_LIT:1> ) <EOL> self . assertTrue ( new . bots [ <NUM_LIT:0> ] . noisy ) <EOL> self . assertFalse ( new . bots [ <NUM_LIT:2> ] . noisy ) <EOL> position_bucket_0 [ new . bots [ <NUM_LIT:0> ] . current_pos ] += <NUM_LIT:1> <EOL> position_bucket_2 [ new . bots [ <NUM_LIT:2> ] . current_pos ] += <NUM_LIT:1> <EOL> self . assertEqual ( <NUM_LIT:100> , sum ( position_bucket_0 . values ( ) ) ) <EOL> self . assertEqual ( <NUM_LIT:100> , sum ( position_bucket_2 . values ( ) ) ) <EOL> self . assertCountEqual ( position_bucket_0 , expected_0 , position_bucket_0 ) <EOL> self . assertEqual ( <NUM_LIT:100> , position_bucket_2 [ bot_2_pos ] ) <EOL> def test_uniform_noise_4_bots_no_noise_manhattan ( self ) : <EOL> test_layout = ( <EOL> """<STR_LIT>""" ) <EOL> universe = CTFUniverse . create ( test_layout , <NUM_LIT:4> ) <EOL> noiser = ManhattanNoiser ( universe . copy ( ) ) <EOL> expected_0 = [ ( <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:3> , <NUM_LIT:1> ) , ( <NUM_LIT:4> , <NUM_LIT:1> ) , ( <NUM_LIT:5> , <NUM_LIT:1> ) , ( <NUM_LIT:6> , <NUM_LIT:1> ) , <EOL> ( <NUM_LIT:1> , <NUM_LIT:2> ) , ( <NUM_LIT:1> , <NUM_LIT:3> ) , ( <NUM_LIT:2> , <NUM_LIT:3> ) , ( <NUM_LIT:3> , <NUM_LIT:3> ) , ( <NUM_LIT:4> , <NUM_LIT:3> ) , ( <NUM_LIT:5> , <NUM_LIT:3> ) , <EOL> ( <NUM_LIT:6> , <NUM_LIT:3> ) , ( <NUM_LIT:7> , <NUM_LIT:3> ) , ( <NUM_LIT:7> , <NUM_LIT:2> ) ] <EOL> position_bucket_0 = collections . defaultdict ( int ) <EOL> bot_2_pos = ( <NUM_LIT> , <NUM_LIT:1> ) <EOL> position_bucket_2 = { bot_2_pos : <NUM_LIT:0> } <EOL> for i in range ( <NUM_LIT:200> ) : <EOL> new = noiser . uniform_noise ( universe . copy ( ) , <NUM_LIT:1> ) <EOL> self . assertTrue ( new . bots [ <NUM_LIT:0> ] . noisy ) <EOL> self . assertFalse ( new . bots [ <NUM_LIT:2> ] . noisy ) <EOL> position_bucket_0 [ new . bots [ <NUM_LIT:0> ] . current_pos ] += <NUM_LIT:1> <EOL> position_bucket_2 [ new . bots [ <NUM_LIT:2> ] . current_pos ] += <NUM_LIT:1> <EOL> self . assertEqual ( <NUM_LIT:200> , sum ( position_bucket_0 . values ( ) ) ) <EOL> self . assertEqual ( <NUM_LIT:200> , sum ( position_bucket_2 . values ( ) ) ) <EOL> self . assertCountEqual ( position_bucket_0 , expected_0 , position_bucket_0 ) <EOL> self . assertEqual ( <NUM_LIT:200> , position_bucket_2 [ bot_2_pos ] ) <EOL> def test_noise_a_star_failure ( self ) : <EOL> test_layout = ( <EOL> """<STR_LIT>""" ) <EOL> universe = CTFUniverse . create ( test_layout , <NUM_LIT:4> ) <EOL> positions = [ b . current_pos for b in universe . bots ] <EOL> team_positions = [ ] <EOL> enemy_positions = [ ] <EOL> RANDOM_TESTS = <NUM_LIT:3> <EOL> for i in range ( RANDOM_TESTS ) : <EOL> noiser = AStarNoiser ( universe . copy ( ) ) <EOL> new_uni = noiser . uniform_noise ( universe . copy ( ) , <NUM_LIT:0> ) <EOL> new_positions = [ b . current_pos for b in new_uni . bots ] <EOL> team_positions += new_positions [ <NUM_LIT:0> : : <NUM_LIT:2> ] <EOL> enemy_positions += new_positions [ <NUM_LIT:1> : : <NUM_LIT:2> ] <EOL> self . assertEqual ( set ( positions [ <NUM_LIT:0> : : <NUM_LIT:2> ] ) , set ( team_positions ) ) <EOL> self . assertNotEqual ( set ( positions [ <NUM_LIT:1> : : <NUM_LIT:2> ] ) , set ( enemy_positions ) , <EOL> "<STR_LIT>" ) <EOL> def test_noise_manhattan_failure ( self ) : <EOL> test_layout = ( <EOL> """<STR_LIT>""" ) <EOL> universe = CTFUniverse . create ( test_layout , <NUM_LIT:4> ) <EOL> positions = [ b . current_pos for b in universe . bots ] <EOL> positions = [ b . current_pos for b in universe . bots ] <EOL> team_positions = [ ] <EOL> enemy_positions = [ ] <EOL> RANDOM_TESTS = <NUM_LIT:3> <EOL> for i in range ( RANDOM_TESTS ) : <EOL> noiser = ManhattanNoiser ( universe . copy ( ) ) <EOL> new_uni = noiser . uniform_noise ( universe . copy ( ) , <NUM_LIT:0> ) <EOL> new_positions = [ b . current_pos for b in new_uni . bots ] <EOL> team_positions += new_positions [ <NUM_LIT:0> : : <NUM_LIT:2> ] <EOL> enemy_positions += new_positions [ <NUM_LIT:1> : : <NUM_LIT:2> ] <EOL> self . assertEqual ( set ( positions [ <NUM_LIT:0> : : <NUM_LIT:2> ] ) , set ( team_positions ) ) <EOL> self . assertNotEqual ( set ( positions [ <NUM_LIT:1> : : <NUM_LIT:2> ] ) , set ( enemy_positions ) , <EOL> "<STR_LIT>" ) <EOL> class TestAbstracts ( unittest . TestCase ) : <EOL> class BrokenViewer ( AbstractViewer ) : <EOL> pass <EOL> def test_AbstractViewer ( self ) : <EOL> self . assertRaises ( TypeError , AbstractViewer ) <EOL> def test_BrokenViewer ( self ) : <EOL> self . assertRaises ( TypeError , self . BrokenViewer ) <EOL> class TestGame ( unittest . TestCase ) : <EOL> def test_game ( self ) : <EOL> test_start = ( <EOL> """<STR_LIT>""" ) <EOL> number_bots = <NUM_LIT:2> <EOL> def create_TestUniverse ( layout , black_score = <NUM_LIT:0> , white_score = <NUM_LIT:0> ) : <EOL> initial_pos = [ ( <NUM_LIT:1> , <NUM_LIT:1> ) , ( <NUM_LIT:4> , <NUM_LIT:2> ) ] <EOL> universe = CTFUniverse . create ( layout , number_bots ) <EOL> universe . teams [ <NUM_LIT:0> ] . score = black_score <EOL> universe . teams [ <NUM_LIT:1> ] . score = white_score <EOL> for i , pos in enumerate ( initial_pos ) : <EOL> universe . bots [ i ] . initial_pos = pos <EOL> if not ( <NUM_LIT:1> , <NUM_LIT:2> ) in universe . food_list : <EOL> universe . teams [ <NUM_LIT:1> ] . score += <NUM_LIT:1> <EOL> if not ( <NUM_LIT:2> , <NUM_LIT:2> ) in universe . food_list : <EOL> universe . teams [ <NUM_LIT:1> ] . score += <NUM_LIT:1> <EOL> if not ( <NUM_LIT:3> , <NUM_LIT:1> ) in universe . food_list : <EOL> universe . teams [ <NUM_LIT:0> ] . score += <NUM_LIT:1> <EOL> return universe <EOL> teams = [ SimpleTeam ( TestPlayer ( '<STR_LIT>' ) ) , SimpleTeam ( TestPlayer ( '<STR_LIT>' ) ) ] <EOL> gm = GameMaster ( test_start , teams , number_bots , <NUM_LIT:200> ) <EOL> gm . set_initial ( ) <EOL> gm . play_round ( ) <EOL> test_first_round = ( <EOL> """<STR_LIT>""" ) <EOL> self . assertEqual ( create_TestUniverse ( test_first_round ) , gm . universe ) <EOL> gm . play_round ( ) <EOL> test_second_round = ( <EOL> """<STR_LIT>""" ) <EOL> self . assertEqual ( create_TestUniverse ( test_second_round ) , gm . universe ) <EOL> gm . play_round ( ) <EOL> test_third_round = ( <EOL> """<STR_LIT>""" ) <EOL> self . assertEqual ( create_TestUniverse ( test_third_round , <EOL> black_score = gm . universe . KILLPOINTS ) , gm . universe ) <EOL> gm . play_round ( ) <EOL> test_fourth_round = ( <EOL> """<STR_LIT>""" ) <EOL> self . assertEqual ( create_TestUniverse ( test_fourth_round , <EOL> black_score = gm . universe . KILLPOINTS , white_score = gm . universe . KILLPOINTS ) , gm . universe ) <EOL> gm . play_round ( ) <EOL> test_fifth_round = ( <EOL> """<STR_LIT>""" ) <EOL> self . assertEqual ( create_TestUniverse ( test_fifth_round , <EOL> black_score = gm . universe . KILLPOINTS , white_score = gm . universe . KILLPOINTS ) , gm . universe ) <EOL> print ( gm . universe . pretty ) <EOL> gm . play_round ( ) <EOL> test_sixth_round = ( <EOL> """<STR_LIT>""" ) <EOL> print ( gm . universe . pretty ) <EOL> self . assertEqual ( create_TestUniverse ( test_sixth_round , <EOL> black_score = gm . universe . KILLPOINTS , white_score = gm . universe . KILLPOINTS ) , gm . universe ) <EOL> teams = [ SimpleTeam ( TestPlayer ( '<STR_LIT>' ) ) , SimpleTeam ( TestPlayer ( '<STR_LIT>' ) ) ] <EOL> gm = GameMaster ( test_start , teams , number_bots , <NUM_LIT:200> ) <EOL> gm . play ( ) <EOL> test_sixth_round = ( <EOL> """<STR_LIT>""" ) <EOL> self . assertEqual ( create_TestUniverse ( test_sixth_round , <EOL> black_score = gm . universe . KILLPOINTS , white_score = gm . universe . KILLPOINTS ) , gm . universe ) <EOL> def test_malicous_player ( self ) : <EOL> class MaliciousPlayer ( AbstractPlayer ) : <EOL> def _get_move ( self , universe , game_state ) : <EOL> universe . teams [ <NUM_LIT:0> ] . score = <NUM_LIT:100> <EOL> universe . bots [ <NUM_LIT:0> ] . current_pos = ( <NUM_LIT:2> , <NUM_LIT:2> ) <EOL> universe . maze [ <NUM_LIT:0> , <NUM_LIT:0> ] = False <EOL> return { "<STR_LIT>" : ( <NUM_LIT:0> , <NUM_LIT:0> ) } <EOL> def get_move ( self ) : <EOL> pass <EOL> test_layout = ( <EOL> """<STR_LIT>""" ) <EOL> test_self = self <EOL> original_universe = None <EOL> class TestMaliciousPlayer ( AbstractPlayer ) : <EOL> def get_move ( self ) : <EOL> test_self . assertIsNotNone ( original_universe ) <EOL> print ( id ( original_universe . maze ) ) <EOL> print ( id ( gm . universe . maze ) ) <EOL> test_self . assertNotEqual ( original_universe , gm . universe ) <EOL> return ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> teams = [ <EOL> SimpleTeam ( MaliciousPlayer ( ) ) , <EOL> SimpleTeam ( TestMaliciousPlayer ( ) ) <EOL> ] <EOL> gm = GameMaster ( test_layout , teams , <NUM_LIT:2> , <NUM_LIT:200> ) <EOL> original_universe = gm . universe . copy ( ) <EOL> gm . set_initial ( ) <EOL> gm . play_round ( ) <EOL> test_self . assertNotEqual ( original_universe , gm . universe ) <EOL> def test_failing_player ( self ) : <EOL> class FailingPlayer ( AbstractPlayer ) : <EOL> def get_move ( self ) : <EOL> return <NUM_LIT:1> <EOL> test_layout = ( <EOL> """<STR_LIT>""" ) <EOL> teams = [ SimpleTeam ( FailingPlayer ( ) ) , SimpleTeam ( TestPlayer ( "<STR_LIT>" ) ) ] <EOL> gm = GameMaster ( test_layout , teams , <NUM_LIT:2> , <NUM_LIT:1> ) <EOL> gm . play ( ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , [ <NUM_LIT:1> , <NUM_LIT:0> ] ) <EOL> def test_viewer_may_change_gm ( self ) : <EOL> class MeanViewer ( AbstractViewer ) : <EOL> def set_initial ( self , universe ) : <EOL> universe . teams [ <NUM_LIT:1> ] . score = <NUM_LIT:50> <EOL> def observe ( self , universe , game_state ) : <EOL> universe . teams [ <NUM_LIT:0> ] . score = <NUM_LIT:100> <EOL> universe . bots [ <NUM_LIT:0> ] . current_pos = ( <NUM_LIT:4> , <NUM_LIT:2> ) <EOL> universe . maze [ <NUM_LIT:0> , <NUM_LIT:0> ] = False <EOL> game_state [ "<STR_LIT>" ] = <NUM_LIT:0> <EOL> test_start = ( <EOL> """<STR_LIT>""" ) <EOL> number_bots = <NUM_LIT:2> <EOL> teams = [ <EOL> SimpleTeam ( TestPlayer ( [ ( <NUM_LIT:0> , <NUM_LIT:0> ) ] ) ) , <EOL> SimpleTeam ( TestPlayer ( [ ( <NUM_LIT:0> , <NUM_LIT:0> ) ] ) ) <EOL> ] <EOL> gm = GameMaster ( test_start , teams , number_bots , <NUM_LIT:200> ) <EOL> original_universe = gm . universe . copy ( ) <EOL> test_self = self <EOL> class TestViewer ( AbstractViewer ) : <EOL> def observe ( self , universe , game_state ) : <EOL> test_self . assertNotEqual ( original_universe , gm . universe ) <EOL> gm . register_viewer ( MeanViewer ( ) ) <EOL> gm . register_viewer ( TestViewer ( ) ) <EOL> gm . set_initial ( ) <EOL> gm . play_round ( ) <EOL> self . assertNotEqual ( original_universe , gm . universe ) <EOL> def test_win_on_timeout_team_0 ( self ) : <EOL> test_start = ( <EOL> """<STR_LIT>""" ) <EOL> NUM_ROUNDS = <NUM_LIT:2> <EOL> teams = [ <EOL> SimpleTeam ( TestPlayer ( '<STR_LIT>' ) ) , <EOL> SimpleTeam ( StoppingPlayer ( ) ) <EOL> ] <EOL> gm = GameMaster ( test_start , teams , <NUM_LIT:2> , game_time = NUM_ROUNDS ) <EOL> class TestViewer ( AbstractViewer ) : <EOL> def __init__ ( self ) : <EOL> self . cache = list ( ) <EOL> def observe ( self , universe , game_state ) : <EOL> self . cache . append ( game_state ) <EOL> tv = TestViewer ( ) <EOL> gm . register_viewer ( tv ) <EOL> gm . set_initial ( ) <EOL> gm . play ( ) <EOL> self . assertTrue ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] is not None ) <EOL> self . assertEqual ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] , <NUM_LIT:0> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , NUM_ROUNDS ) <EOL> def test_win_on_timeout_team_1 ( self ) : <EOL> test_start = ( <EOL> """<STR_LIT>""" ) <EOL> NUM_ROUNDS = <NUM_LIT:2> <EOL> teams = [ <EOL> SimpleTeam ( StoppingPlayer ( ) ) , <EOL> SimpleTeam ( TestPlayer ( '<STR_LIT>' ) ) <EOL> ] <EOL> gm = GameMaster ( test_start , teams , <NUM_LIT:2> , game_time = NUM_ROUNDS ) <EOL> class TestViewer ( AbstractViewer ) : <EOL> def __init__ ( self ) : <EOL> self . cache = list ( ) <EOL> def observe ( self , universe , game_state ) : <EOL> self . cache . append ( game_state ) <EOL> tv = TestViewer ( ) <EOL> gm . register_viewer ( tv ) <EOL> gm . set_initial ( ) <EOL> gm . play ( ) <EOL> self . assertTrue ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] is not None ) <EOL> self . assertEqual ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , NUM_ROUNDS ) <EOL> def test_draw_on_timeout ( self ) : <EOL> test_start = ( <EOL> """<STR_LIT>""" ) <EOL> NUM_ROUNDS = <NUM_LIT:1> <EOL> teams = [ SimpleTeam ( StoppingPlayer ( ) ) , SimpleTeam ( StoppingPlayer ( ) ) ] <EOL> gm = GameMaster ( test_start , teams , <NUM_LIT:2> , game_time = NUM_ROUNDS ) <EOL> class TestViewer ( AbstractViewer ) : <EOL> def __init__ ( self ) : <EOL> self . cache = list ( ) <EOL> def observe ( self , universe , game_state ) : <EOL> self . cache . append ( game_state ) <EOL> tv = TestViewer ( ) <EOL> gm . register_viewer ( tv ) <EOL> gm . set_initial ( ) <EOL> gm . play ( ) <EOL> self . assertTrue ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , NUM_ROUNDS ) <EOL> def test_win_on_eating_all ( self ) : <EOL> test_start = ( <EOL> """<STR_LIT>""" <EOL> ) <EOL> teams = [ <EOL> SimpleTeam ( StoppingPlayer ( ) ) , <EOL> SimpleTeam ( TestPlayer ( '<STR_LIT>' ) ) <EOL> ] <EOL> gm = GameMaster ( test_start , teams , <NUM_LIT:2> , <NUM_LIT:100> ) <EOL> class TestViewer ( AbstractViewer ) : <EOL> def __init__ ( self ) : <EOL> self . cache = list ( ) <EOL> def observe ( self , universe , game_state ) : <EOL> self . cache . append ( game_state ) <EOL> tv = TestViewer ( ) <EOL> gm . register_viewer ( tv ) <EOL> gm . set_initial ( ) <EOL> gm . play ( ) <EOL> self . assertTrue ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] is not None ) <EOL> self . assertEqual ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> def test_lose_on_eating_all ( self ) : <EOL> test_start = ( <EOL> """<STR_LIT>""" <EOL> ) <EOL> teams = [ <EOL> SimpleTeam ( StoppingPlayer ( ) ) , <EOL> SimpleTeam ( TestPlayer ( '<STR_LIT>' ) ) <EOL> ] <EOL> gm = GameMaster ( test_start , teams , <NUM_LIT:2> , <NUM_LIT:100> ) <EOL> gm . universe . teams [ <NUM_LIT:0> ] . score = <NUM_LIT:2> <EOL> class TestViewer ( AbstractViewer ) : <EOL> def __init__ ( self ) : <EOL> self . cache = list ( ) <EOL> def observe ( self , universe , game_state ) : <EOL> self . cache . append ( game_state ) <EOL> tv = TestViewer ( ) <EOL> gm . register_viewer ( tv ) <EOL> gm . set_initial ( ) <EOL> gm . play ( ) <EOL> self . assertEqual ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( gm . universe . teams [ <NUM_LIT:0> ] . score , <NUM_LIT:2> ) <EOL> self . assertEqual ( gm . universe . teams [ <NUM_LIT:1> ] . score , <NUM_LIT:1> ) <EOL> self . assertTrue ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] is not None ) <EOL> self . assertEqual ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] , <NUM_LIT:0> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> def test_lose_5_timeouts ( self ) : <EOL> test_start = ( <EOL> """<STR_LIT>""" <EOL> ) <EOL> class TimeOutPlayer ( AbstractPlayer ) : <EOL> def get_move ( self ) : <EOL> raise PlayerTimeout <EOL> teams = [ <EOL> SimpleTeam ( TimeOutPlayer ( ) ) , <EOL> SimpleTeam ( StoppingPlayer ( ) ) <EOL> ] <EOL> gm = GameMaster ( test_start , teams , <NUM_LIT:2> , <NUM_LIT:100> , max_timeouts = <NUM_LIT:5> ) <EOL> class TestViewer ( AbstractViewer ) : <EOL> def __init__ ( self ) : <EOL> self . cache = list ( ) <EOL> def observe ( self , universe , game_state ) : <EOL> self . cache . append ( game_state ) <EOL> tv = TestViewer ( ) <EOL> gm . register_viewer ( tv ) <EOL> gm . set_initial ( ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:0> ] . current_pos , ( <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> gm . play ( ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:5> ) <EOL> self . assertEqual ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] , gm . game_state [ "<STR_LIT>" ] - <NUM_LIT:1> ) <EOL> self . assertEqual ( gm . universe . teams [ <NUM_LIT:0> ] . score , <NUM_LIT:0> ) <EOL> self . assertEqual ( gm . universe . teams [ <NUM_LIT:1> ] . score , <NUM_LIT:0> ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:0> ] . current_pos , ( <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> self . assertTrue ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] is not None ) <EOL> self . assertEqual ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> def test_must_not_move_after_last_timeout ( self ) : <EOL> test_start = ( <EOL> """<STR_LIT>""" <EOL> ) <EOL> class TimeOutPlayer ( AbstractPlayer ) : <EOL> def get_move ( self ) : <EOL> raise PlayerTimeout <EOL> class CheckTestPlayer ( AbstractPlayer ) : <EOL> def get_move ( self ) : <EOL> raise RuntimeError ( "<STR_LIT>" ) <EOL> teams = [ <EOL> SimpleTeam ( TimeOutPlayer ( ) ) , <EOL> SimpleTeam ( CheckTestPlayer ( ) ) <EOL> ] <EOL> gm = GameMaster ( test_start , teams , <NUM_LIT:2> , <NUM_LIT:100> , max_timeouts = <NUM_LIT:1> ) <EOL> class TestViewer ( AbstractViewer ) : <EOL> def __init__ ( self ) : <EOL> self . cache = list ( ) <EOL> def observe ( self , universe , game_state ) : <EOL> self . cache . append ( game_state ) <EOL> tv = TestViewer ( ) <EOL> gm . register_viewer ( tv ) <EOL> gm . set_initial ( ) <EOL> gm . play ( ) <EOL> print ( gm . universe . pretty ) <EOL> print ( gm . game_state ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] , gm . game_state [ "<STR_LIT>" ] - <NUM_LIT:1> ) <EOL> self . assertEqual ( gm . universe . teams [ <NUM_LIT:0> ] . score , <NUM_LIT:0> ) <EOL> self . assertEqual ( gm . universe . teams [ <NUM_LIT:1> ] . score , <NUM_LIT:0> ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:0> ] . current_pos , ( <NUM_LIT:2> , <NUM_LIT:1> ) ) <EOL> self . assertTrue ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] is not None ) <EOL> self . assertEqual ( tv . cache [ - <NUM_LIT:1> ] [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:0> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:0> ) <EOL> def test_play_step ( self ) : <EOL> test_start = ( <EOL> """<STR_LIT>""" ) <EOL> number_bots = <NUM_LIT:2> <EOL> teams = [ <EOL> SimpleTeam ( TestPlayer ( '<STR_LIT>' ) ) , <EOL> SimpleTeam ( TestPlayer ( '<STR_LIT>' ) ) <EOL> ] <EOL> gm = GameMaster ( test_start , teams , number_bots , <NUM_LIT:4> ) <EOL> gm . set_initial ( ) <EOL> gm . play_round ( ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:0> ] . current_pos , ( <NUM_LIT:3> , <NUM_LIT:1> ) ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:1> ] . current_pos , ( <NUM_LIT:4> , <NUM_LIT:2> ) ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:0> ) <EOL> self . assertTrue ( gm . game_state [ "<STR_LIT>" ] is None ) <EOL> self . assertFalse ( gm . game_state [ "<STR_LIT>" ] ) <EOL> gm . play_step ( ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:0> ] . current_pos , ( <NUM_LIT:4> , <NUM_LIT:1> ) ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:1> ] . current_pos , ( <NUM_LIT:4> , <NUM_LIT:2> ) ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:0> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , False ) <EOL> gm . play_step ( ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:0> ] . current_pos , ( <NUM_LIT:4> , <NUM_LIT:1> ) ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:1> ] . current_pos , ( <NUM_LIT:3> , <NUM_LIT:2> ) ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , False ) <EOL> gm . play_step ( ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:0> ] . current_pos , ( <NUM_LIT:5> , <NUM_LIT:1> ) ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:1> ] . current_pos , ( <NUM_LIT:3> , <NUM_LIT:2> ) ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:2> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:0> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , False ) <EOL> gm . play_step ( ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:0> ] . current_pos , ( <NUM_LIT:5> , <NUM_LIT:1> ) ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:1> ] . current_pos , ( <NUM_LIT:2> , <NUM_LIT:2> ) ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:2> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , False ) <EOL> gm . play_round ( ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:0> ] . current_pos , ( <NUM_LIT:5> , <NUM_LIT:1> ) ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:1> ] . current_pos , ( <NUM_LIT:2> , <NUM_LIT:2> ) ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:2> ) <EOL> self . assertTrue ( gm . game_state [ "<STR_LIT>" ] is None ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , False ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , None ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , None ) <EOL> gm . play_round ( ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:0> ] . current_pos , ( <NUM_LIT:6> , <NUM_LIT:1> ) ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:1> ] . current_pos , ( <NUM_LIT:1> , <NUM_LIT:2> ) ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:3> ) <EOL> self . assertTrue ( gm . game_state [ "<STR_LIT>" ] is None ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , True ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , None ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , True ) <EOL> gm . play_round ( ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:0> ] . current_pos , ( <NUM_LIT:6> , <NUM_LIT:1> ) ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:1> ] . current_pos , ( <NUM_LIT:1> , <NUM_LIT:2> ) ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:3> ) <EOL> self . assertTrue ( gm . game_state [ "<STR_LIT>" ] is None ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , True ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , None ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , True ) <EOL> gm . play_round ( ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:0> ] . current_pos , ( <NUM_LIT:6> , <NUM_LIT:1> ) ) <EOL> self . assertEqual ( gm . universe . bots [ <NUM_LIT:1> ] . current_pos , ( <NUM_LIT:1> , <NUM_LIT:2> ) ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , <NUM_LIT:3> ) <EOL> self . assertTrue ( gm . game_state [ "<STR_LIT>" ] is None ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , True ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , None ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , True ) <EOL> def test_kill_count ( self ) : <EOL> test_start = ( <EOL> """<STR_LIT>""" ) <EOL> NUM_ROUNDS = <NUM_LIT:5> <EOL> teams = [ <EOL> SimpleTeam ( TestPlayer ( '<STR_LIT>' ) ) , <EOL> SimpleTeam ( TestPlayer ( '<STR_LIT>' ) ) <EOL> ] <EOL> gm = GameMaster ( test_start , teams , <NUM_LIT:2> , game_time = NUM_ROUNDS ) <EOL> gm . set_initial ( ) <EOL> gm . play_round ( ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , [ <NUM_LIT:0> , <NUM_LIT:0> ] ) <EOL> gm . play_round ( ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , [ <NUM_LIT:0> , <NUM_LIT:1> ] ) <EOL> gm . play_round ( ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , [ <NUM_LIT:0> , <NUM_LIT:1> ] ) <EOL> gm . play_round ( ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , [ <NUM_LIT:0> , <NUM_LIT:2> ] ) <EOL> gm . play_round ( ) <EOL> self . assertEqual ( gm . game_state [ "<STR_LIT>" ] , [ <NUM_LIT:1> , <NUM_LIT:2> ] ) </s>
