def main():
    print("\t\tWitaj w grze 'Blackjack'!\n")
    
    names = []
    number = gry.ask_number("Podaj liczbę graczy (1 - 7): ", low = 1, high = 8)
    for i in range(number):
        name = input("Wprowadź nazwę " + str(i+1) + ". gracza: ")
        while not name:
            print("błąd, nie wpowadzono nazwy gracza")
            name = input("Wprowadź nazwę " + str(i+1) + ". gracza: ")
        names.append(name)
    print()
        
    game = BJ_Game(names)

    # because low money mean that players can be kick from game, main function was rebuilt too (exercise 3)
    game.play()

    again = None
    while again != "n":
        # checking if there are any players left (exercise 3)
        if game.get_players():
            again = gry.ask_yes_no("\nCzy chcesz zagrać ponownie? (T/N): ")
            # new method to fill cards amount if needed (exercise 1)
            game.fill_cards()
            game.play()
        else:
            print("\nWszyscy gracze odpadli. " )
            again = "n"
Beispiel #2
0
    def menu(self, player):
        forest = Forest(player)
        desert = Desert(player)
        mountains = Mountains(player)

        finish = gry.ask_yes_no(
            "Would you like to finish the game? (t for Yes / n for No)")
        decision = ""
        while finish != "t":
            while decision not in ("desert", "forest", "mountains"):
                decision = input(
                    "Where would you like to go? (desert / forest / mountains)"
                )
            choice = ""
            while choice != "back":
                choice = ""
                if decision == "desert":
                    choice = desert.choice()
                    if choice == "oaza":
                        choice = desert.oaza()
                    elif choice == "piramid":
                        choice = desert.piramid()
                    elif choice == "tomb":
                        choice = desert.tomb()
                    decision == ""
                elif decision == "forest":
                    choice = forest.choice()
                    if choice == "cabine":
                        choice = forest.cabine()
                    elif choice == "cave":
                        choice = forest.cave()
                    elif choice == "lake":
                        choice = forest.lake()
                    decision == ""
                elif decision == "mountains":
                    choice = mountains.choice()
                    if choice == "cliff":
                        mountains.cliff()
                    elif choice == "peak":
                        mountains.peak()
                    elif choice == "lake":
                        mountains.lake()
                    decision == ""
                decision = ""
            finish = gry.ask_yes_no(
                "Would you like to finish the game? (t for Yes / n for No)")
Beispiel #3
0
def main():
    print("Witaj w grze blackjack")
    names = []
    number = gry.ask_number("Podaj liczbę graczy (1 - 7): ", low=1, high=8)
    for i in range(number):
        name = input("Wprowadź nazwę gracza: ")
        names.append(name)
    print()
    game = BJ_Game(names)
    again = None
    while again != "n":
        game.play()
        again = gry.ask_yes_no("\nCzy chcesz zagrać ponownie?: ")
Beispiel #4
0
    def piramid(self):
        print("Another graveyard, let's better go outside.")
        yesno = gry.ask_yes_no(
            "Would you like to check different places in the desert or step back? \
(t for Yes / n for No)")
        choice = ""
        if yesno == "t":
            choice = input("Where do you want to go (oaza / tomb)").lower()
            while choice not in ("oaza", "tomb"):
                choice = input("Where do you want to go (oaza / tomb)").lower()
            return choice
        else:
            choice = "back"
            return choice
Beispiel #5
0
    def cabine(self):
        print("It is dark and scary place. Something bad happened here...")
        yesno = gry.ask_yes_no(
            "Would you like to check different places in the forest or step back? \
(t for Yes / n for No)")
        choice = ""
        if yesno == "t":
            choice = input("Where do you want to go (cave / lake)").lower()
            while choice not in ("cave", "lake"):
                choice = input("Where do you want to go (cave / lake)").lower()
            return choice
        else:
            choice = "back"
            return choice
def main():
    names = []
    number = gry.ask_number("Podaj liczbe graczy (1 - 7)", 1, 8)
    for i in range(number):
        name = input("Podaj imie gracza")
        names.append(name)
    print()

    game = BJ_Game(names)

    again = None
    while again != "n":
        game.play()
        again = gry.ask_yes_no("\nCzy chcesz zagrac ponownie? (T/N): ")
Beispiel #7
0
    def oaza(self):
        print("Finally you can rest, drink water and eat fruity fruit")
        yesno = gry.ask_yes_no(
            "Would you like to check different places in the desert or step back? \
(t for Yes / n for No)")
        choice = ""
        if yesno == "t":
            choice = input("Where do you want to go (tomb / piramid)").lower()
            while choice not in ("tomb", "piramid"):
                choice = input(
                    "Where do you want to go (tomb / piramid)").lower()
            return choice
        else:
            choice = "back"
            return choice
