Ghost Game in Python
This program implements Ghost game in Python programming language.
Ghost game rule: There are three doors. Out of these door there is a GHOST behind one door. Each time you choose one door. If choosen door is not a ghost door then you will rewarded FIVE points. If it is a ghost door then GAME IS OVER.
Python Source Code: Ghost Game
# Ghost Game in Python
from random import randint
print("******************************")
print("******************************")
print("********* GHOST GAME *********")
print("******************************")
print("******************************")
print()
print("******************************")
print("***** THREE DOORS AHEAD *****")
print("******************************")
print()
print("******************************")
print("THERE IS A GHOST BEHIND 1 DOOR")
print("******************************")
print()
print("******************************")
print("YOU KEEP ON CHOOSING 1 DOOR \n UNTIL IT IS A GHOST DOOR. \n\nEACH DOOR WITHOUT GHOST \n GETS YOU FIVE POINTS")
print("******************************")
score = 0
while True:
ghost_door = randint(1,3)
door_choosen = int(input("\n\nWHICH DOOR 1 OR 2 OR 3? "))
if ghost_door == door_choosen:
print("\nGHOST! GHOST!! GHOST!!!")
break
else:
print("YOU EARNED FIVE POINTS :)")
score += 5
print("\nYOUR SCORE =", score)
print("\n\n********** GAME OVER **********")
Output
****************************** ****************************** ********* GHOST GAME ********* ****************************** ****************************** ****************************** ***** THREE DOORS AHEAD ***** ****************************** ****************************** THERE IS A GHOST BEHIND 1 DOOR ****************************** ****************************** YOU KEEP ON CHOOSING 1 DOOR UNTIL IT IS A GHOST DOOR. EACH DOOR WITHOUT GHOST GETS YOU FIVE POINTS ****************************** WHICH DOOR 1 OR 2 OR 3? 1 YOU EARNED FIVE POINTS :) WHICH DOOR 1 OR 2 OR 3? 1 YOU EARNED FIVE POINTS :) WHICH DOOR 1 OR 2 OR 3? 2 YOU EARNED FIVE POINTS :) WHICH DOOR 1 OR 2 OR 3? 1 YOU EARNED FIVE POINTS :) WHICH DOOR 1 OR 2 OR 3? 3 YOU EARNED FIVE POINTS :) WHICH DOOR 1 OR 2 OR 3? 1 YOU EARNED FIVE POINTS :) WHICH DOOR 1 OR 2 OR 3? 2 GHOST! GHOST!! GHOST!!! YOUR SCORE = 30 ********** GAME OVER **********