Exemple #1
0
def AI_skip(board, player, target):
    """
    Card function that handles when the AI player plays a skip turn card.

    O(1) runtime
    """
    print("Targeted player skipping: ", target.name)
    target.skip = True
    # update targets hatval of player
    game_logic.update_hatval(player, target, 1)
Exemple #2
0
def AI_draw_2(deck, player, target):
    """
    Card function that handles when the AI player plays a draw 2 card.

    O(1) runtime
    """
    print("Targeted player: ", target.name)
    print("Trageted players hand size before: ", len(target.hand))
    target.grab_cards(deck, 2)
    print("Trageted players hand size after: ", len(target.hand))
    # update targets hatval of player
    game_logic.update_hatval(player, target, 2)
Exemple #3
0
def AI_wild_pick_4(board, deck, player, target, selected_color):
    """
    Card function that handles when the AI player plays a wild pick 4 card.

    O(1) runtime
    """
    board.color = selected_color
    print("New color: ", board.color)
    print("Targeted player: ", target.name)
    print("Trageted players hand size before: ", len(target.hand))
    target.grab_cards(deck, 4)  # O(4)
    print("Trageted players hand size after: ", len(target.hand))
    # update targets hatval of player
    game_logic.update_hatval(player, target, 4)
Exemple #4
0
def skip(board, deck, player, players):
    """
    Card function that handles when the player plays a skip turn card.

    This makes the game move to the target selection menu. After a target is
    selected the targeted player is then forced skip their next turn.

    O(n) runtime
    """
    players_temp = players[:]
    players_temp.remove(player)
    target = game_control.player_choice_target(players_temp)  # O(n)
    print("Targeted player skipping: ", target.name)
    target.skip = True
    # update targets hatval of player
    game_logic.update_hatval(player, target, 1)
Exemple #5
0
def draw_2(board, deck, player, players):
    """
    Card function that handles when the player plays a draw 2 card.

    This makes the game move to the target selection menu. After a target is
    selected the targeted player is then forced to draw 2 cards.

    O(n) runtime
    """
    players_temp = players[:]
    players_temp.remove(player)
    target = game_control.player_choice_target(players_temp)   # O(n)
    print("Targeted player: ", target.name)
    print("Trageted players hand size before: ", len(target.hand))
    target.grab_cards(deck, 2)
    print("Trageted players hand size after: ", len(target.hand))
    # update targets hatval of player
    game_logic.update_hatval(player, target, 2)
Exemple #6
0
def wild_pick_4(board, deck, player, players):
    """
    Card function that handles when the player plays a wild pick 4 card.

    Starts subfunctions that handel player color choice, and player target
    choice. This function then prints out the results of the players decisions
    on the game.

    O(n) runtime
    """
    board.color = game_control.player_choice_color()  # O(1)
    print("New color: ", board.color)
    players_temp = players[:]  # O(n)
    players_temp.remove(player)  # O(n)
    target = game_control.player_choice_target(players_temp)  # O(n)
    print("Targeted player: ", target.name)
    print("Trageted players hand size before: ", len(target.hand))
    target.grab_cards(deck, 4)
    print("Trageted players hand size after: ", len(target.hand))
    # update targets hatval of player
    game_logic.update_hatval(player, target, 4)