Python Forum
Minigame Collection with Menu
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Minigame Collection with Menu
#1
I have made a three day project that is a game hub.
It has 5 different games at the moment but will be updated sometime.
This is my first game hub I've ever made so don't expect it to be perfect.
It automatically boots up the menu once the previous game is done.
Just type the game number and start! 

Link:www.dropbox.com/s/5gbx1g0b6ulak88/gamePlace.py?dl=0

Copy and paste it cause it won't let me post a clickable link.
Reply
#2
please just post your code tags
gamemode = ""
while gamemode != "stop":
    print('''
*Which game do you want to play?
 
[1] Binary Game
[2] Guess my Number
[3] Mad libs
[4] Battle Square
[5] Name That Thing!
*More to come!
 
*Enter 'stop' to stop.
''')
    gamemode = input("")
    if gamemode == "1":
        print("==========================================")
        print("Welcome To Binary Game! (2 player)")
        print("")
        print('''Enter a three-digit Binary number
and wait to see if it comes up first!
First to 3 wins!
(example: 011 or 100)
''')
         
        from random import randint
        from time import sleep
         
        p1 = input("Player 1's Guess: ")
        p2 = input("Player 2's Guess: ")
         
        a = str(randint(0,1))+str(randint(0,1))+str(randint(0,1))
        n = 1
         
        p1p = 0
        p2p = 0
     
        while p1p < 3 and p2p < 3:
            print("Number "+str(n)+" is: "+a)
            if p1 == a:
                p1p += 1
                print("")
                print("Player 1 scored!")
                print("")
            if p2 == a:
                p2p += 1
                print("")
                print("Player 2 scored!")
                print("")
            a = str(randint(0,1))+str(randint(0,1))+str(randint(0,1))
            n +=1
            sleep(1.5)
         
        if p1p == 3:
            print("------------------------------------------")
            print("Player 1 wins!")
            print("")
            print("*==========================================*")
            print("*==========================================*")
            print("")
        if p2p == 3:
            print("------------------------------------------")
            print("Player 2 wins!")
            print("")
            print("*==========================================*")
            print("*==========================================*")
            print("")
    if gamemode == "2":
        print("==========================================")
        from random import randint
        print("Welome to guess my number!")
        print("from 1-100!")
        number = randint(1, 100)
        guess = int(input(""))
        while guess != number:
            if guess > number and guess <= 100:
                print("less than "+str(guess))
            if guess < number and guess <= 100:
                print("greater than "+str(guess))
            if guess > 100:
                print("less than 100 silly!")
            guess = int(input(""))
        if guess == number:
            print("Congratulations! The number is "+str(number)+"!")
        a = input("press enter to stop game (or not)")
        if a == "":
            print("")
            print("*==========================================*")
            print("*==========================================*")
            print("")
        else:
            print("The game is over buddy")
            input("")
            print("You already guessed it")
            input("")
            print("No more")
            input("")
            print("You see a game that is over,")
            print("you're filled with NONSENSE")
            input("")
            print("def shutup():")
            print("     for x in range(9001):")
            print('         print("shut up")')
            print("shutup()")
            input("")
            print("Player used 'Type something'")
            print("It's not very effective...")
            input("")
            print("You have reached the limit")
            input("")
            print("Annoyingness level is over 9000")
            input("")
            print('"Itsa me, a piece of crap."')
            input("")
            print("You see an opportunity, take it?")
            print("Yes!")
            print("you took the opportunity to shut up.")
            input("")
            print("knock knock.")
            kk = input("")
            if kk == "who's there":
                print("imadoofus")
                kk2 = input("")
                if kk2 == "imadoofus who":
                    print("you")
                else:
                    print("the tooth fairy's gonna make")
                    print("you rich tonight")
            else:
                print("the tooth fairy's gonna make")
                print("you rich tonight")
            input("")
            print("enter.exe has stopped working")
            print("")
            print("*==========================================*")
            print("*==========================================*")
            print("")
    if gamemode == "3":
        print("==========================================")
        print("Welcome to Mad Libs!")
        print("")
        na = input("noun ")
        nb = input("noun ")
        nc = input("noun ")
        va = input("verb ")
        nd = input("noun ")
        aa = input("adjective ")
     
        print(" ")
        print("You see a "+na+" in the "+nb+".")
        print("Holy "+nc+"!")
        print("You then "+va+" out the "+nd+".")
        print("Then you decide to go inside and sit on a ")
        print(" "+aa+" toilet.")
        print("")
        print("*==========================================*")
        print("*==========================================*")
        print("")
    if gamemode == "4":
        print("==========================================")
        print("Welcome to Battle Square!")
        print("Try to hit all the AI's Squares in a field!")
        print("")
        from time import sleep
        from random import randint
        gamestate = "active"
        sqr1 = randint(1,9)
        sqr2 = randint(1,9)
        sqr3 = randint(1,9)
        sqr4 = randint(1,9)
        sqr5 = randint(1,9)
        sqr6 = randint(1,9)
        alldestroyed = "false"
        print("Your squares' positions: "+str(sqr4)+", "+str(sqr5)+", "+str(sqr6))
        if sqr4 == sqr5 or sqr4 == sqr6 or sqr5 == sqr6:
            print("Uh oh, multiple squares landed on the same place!")
        print("")
        guess2 = int(input("Where to attack?\n(positions 1-9)\n"))
        while gamestate != "over":
            if sqr1 == "destroyed" and sqr2 == "destroyed" and sqr3 == "destroyed":
                alldestroyed = "true"
            if sqr4 == "destroyed" and sqr5 == "destroyed" and sqr6 == "destroyed":
                alldestroyed = "true"
            if guess2 == sqr1:
                sqr1 = "destroyed"
                print("Opponent's Square Destroyed!")
                print("")
                sleep(1)
            if guess2 == sqr2:
                sqr2 = "destroyed"
                print("Opponent's Square Destroyed!")
                print("")
                sleep(1)
            if guess2 == sqr3:
                sqr3 = "destroyed"
                print("Opponent's Square Destroyed!")
                print("")
                sleep(1)
            ai = randint(1,9)
            if alldestroyed != "true":
                input("Press ENTER if ready for AI's turn.\n")
                print("AI strikes at: "+str(ai))
                if ai == sqr4:
                    sqr4 = "destroyed"
                    print("Your Square has been Destroyed!")
                    print("")
                    sleep(1)
                if ai == sqr5:
                    sqr5 = "destroyed"
                    print("Your Square has been Destroyed!")
                    print("")
                    sleep(1)
                if ai == sqr6:
                    sqr6 = "destroyed"
                    print("Your Square has been Destroyed!")
                    print("")
                    sleep(1)
            if sqr4 == "destroyed" and sqr5 != "destroyed" and sqr6 != "destroyed":
                print("Your remaining square's positions: "+str(sqr5)+", "+str(sqr6))
            if sqr5 == "destroyed" and sqr4 != "destroyed" and sqr6 != "destroyed":
                print("Your remaining square's positions: "+str(sqr4)+", "+str(sqr6))
            if sqr6 == "destroyed" and sqr4 != "destroyed" and sqr5 != "destroyed":
                print("Your remaining squares' positions: "+str(sqr4)+", "+str(sqr5))
            if sqr4 == "destroyed" and sqr5 == "destroyed" and sqr6 != "destroyed":
                print("Your remaining squares' positions: "+str(sqr6))
            if sqr5 == "destroyed" and sqr6 == "destroyed" and sqr4 != "destroyed":
                print("Your remaining squares' positions: "+str(sqr4))
            if sqr6 == "destroyed" and sqr4 == "destroyed" and sqr5 != "destroyed":
                print("Your remaining squares' positions: "+str(sqr5))
            if sqr4 == "destroyed" and sqr5 == "destroyed" and sqr6 == "destroyed":
                print("Game over, You lost.")
                print("")
                print("*==========================================*")
                print("*==========================================*")
                print("")
                gamestate = "over"
            if sqr1 == "destroyed" and sqr2 == "destroyed" and sqr3 == "destroyed":
                print("Game over, You Won!")
                print("")
                print("*==========================================*")
                print("*==========================================*")
                print("")
                gamestate = "over"
            if gamestate != "over":
                guess2 = int(input("\nWhere to attack?\n(positions 1-9)\n"))
    if gamemode == "5":
        qa = 0
        print("==========================================")
        print("Welcome to Name That Thing!")
        print("Rule: your answer should be only one or two words long\nand must be only lowercase")
        print("*more possible questions soon to come")
        print("")
        from random import randint
        score = 0
        input("Press ENTER to start")
        while qa <= 5:
            q = randint(1,8)
            if q == 1:
                q1 = input("\nWhich famous mathematical sequence is this? (1 word)\n1, 1, 2, 3, 5, 8, 13...\n")
                if q1 == "fibonacci":
                    print("Corect!")
                    score += 1
                    qa += 1
                else:
                    print("Whoops, The answer was 'fibonacci'")
                    qa += 1
            if q == 2:
                q2 = input('''
What is this? (1 word)
 ___,
|   |
|___|__/
''')
                if q2 == "letter":
                    print("Correct!")
                    score += 1
                    qa += 1
                elif q2 == "a":
                    print("Close!")
                    q2a = input("")
                    if q2a == "letter":
                        print("Correct!")
                        score += 1
                        qa += 1
                else:
                    print("Whoops, The answer was 'letter'")
                    qa += 1
            if q == 3:
                q3 = input("\nAnd his name is: (2 words)\n")
                if q3 == "john cena":
                    print("Correct!")
                    score += 1
                    qa += 1
                else:
                    print("Whoops, the answer was 'john cena'")
                    qa += 1
            if q == 4:
                q4 = input("\nWhat is this? (1 or 2 words)\ny = x^2 + 2x + 1\n")
                if q4 == "equation" or q4 == "an equation":
                    print("Correct!")
                    score += 1
                    qa += 1
                else:
                    print("Whoops, the answer was 'equation' or 'an equation'")
                    qa += 1
            if q == 5:
                q5 = input("\nIn what city is the Eiffel Tower located? (1 word)\n")
                if q5 == "paris":
                    print("Correct!")
                    score += 1
                    qa += 1
                elif q5 == "Paris":
                    print("Correct, but make sure your answer is lowercase next time.")
                    score += 1
                    qa += 1
                else:
                    print("Whoops, The answer was 'paris'")
                    qa += 1
            if q == 6:
                q6 = input("\nWhat year was the actual paricle 'The Higgs Boson' discovered? (a number)\n")
                if q6 == "2011":
                    print("Correct!")
                    score += 1
                    qa += 1
                else:
                    print("Whoops, The answer was '2011'")
                    qa += 1
            if q == 7:
                q7 = input("\nI'm lying.\nAm I actually lying in that statement?\n")
                print("That's a trick question. This doesn't count against your points.")
            if q == 8:
                q8 = input("\nSolid Carbon-Dioxide is called _____  (2 words)\n")
                if q8 == "dry ice":
                    print("Correct!")
                    score += 1
                    qa += 1
                else:
                    print("Whoops, The answer was 'dry ice'")
                    qa += 1
        if qa == 6:
            input("Press ENTER to see score.")
            print("You got "+str(score)+"/5 correct!")
            input("\nPress ENTER to end game\n")
            print("")
            print("*==========================================*")
            print("*==========================================*")
            print("")
if gamemode == "stop":
    from time import sleep
    print('''
 ____  ____   ____            ___  
|____ |____| |____|    |___|  ___|    |
 ____||_____ |_____      |   |___|_|  .
''')
    sleep(1.5)
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  please help me improve this minigame Naito 7 3,792 Jan-22-2019, 01:19 AM
Last Post: PythonSnake
  Collection of programming ideas and challenges metulburr 8 40,792 Oct-20-2018, 06:24 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020