Beispiel #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()
Beispiel #2
0
    Player,
    Pawn,
    Rook,
    Knight,
    King,
    Bishop,
    Queen,
    Renderer,
    TraditionalStrategy,
)

board = Board(8)

p1 = Player('Chris')
p1.color = curses.COLOR_RED
board.add_player(p1)
p1.setup(TraditionalStrategy)

p2 = Player('Jess')
p2.color = curses.COLOR_BLUE
board.add_player(p2)
p2.setup(TraditionalStrategy)


def main(stdscr):
    stdscr.clear()
    curses.noecho()
    curses.cbreak()
    stdscr.keypad(True)

    renderer = Renderer(stdscr)
Beispiel #3
0
    def add_player(self, player, role):
        Board.add_player(self, player, role)

        self.positions[(player.x, player.y)] = player
Beispiel #4
0
    def add_player(self, player, role):
        Board.add_player(self, player, role)

        self.positions[(player.x, player.y)] = player