-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"python.formatting.provider": "black" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Project Title : Hollywood - A Movie Guessing Game | ||
# Version : 1.0 | ||
# Developed By : Aditya Vikram Singh | ||
|
||
import math, random | ||
|
||
|
||
class Hollywood: | ||
|
||
moviesList = [ | ||
"INTERSTELLAR", | ||
"ARMAGEDDON", | ||
"INCEPTION", | ||
"PLANET OF THE APES", | ||
"VAN HELSING", | ||
"IRON MAN", | ||
"PHANTOM THREAD", | ||
"LES MISERABLES", | ||
"THE REVENANT", | ||
"TITANIC", | ||
"THE DARK KNIGHT", | ||
"ROCKY", | ||
"JUSTICE LEAGUE", | ||
"STAR WARS", | ||
"THE GODFATHER", | ||
"WONDER WOMAN", | ||
"COCO", | ||
"THE AVENGERS", | ||
"AVATAR", | ||
"BRAVEHEART", | ||
"JURASSIC PARK", | ||
"MAN OF STEEL", | ||
"THE MATRIX", | ||
"LOGAN", | ||
"FORREST GUMP", | ||
] | ||
|
||
def SelectRandomMovie(): | ||
return Hollywood.moviesList[math.floor(random.randint(0, 24))] | ||
|
||
def CreateDummyMovieAndEncode(movie): | ||
movieCopy = list(movie) | ||
for i in range(len(movieCopy)): | ||
if movieCopy[i] not in ["A", "E", "I", "O", "U", " "]: | ||
movieCopy[i] = "*" | ||
return "".join(movieCopy) | ||
|
||
def FillOrSlash(movie, current): | ||
chances = 9 | ||
currentCopy = list(current) | ||
while chances > 0: | ||
while True: | ||
print("Guess a non-vowel alphabet: ") | ||
inp = input() | ||
if inp not in ["A", "E", "I", "O", "U", " "]: | ||
break | ||
found = False | ||
for i in range(len(movie)): | ||
if inp == movie[i]: | ||
currentCopy[i] = inp | ||
found = True | ||
if movie == "".join(currentCopy): | ||
chances = 0 | ||
print(movie) | ||
print("Congratulations! You guessed the movie.") | ||
elif found: | ||
print("Good guess!") | ||
print("".join(currentCopy)) | ||
else: | ||
chances = chances - 1 | ||
print("Character not present!") | ||
print("".join(currentCopy)) | ||
print("Chances remaining: ", chances) | ||
if movie != "".join(currentCopy): | ||
print("Chances are over, sorry! Better luck next time!") | ||
print("The movie was: ", movie) | ||
|
||
|
||
def main(): | ||
print("Hello! Let's play a game of HOLLYWOOD - a movie guessing game! ") | ||
toggle = "Y" | ||
while toggle != "N": | ||
movie = Hollywood.SelectRandomMovie() | ||
dummy = Hollywood.CreateDummyMovieAndEncode(movie) | ||
print(dummy) | ||
Hollywood.FillOrSlash(movie, dummy) | ||
print("Do you want to play another game (Y/N)?") | ||
toggle = input() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |