Example #1
0
# Простая игра
# Демонстрирует импорт модулей

import games
import random

print("Добро пожаловать в самую-самую простую игру!\n")

again = None
while again != "n":
    players = []
    num = games.ask_number(question="Сколько игроков участвует? (2 - 5):",
                           low=2,
                           high=5)
    for i in range(num):
        name = input("Имя игрока: ")
        score = random.randrange(100) + 1
        player = games.Player(name, score)
        players.append(player)

    print("Вот результат игры: ")
    for player in players:
        print(player)

    again = games.ask_yes_no("\nХотите сыграть еще раз? (y/n): ")

input("\n\nНажмите Enter, чтобы выйти.")
Example #2
0
# JoshBothell
# 2/19
import games, random, cards

deck = cards.Deck()
deck.populate()
deck.shuffle()

print("Welcome to the simple high card game!")

again = None
while again != "n":
    players = list([])
    print("How many players?")
    num = games.ask_num(2, 11)
    for i in range(num):
        name = input("Player name: ")
        player = games.Player(name)
        players.append(player)
    hands = list([])
    for player in players:
        hand = player.hand
        hands.append(hand)
    deck.deal(hands, 1)
    print("Here are the results: ")
    for player in players:
        print(player)
    again = games.yes_no("Do you want to play again? (y/n): ")
input("Press enter to exit.")