Esempio n. 1
0
def main():
    p1 = Player(name="John")
    p2 = Player(name="Hulio")
    b = Board()
    b.add_player(p1)
    b.add_player(p2)
    b.start()
    _pprint(filled_cells(b.state))
    raw_input()
    destruct_status = False
    prev_check = []
    state = b.state
    promotions = 0
    while state not in ("FIN", ):
    #    for player in (p1, p2):
    #    b.get_state(player)
        event = smart_event_factory(state, colors, destruct_status, prev_check)
        color = 'white' if 'w' == event["name"][0] else 'black'
        if check_the_turn(event, state) == False:
            continue
        else:
            print "VALID"
            if "promoted" in event.keys() and event["promoted"]:
                promotions +=1
            print "PROMOTED CHECKS: ", promotions
            state = check_the_game_state(state, event, colors)
            if event['cutDown'] and destruction_is_possible(event['finalPos'], filled_cells(state, color=colors[1]), filled_cells(state, color=colors[0]), event.get('promoted')):
                destruct_status = True
                prev_check = event['finalPos']
                print 'NEXT DESTRUCT'
                raw_input()
            else:
                colors.reverse()
                destruct_status = False
                prev_check = []
                print 'COLORS REVERSED!'
                print 'FILLED CELLS: ' , len((filled_cells(state)))
                raw_input()