Beispiel #1
0
def main():
    phrases = [
        "just do it", "python is fun", "cat in a hat", "cash is king",
        "love is patience"
    ]
    game = Game(phrases)
    game.start_game()
Beispiel #2
0
def init():
    try:
        game = Game(phrases=RANDOM_PHRASES)
        while len(game.phrases) > 0:
            game.initialize_game()
            print(f"PHRASES LEFT {len(game.phrases)}")
            game.start_game()
            play_again = input(
                "Would you like to play Again, Press Enter to play again, or enter 1 to quit:   "
            )
            if play_again.lower() == '1':
                break
        print("Thanks for Playing! Please come again soon!")
    except ValueError as err:
        print(err)
        sys.exit(1)
Beispiel #3
0
def main():
    game = Game(phrase)
    game.start_game()
Beispiel #4
0
import os

from phrasehunter.game import Game

PHRASES = [
    "winter is coming",
    "a diamond in the rough",
    "a house divided against itself cannot stand",
    "back to basics",
    "all is fair in love and war",
    "better late than never",
    "home is where the heart is",
    "a bird in the 1 hand is worth 2 in the bush",
    "a dime a dozen",
    "piece of cake",
    "burst your bubble",
    "close but no cigar",
    "birds of 1 feather flock together",
    "practice makes perfect",
]

if __name__ == "__main__":
    while True:
        game = Game(PHRASES)
        game.start_game()
        again = input("Play again? [y/n] ")
        if again == "n":
            os.system("cls" if os.name == "nt" else "clear")
            print("Thanks for playing!", "\n")
            exit()
            
# Import your Game class

# Create your Dunder Main statement.

# Inside Dunder Main:
## Create an instance of your Game class
## Start your game by calling the instance method that starts the game loop

from phrasehunter.game import Game

if __name__ == "__main__":
    Game = Game()
    Game.start_game()
Beispiel #6
0
  from phrasehunter.game import Game

  print('Welcome to Guess-That-Phrase. You are currently in the menu. What would you'
        ' like to do?')

  # Player should select a valid option from the menu.
  while True:
    player_input = input('(P)lay the game, (A)dd a phrase, or (E)xit   ')

    if player_input.upper() == 'P':

      # Create an instance of Game class.
      # Start the game.
      active_game = Game()
      try:
        active_game.start_game(active_game.current_phrase)
      except AttributeError:
        pass

      continue

    # Allow player to add their own phrases to the master phrase list.
    elif player_input.upper() == 'A':
      phrase_to_add = str(input('Please type the phrase you would like to add.   '))

      # Check to make sure that only letters can be added as a phrase.
      if re.search(r'[\w ]+[^\n\d_]',phrase_to_add):

        # Check to make sure phrase isn't blank.
        if len(phrase_to_add) != 0:
          with open("phrasehunter/phrase_master_list.txt","a") as open_file: