Esempio n. 1
0
def do_it(): 
    (g, occupied_status) = getGraph() 
    while True:
        if validate_board(g):
            break
        else:
            (g, occupied_status) = getGraph()
    print "Got a valid board. Player 1, place your archers now!"
    (g1, new_occupied_status) = getGraph()
    for k, v in new_occupied_status.iteritems():
        if v:
            print "Adding player 1 archer at "+k
            player1.pieces.append(Archer(k))
    occupied_status_after_p1_archers = new_occupied_status
    print "Yay archers!. Player 2, place your archers please"
    new_occupied_status = get_until_only_added(occupied_status_after_p1_archers)
    for k, v in new_occupied_status.iteritems():
        if v and not occupied_status_after_p1_archers[k]:
            print "Adding player 2 archer at "+k
            player2.pieces.append(Archer(k))
    occupied_status_after_p2_archers = new_occupied_status
    print "Yay more archers!. Player 1, place your pikemen!"
    new_new_occupied_status = get_until_only_added(occupied_status_after_p2_archers)
    for k, v in new_new_occupied_status.iteritems():
        if v and not occupied_status_after_p2_archers[k]:
            player1.pieces.append(Pikeman(k))
    occupied_status_after_p1_pikes = new_new_occupied_status
    print "Yay pikemen!. Player 2, place your pokemon!"
    new_new_new_occupied_status = get_until_only_added(occupied_status_after_p1_pikes)
    for k, v in new_new_new_occupied_status.iteritems():
        if v and not occupied_status_after_p1_pikes[k]:
            player2.pieces.append(Pikeman[k])
Esempio n. 2
0
def do_it():
    (g, occupied_status) = getGraph()
    while True:
        if validate_board(g):
            break
        else:
            (g, occupied_status) = getGraph()
    print "Got a valid board. Player 1, place your archers now!"
    (g1, new_occupied_status) = getGraph()
    for k, v in new_occupied_status.iteritems():
        if v:
            print "Adding player 1 archer at " + k
            player1.pieces.append(Archer(k))
    occupied_status_after_p1_archers = new_occupied_status
    print "Yay archers!. Player 2, place your archers please"
    new_occupied_status = get_until_only_added(
        occupied_status_after_p1_archers)
    for k, v in new_occupied_status.iteritems():
        if v and not occupied_status_after_p1_archers[k]:
            print "Adding player 2 archer at " + k
            player2.pieces.append(Archer(k))
    occupied_status_after_p2_archers = new_occupied_status
    print "Yay more archers!. Player 1, place your pikemen!"
    new_new_occupied_status = get_until_only_added(
        occupied_status_after_p2_archers)
    for k, v in new_new_occupied_status.iteritems():
        if v and not occupied_status_after_p2_archers[k]:
            player1.pieces.append(Pikeman(k))
    occupied_status_after_p1_pikes = new_new_occupied_status
    print "Yay pikemen!. Player 2, place your pokemon!"
    new_new_new_occupied_status = get_until_only_added(
        occupied_status_after_p1_pikes)
    for k, v in new_new_new_occupied_status.iteritems():
        if v and not occupied_status_after_p1_pikes[k]:
            player2.pieces.append(Pikeman[k])
Esempio n. 3
0
def get_until_only_added(status_map):
    (g, new_status_map) = getGraph()
    for k, v in new_status_map.iteritems():
        if v and not status_map[k]:
            print "Don't move the pieces yet!"
            get_until_only_added(status_map)

    return new_status_map
Esempio n. 4
0
def get_until_only_added(status_map):
    (g, new_status_map) = getGraph()
    for k, v in new_status_map.iteritems():
        if v and not status_map[k]:
            print "Don't move the pieces yet!"
            get_until_only_added(status_map)

    return new_status_map