コード例 #1
0
 def test_pass_action_is_legal(self):
     state = DominoState( 1,{
         'tiles_by_player':[
             [{0}, {1, 2}, {1, 5}, {5, 6}, {4, 6}, {2,3}], 
             [{5}, {2, 5}, {0, 5}, {1, 3}, {2, 4}, {2}, {3, 5}], 
             [{4}, {3}, {4, 5}, {0, 1}, {0, 6}, {1, 6}, {0, 2}], 
             [{3, 4}, {0, 3}, {2, 6}, {1, 4}, {0, 4}, {3, 6}, {1}]
             ],
         'suits_at_ends':{6}
     })
     action = DominoAction(1, {-1}, None)
     self.assertTrue(state._is_action_legal(action))
コード例 #2
0
 def test_action_is_ilegal_not_current_player(self):
     state = DominoState( 1,{
         'tiles_by_player':[
             [{0}, {1, 2}, {1, 5}, {5, 6}, {4, 6}, {6}], 
             [{5}, {2, 5}, {0, 5}, {1, 3}, {2, 4}, {2}, {3, 5}], 
             [{4}, {3}, {4, 5}, {0, 1}, {0, 6}, {1, 6}, {0, 2}], 
             [{3, 4}, {0, 3}, {2, 6}, {1, 4}, {0, 4}, {3, 6}, {1}]
             ],
         'suits_at_ends':{2,3}
     })
     action = DominoAction(0, {1,2},2)
     self.assertFalse(state._is_action_legal(action))