コード例 #1
0
ファイル: app.py プロジェクト: francestang221/phrase-hunters
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()
コード例 #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)
コード例 #3
0
ファイル: app.py プロジェクト: FrankchingKang/phrasehunter
# 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.character import Character
from phrasehunter.phrase import Phrase
from phrasehunter.game import Game


if __name__ == "__main__":


    phrase_for_guss = [Phrase('apple'), Phrase('book'),Phrase('logitech'), Phrase('dell'), Phrase('amuze')]
    Guess_words = Game(phrase_for_guss)
    Guess_words.game_on()

    #Guess_words.show_all_the_phrase()
コード例 #4
0
ファイル: app.py プロジェクト: petepall/Treehouse_project_3
from phrasehunter.data import PHRASES
from phrasehunter.game import Game

if __name__ == "__main__":
    phrase_game = Game(PHRASES)
    phrase_game.game_initialization()
コード例 #5
0
ファイル: app.py プロジェクト: lmapple/techdegree-project-3
  # Import Game class, regular expressions, and random.
  import re
  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.
コード例 #6
0
from phrasehunter.game import Game

if __name__ == "__main__":
    print("Welcome to the Phrasehunter Game!")
    g = Game("The desire to write the desire to live",
    "The laws of nature", 
    "Forget yourself",
    "For my contemporaries",
    "Know your own readers")
    
    g.main_loop()
コード例 #7
0
ファイル: app.py プロジェクト: Marksparkyryan/phrase-hunter
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()
            
コード例 #8
0
from phrasehunter.game import Game
from phrasehunter.constants import stored_phrases

if __name__ == '__main__':
    game = Game(stored_phrases)
    try:
        game.run_game()
    except KeyboardInterrupt:
        print("\nThanks for playing!")
コード例 #9
0
ファイル: app.py プロジェクト: henrikac/PhraseHunter
from phrasehunter.character import Character
from phrasehunter.game import Game
from phrasehunter.phrase import Phrase


def create_phrases() -> List[Phrase]:
    """Creates a list of phrases"""
    phrases: List[Phrase] = []
    str_phrases = ['Hello', 'Cowboy', 'Christmas', 'Santa Claus', 'Univers']

    for phrase in str_phrases:
        try:
            chars = [Character(char) for char in phrase]
        except ValueError as err:
            print(f'\nError: {err}\n')
        else:
            phrases.append(Phrase(chars))

    return phrases


if __name__ == '__main__':
    try:
        phrases = create_phrases()
        game = Game(phrases)
    except ValueError as err:
        print(f'\nError: {err}\n')
    else:
        game.play()
コード例 #10
0
import re
from phrasehunter.game import Game

if __name__ == '__main__':
    # Learned how to open text files with the help of: https://docs.python.org/3/tutorial/inputoutput.html
    with open("phrases.txt") as phrases:
        phrase_list = re.findall(r"[\w?' ]+", phrases.read())
        game = Game(phrase_list)
        game.run_game()
コード例 #11
0
    lines = []
    for line in file_in:
        lines.append(line.strip())

# constant_phrases = ("the cat is dead", "howdy", "my name is earl", "I am feeling go sick", "abracadabra")
# import phrases from file text ;)

if __name__ == "__main__":

    play = "y"

    # Choosing a random phrase
    while play == "y":
        random_phrase = random.choice(lines)

        game = Game(phrase.Phrase(random_phrase))
        print(game.phrase)
        print(game.attempts)

        game.input()

        if game.result():
            print("Bravo ! You guessed the right word")
        else:
            print(f"You lost ! the answer was {game.phrase.phrase}")

        play = "z"

        while play not in ["y", "n"]:
            play = input("Do you want to play again? (Y/N)").lower()
コード例 #12
0
ファイル: app.py プロジェクト: awllms/phrase_hunter
from phrasehunter.game import Game

if __name__ == '__main__':

    game = Game()
    game.start_game()
コード例 #13
0
from phrasehunter.phrase import Phrase
from phrasehunter.game import Game