Beispiel #8
0
def main():
    print("Welcome in to the War game")
    names = []
    number = gry.ask_number("How many players (1 - 10: ", low=1, high=10)
    for i in range(number):
        name = input("Name of the player: ")
        names.append(name)

    game = Game(names)

    again = None
    while again != "n":
        game.play()
        again = gry.ask_yes_no(
            "\Do you wanna play again? Type 't' for yes or 'n' for no.")
Beispiel #9
0
    def tomb(self):
        print("Someone died in here...")
        yesno = gry.ask_yes_no(
            "Would you like to check different places in the desert or step back? \
(t for Yes / n for No)")
        choice = ""
        if yesno == "t":
            choice = input("Where do you want to go (oaza / piramid)").lower()
            while choice not in ("oaza", "piramid"):
                choice = input(
                    "Where do you want to go (oaza / piramid)").lower()
            return choice
        else:
            choice = "back"
            return choice
Beispiel #10
0
    def cave(self):
        print("There are a lot of rats and spiders in here...")
        yesno = gry.ask_yes_no(
            "Would you like to check different places in the forest or step back? \
(t for Yes / n for No)")
        choice = ""
        if yesno == "t":
            choice = input("Where do you want to go (cabine / lake)").lower()
            while choice not in ("cabine", "lake"):
                choice = input(
                    "Where do you want to go (cabine / lake)").lower()
            return choice
        else:
            choice = "back"
            return choice
Beispiel #11
0
    def lake(self):
        print("You can notice few dead fishes in the dirty water...")
        yesno = gry.ask_yes_no(
            "Would you like to check different places in the forest or step back? \
(t for Yes / n for No)")
        choice = ""
        if yesno == "t":
            choice = input("Where do you want to go (cave / cabine)").lower()
            while choice not in ("cave", "lake"):
                choice = input(
                    "Where do you want to go (cave / cabine)").lower()
            return choice
        else:
            choice = "back"
            return choice
Beispiel #12
0
    def cliff(self):
        print(
            "Watch out, if you would fall down here, our mission would be finished."
        )
        yesno = gry.ask_yes_no(
            "Would you like to check different places in the mountains or step back? \
(t for Yes / n for No)")
        choice = ""
        if yesno == "t":
            choice = input("Where do you want to go (peak / lake)").lower()
            while choice not in ("cave", "lake"):
                choice = input("Where do you want to go (peak / lake)").lower()
            return choice
        else:
            choice = "back"
            return choice
Beispiel #13
0
def main():
    print("\t Witaj w grze Black Jack! \n")

    names = []
    numbers = gry.ask_number("podaj liczbe graczy od 1 do 7 :", low=1, high=8)
    for i in range(numbers):
        name = input("Podaj imie gracza: ")
        names.append(name)
    print()

    game = BJ_Game(names)
    again = None

    while again != "n":
        game.play()
        again = gry.ask_yes_no("\n Czy chcesz zagrac ponownie?")
Beispiel #14
0
def main():
    print("\t\tWitaj w grze 'Blackjack'!\n")
    names = []
    number = gry.ask_number('Podaj liczbę graczy (1 - 7): ', low=1, high=8)

    for i in range(number):
        name = input('Wprowadź nazwę gracza: ')
        names.append(name)
    print()

    game = BJGame(names)

    again = None
    while again != 'n':
        game.play()
        again = gry.ask_yes_no('\nCzy chcesz zagrać ponownie?: ')
Beispiel #15
0
    def lake(self):
        print(
            "Clear and blue water reminds you your childhood and fishing with your grandpa."
        )
        yesno = gry.ask_yes_no(
            "Would you like to check different places in the mountains or step back? \
(t for Yes / n for No)")
        choice = ""
        if yesno == "t":
            choice = input("Where do you want to go (peak / cliff)").lower()
            while choice not in ("cave", "lake"):
                choice = input(
                    "Where do you want to go (peak / cliff)").lower()
            return choice
        else:
            choice = "back"
            return choice
Beispiel #16
0
    def peak(self):
        print(
            "The view is really nice, you can see the enviroment is very peacefull."
        )
        yesno = gry.ask_yes_no(
            "Would you like to check different places in the mountains or step back? \
(t for Yes / n for No)")
        choice = ""
        if yesno == "t":
            choice = input("Where do you want to go (lake / cliff)").lower()
            while choice not in ("cave", "lake"):
                choice = input(
                    "Where do you want to go (lake / cliff)").lower()
            return choice
        else:
            choice = "back"
            return choice
