def __init__(self, parent, *args, **kwargs):
        tk.Frame.__init__(self, parent, *args, **kwargs)
        self.parent = parent

        self.hand_frame_height = 315
        self.result_text = tk.StringVar()
        self.image_manager = ImageManager()
        self.result_label = tk.Label(self,
                                     font=('', 24),
                                     textvariable=self.result_text)
        self.dealer_hand_frame = HandFrame(self, bg='#f0f0f0', bd=10)
        self.player_hand_frame = HandFrame(self, bg='#f0f0f0', bd=10)
        self.hit_button = tk.Button(self,
                                    text='Hit',
                                    font=('', 16),
                                    command=self.hit_button_pressed)
        self.pass_button = tk.Button(self,
                                     text='Pass',
                                     font=('', 16),
                                     command=self.pass_button_pressed)
        self.play_button = tk.Button(self,
                                     text='Play',
                                     font=('', 20),
                                     command=self.play_button_pressed)
        self.parent = parent
        self.game = Game()
        self.resized_card_images = {}

        self.hidden_card = Card('', '', 'red_back', 0)
        self.add_card_image(self.hidden_card)

        self.play_button.place(rely=0.47, relx=0.46)
Beispiel #2
0
def main():
    app = QtWidgets.QApplication([])

    gameMessage = QtWidgets.QLabel('Welcome to Number Guess')

    guess = Guess(gameMessage)
    difficulty = Difficulty(gameMessage)
    previous_guesses = PreviousGuesses()

    highscores = Highscores(db, 'chris', difficulty)
    game = Game(guess, previous_guesses, highscores, difficulty, gameMessage)
    # username_window = UsernameWindow()
    # username_window.show()
    game_window = GameWindow(game, gameMessage)
    game_window.show()
    sys.exit(app.exec_())
Beispiel #3
0
    def __init__(self, parent, *args, **kwargs):
        tk.Frame.__init__(self, parent, *args, **kwargs)
        self.parent = parent
        self.games_amount = tk.IntVar(value=100)
        self.use_decision_table_value = tk.BooleanVar()
        self.dealer_threshold = tk.IntVar(value=17)
        self.player_threshold = tk.IntVar(value=17)
        self.result_percentage = tk.StringVar()
        self.decision_table_value = tk.BooleanVar()

        self.games_amount_label = tk.Label(
            self, text='Number of rounds to play (max 10000):', bg='#cccccc')
        self.games_amount_entry = tk.Entry(self,
                                           width=5,
                                           textvariable=self.games_amount)
        self.use_decision_table_checkbox = tk.Checkbutton(
            self,
            text='Use decision table for player',
            command=self.use_decision_table_checkbox_clicked,
            variable=self.use_decision_table_value,
            bg='#cccccc')
        self.dealer_threshold_label = tk.Label(
            self, text='Dealer\'s threshold for hitting:', bg='#cccccc')
        self.dealer_threshold_entry = tk.Entry(
            self, width=2, textvariable=self.dealer_threshold)
        self.player_threshold_label = tk.Label(
            self, text='Player\'s threshold for hitting:', bg='#cccccc')
        self.player_threshold_entry = tk.Entry(
            self, width=2, textvariable=self.player_threshold)
        self.simulation_button = tk.Button(
            self,
            text='Simulate',
            command=self.simulate_button_pressed,
            bg='#cccccc')
        self.log_text = tk.Text(self, height=10, width=32, cursor="arrow")
        self.log_scrollbar = tk.Scrollbar(self)
        self.result_percentage_label = tk.Label(
            self, textvariable=self.result_percentage, bg='#cccccc')
        self.decision_table_frame = DecisionTableFrame(self, bg='#cccccc')
        self.decision_table_aces_frame = DecisionTableAcesFrame(self,
                                                                bg='#cccccc')

        self.games_amount_label.grid(row=0,
                                     column=0,
                                     sticky='w',
                                     padx=2,
                                     pady=(6, 0))
        self.games_amount_entry.grid(row=0, column=1, sticky='w', padx=2)
        self.use_decision_table_checkbox.grid(row=1,
                                              column=0,
                                              sticky='w',
                                              padx=2)
        self.dealer_threshold_label.grid(row=2, column=0, sticky='w', padx=2)
        self.dealer_threshold_entry.grid(row=2, column=1, sticky='w', padx=2)
        self.player_threshold_label.grid(row=3, column=0, sticky='w', padx=2)
        self.player_threshold_entry.grid(row=3, column=1, sticky='w', padx=2)
        self.simulation_button.grid(row=5,
                                    column=0,
                                    sticky='s',
                                    padx=(50, 0),
                                    pady=(12, 0))
        self.log_text.grid(row=6, columnspan=2, column=0, sticky='nsw', padx=2)
        self.log_scrollbar.grid(row=6, column=2, sticky='nsw')
        self.log_scrollbar.config(command=self.log_text.yview)
        self.log_text.configure(yscrollcommand=self.log_scrollbar.set,
                                state='disabled')

        self.simulation_game = Game()
from Models.Game import Game

game = Game()
game.start()
Beispiel #5
0
os.environ['http_proxy'] = proxy
os.environ['HTTP_PROXY'] = proxy
os.environ['https_proxy'] = proxy
os.environ['HTTPS_PROXY'] = proxy

# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
                    level=logging.INFO)

max_len=4

logger = logging.getLogger(__name__)

SUGGEST_CARD, GENDER, PHOTO, LOCATION, BIO = range(5)

game = Game(-1001390724742)
conversation_handler = None

for i in range(0, 10):
    game.add_player(Player(i, "user " + str(i)))
game.add_player(Player(237713674, "mikaeel"))


def start(update, context):
    reply_keyboard = [['Boy', 'Girl', 'Other']]
    keyboard = [
        [InlineKeyboardButton("0", callback_data=str(0)),
         InlineKeyboardButton("4", callback_data=str(5)),
         InlineKeyboardButton("4", callback_data=str(0))]
    ]
    reply_markup = InlineKeyboardMarkup(keyboard)
Beispiel #6
0
 def setUp(self):
     self.game = Game()
     self.player = Player("Jake")
     self.deck = Deck()
     self.deck.populate()
Beispiel #7
0
import threading
import time

from Models.Game import Game
from Models.Player import Player

game = Game(0)
for i in range(0, 10):
    game.add_player(Player(i, "user " + str(i)))


def run_game():
    while len(game.players) > 2:
        print("number of players in this turn: " + str(len(game.players)))
        print("turn started, you can suggest cards")
        time.sleep(20)
        game.start_vote_time()
        print("vote time started, you can vote")
        time.sleep(20)
        print("turn ended")
        game.end_turn()
        game.start_new_turn()


th = threading.Thread(target=run_game)
th.start()

while True:
    print("you can perform query")
    query = input()
    if query.split()[0] == 'suggest_card':