if __name__ == '__main__':

	game = Game() #Create an instance of Game Class called 'game'.
	game.start() #Execute the 'start()' method within  Game class.
コード例 #14
0
ファイル: app.py プロジェクト: ajlongcoy21/Phrase-Hunter
def main():
    my_game = Game()
    my_game.start()
コード例 #15
0
ファイル: app.py プロジェクト: MattHill94/Treehouse_project_3
from phrasehunter.game import Game

if __name__ == "__main__":
    print("Welcome to the Phrasehunter Game!")
    g = Game("help",
            "let it be",
            "hey jude", 
            "come together")
    
    g.main_loop()
コード例 #16
0
from phrasehunter.game import Game

if __name__ == '__main__':
    try:
        phrasehunter = Game()
        phrasehunter.start()

    except Exception as e:
        raise e
コード例 #17
0
"""
Python Web Development Techdegree
Project 3 - Phrase Hunter Game
Author: Trey Annis
Goal: Meet All 'Exceeds Expectations' Requirements
--------------------------------
"""

from phrasehunter.game import Game

if __name__ == "__main__":

    while True:
        new_game = Game()
        new_game.start()

        if new_game.start() == 'Y':
            new_game = Game()
            new_game.start()

        else:
            exit()
コード例 #18
0
from phrasehunter.game import Game

if __name__ == '__main__':
    game = Game()
    game.welcome()
    game.start()
コード例 #19
0
from phrasehunter.game import Game  # Import your Game class

if __name__ == "__main__":  # Create your Dunder Main statement.
    # Inside Dunder Main:
    game = Game()  ## Create an instance of your Game class
    game.run(
    )  ## Start your game by calling the instance method that starts the game loop
コード例 #20
0
ファイル: app.py プロジェクト: DenilsonDesigns/PY_TD_P3
# Import your Game class
from phrasehunter.game import Game
from phrasehunter.phrase import Phrase
from phrasehunter.character import Character

# 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
if __name__ == '__main__':
    new_game = Game("test game")
    Game.test_class()
    Phrase.test_class()
    Character.test_class()
    new_game.run_game()

コード例 #21
0
from phrasehunter.game import Game

if __name__ == '__main__':
    phraselist = ['Hello', 'Potato Sandwich', 'Fish', 'Bob Cobb', 'Khan']
    game = Game(phraselist)
    game.start_game()
コード例 #22
0

def load_phrases():
    """
    Load quotes to be used for the game from file phrasehunter.csv
    each quote is stored in tuple containing quote + author
    :return: phraselist
    :rtype: list of tuples
    """
    phraselist = []
    try:
        with open('./phrasehunter/phraselist.csv') as csvfile:
            reader = csv.DictReader(csvfile, delimiter='|')
            for row in reader:
                phraselist.append((row['Phrase'], row['Author']))
    except FileNotFoundError:
        print('phraselist.csv file not found, terminating program')
        sys.exit(1)
    return phraselist


if __name__ == "__main__":
    phraselist = load_phrases()
    play_again = 'y'
    while play_again.lower() == 'y':
        game = Game(phraselist)
        game.play_game()
        play_again = input('Do you want to play again ? (y/n) ')
        del game
    print('Thank you for playing the game !  Enjoy the rest of your day')
コード例 #23
0
from phrasehunter.game import Game
from phrasehunter.phrases import quote_list

if __name__ == "__main__":
    Game(phrases=quote_list).start(0)
コード例 #24
0
def main():
    game = Game(phrase)
    game.start_game()
コード例 #25
0
ファイル: app.py プロジェクト: ppopores/phrase_hunter_project
from phrasehunter.game import Game

if __name__ == "__main__":

    game = Game()
    game.start()
    game.play_again()


コード例 #26
0
from phrasehunter.game import Game
from phrasehunter.phrase import Phrase

if __name__ == "__main__":

    game = Game()
    game.start()
    phrase = Phrase(game.phrases)
コード例 #27
0
from phrasehunter.game import Game

if __name__ == "__main__":
    on_going_game = Game()
    on_going_game.start()