Beispiel #17
0
    def choice(self):
        print(
            "You entered big mountains.", self.name,
            "from the distance you can see really high peak, \
mountain lake and big cliff")
        yesno = gry.ask_yes_no(
            "Would you like to discover this place or step back? (t for Yes / n for No)"
        )
        choice = ""
        if yesno == "t":
            choice = input(
                "Where do you want to go (peak / lake / cliff)").lower()
            while choice not in ("peak / lake / cliff"):
                choice = input(
                    "Where do you want to go (peak / lake / cliff)").lower()
            return choice
        else:
            choice = "back"
            return choice
Beispiel #18
0
    def choice(self):
        print(
            "You entered mysterious Forest", self.name,
            "from the distance you can see small cabine, \
dark cave and dirty lake")
        yesno = gry.ask_yes_no(
            "Would you like to discover this place or step back? (t for Yes / n for No)"
        )
        choice = ""
        if yesno == "t":
            choice = input(
                "Where do you want to go (cabine / cave / lake)").lower()
            while choice not in ("cabine", "cave", "lake"):
                choice = input(
                    "Where do you want to go (cabine / cave / lake)").lower()
            return choice
        else:
            choice = "back"
            return choice
Beispiel #19
0
    def choice(self):
        print(
            "You entered big desert", self.name,
            "from the distance you can see Oaza, \
deadly tomb and large piramid")
        yesno = gry.ask_yes_no(
            "Would you like to discover this place or step back? (t for Yes / n for No)"
        )
        choice = ""
        if yesno == "t":
            choice = input(
                "Where do you want to go (oaza / tomb / piramid)").lower()
            while choice not in ("oaza", "tomb", "piramid"):
                choice = input(
                    "Where do you want to go (oaza / tomb / piramid)").lower()
            return choice
        else:
            choice = "back"
            return choice
def main():
    print("\t\tWitaj w grze 'Blackjack'!\n")
    
    names = []
    number = gry.ask_number("Podaj liczbę graczy (1 - 7): ", low = 1, high = 8)
    for i in range(number):
        name = input("Wprowadź nazwę " + str(i+1) + ". gracza: ")
        while not name:
            print("błąd, nie wpowadzono nazwy gracza")
            name = input("Wprowadź nazwę " + str(i+1) + ". gracza: ")
        names.append(name)
    print()
        
    game = BJ_Game(names)

    again = None
    while again != "n":
        game.play()
        again = gry.ask_yes_no("\nCzy chcesz zagrać ponownie? (T/N): ")

        # new method to fill cards amount if needed (exercise 1)
        game.fill_cards()
Beispiel #21
0
 def is_hitting(self):
     response = gry.ask_yes_no("\n" + self.name +
                               ", chcesz dobrać kartę? (T/N): ")
     return response == "t"
import random, gry

print("Witaj w najprostszej grze na swiecie")
again = None
while again != 'n':
    players = []
    num = gry.ask_number(question="Podaj liczbe graczy (2-5): ", low=2, high=5)

    for i in range(num):
        name = input('Wprowadz nazwe gracza:')
        score = random.randrange(100) + 1
        player = gry.Player(name, score)
        players.append(player)

    print('Oto wyniki gry:')
    for player in players:
        print(player)

    again = gry.ask_yes_no("\nCzy chcesz zagrać ponownie? (t/n): ")
input("\n\nAby zakończyć program, naciśnij klawisz Enter.")
# Prosta gra

import gry, random

print("Witam w najprostrzej grze na swiecie!\n")

ponownie = None
while ponownie != "n":
	gracze = []
	num = gry.ask_number(question = "Podaj liczbe graczy (2 - 5)", low = 2, high = 5)

	for i in range(num):
		name = input("Podaj nick ")
		score = random.randrange(100) + 1 
		player = gry.Player(name, score)
		gracze.append(player)

	print("\nOto wyniki gry: ")
	for player in gracze:
		print(player)
	ponownie = gry.ask_yes_no("\nCzy chcesz zagrać ponownie? (t/n): ")


input("\n\nAby zakończyć program, naciśnij klawisz Enter.")
Beispiel #24
0
 def bet(self):
     response = gry.ask_yes_no("\n" + self.name + ", czy chcesz obstawiac? (T/N): ")
     return response == "t"
Beispiel #25
0
 def is_hitting(self):
     response = gry.ask_yes_no('\n' + self.name +
                               ', chcesz dobrać kartę? (T/N): ')
     return response == 't'
Beispiel #26
0
 def is_hitting(self):
     response = gry.ask_yes_no("\n" + self.name +
                               ", chcesz dobrac karte? [t / n]")
     return response == "t"
Beispiel #27
0
 def is_hitting(self):
     response = gry.ask_yes_no("\n" + self.name +
                               " Chcesz dobrac kartę (t/n) ? ")
     return response == "t"