Make other 3 players RandomAI

master
En Yi 2019-06-03 17:36:04 +01:00
parent 01be453b5c
commit 1488003232
1 changed files with 9 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import view
import random import random
import copy import copy
import time import time
import pprint
from signalslot import Signal from signalslot import Signal
from ai_comp import ai from ai_comp import ai
from enum import Enum from enum import Enum
@ -113,8 +114,10 @@ class Table:
spacing, vert_orientation=vert, spacing, vert_orientation=vert,
deck_reveal=cards.DeckReveal.HIDE_ALL)) deck_reveal=cards.DeckReveal.HIDE_ALL))
self.players[i].connect_to_table(self.table_status) self.players[i].connect_to_table(self.table_status)
if i>0:
self.players[i].add_ai(ai.RandomAI(self.table_status))
self.players[3].add_ai(ai.RandomAI(self.table_status))
playfield_margins = 10 playfield_margins = 10
margins_with_w_deck = w_deck + playfield_margins margins_with_w_deck = w_deck + playfield_margins
@ -192,6 +195,7 @@ class Table:
self.game_state = GameState.ENDING self.game_state = GameState.ENDING
else: else:
self.reset_game() self.reset_game()
self.current_round = 0
self.game_state = GameState.DEALING self.game_state = GameState.DEALING
def shuffle_and_deal(self): def shuffle_and_deal(self):
@ -280,7 +284,6 @@ class Table:
self.players[current_player].role = PlayerRole.ATTACKER self.players[current_player].role = PlayerRole.ATTACKER
print('Bidding Complete') print('Bidding Complete')
print(self.table_status)
def play_a_round(self): def play_a_round(self):
""" """
@ -479,7 +482,9 @@ class Player(cards.Deck):
# TODO: Make a more natural input parsing # TODO: Make a more natural input parsing
play = input("Please play a card. Enter suit number + card number\n" play = input("Please play a card. Enter suit number + card number\n"
"i.e 412 is Spade Queen, 108 is Clubs 8, 314 is Hearts Ace\n") "i.e 412 is Spade Queen, 108 is Clubs 8, 314 is Hearts Ace\n")
if play: if play == "v":
pprint.pprint(self._table_status)
else:
play = int(play) play = int(play)
if substate == 0: if substate == 0:
valid = self.check_for_valid_plays(play, True) valid = self.check_for_valid_plays(play, True)
@ -490,7 +495,7 @@ class Player(cards.Deck):
[_, pos] = self.check_card_in(play) [_, pos] = self.check_card_in(play)
return self.remove_card(pos) return self.remove_card(pos)
print("Invalid play") print("Invalid play")
def view_last_round(self): def view_last_round(self):
pass pass