wow this was complete garbage!

This commit is contained in:
2026-04-01 13:02:45 +01:00
parent 3ad71e48a4
commit 211f8cec11
13 changed files with 1007 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
import random, time, logging
fmt = "%(levelname)s @ ln %(lineno)d in `%(filename)s`: %(message)s"
logging.basicConfig(format=fmt, level=logging.DEBUG)
logging.warning("DISCLAIMER! This is the legacy version of 'A Game To Play When You're Bored'\nBugs in this version will not be patched and datastores will not be added.")
print("This is a game where you guess a number. It's so original!")
def main():
try:
playTo = int(input("[SETUP] Please enter the amount of guesses you can have (I'd recommend 20)\n> "))
except ValueError:
logging.error("Value must be an integer!\n\n")
main()
except KeyboardInterrupt:
logging.debug(f"Exiting via KeyboardInterrupt.")
exit()
except:
logging.fatal("An unhandled exception occured.")
exit()
print(f'\nGuess a number between 1 and 1000, you will be told if your guess was too low or too high.\nYou have {playTo} guesses.')
finalVal = random.randrange(1,1000)
guessLeft = playTo
for i in range(playTo):
try:
userNum = int(input("\n> "))
except ValueError:
logging.error("Value must be an integer!\nWasting a turn by setting the value to -1...\n\n")
userNum = -1
except KeyboardInterrupt:
logging.debug(f"Exiting via KeyboardInterrupt, the number was {finalVal}")
time.sleep(5)
exit()
except:
logging.fatal("An unhandled exception occured.")
exit()
if userNum == finalVal:
print(f'-=+ YOU WIN! +=-\nWith {guessLeft} guesses remaining.')
time.sleep(5)
logging.debug("Exiting...")
exit()
elif userNum < finalVal:
print("Too low")
guessLeft = guessLeft - 1
print(f'{guessLeft} guesses remaining...')
else:
print("Too high")
guessLeft = guessLeft - 1
print(f'{guessLeft} guesses remaining...')
print("\n-=+ GAME OVER +=-")
print(f'The number was {finalVal}.')
time.sleep(5)
logging.debug("Exiting...")
exit()
if __name__ == "__main__":
main()
+233
View File
@@ -0,0 +1,233 @@
# Imports
import random, time, logging, replit, os
# Logging format
fmt = "%(levelname)s @ ln %(lineno)d in `%(filename)s`: %(message)s"
logging.basicConfig(format=fmt, level=logging.WARN)
# Set account to nil to avoid errors
account = None
# Check if user would like to log in
accountCheck = input(
"Would you like to login?\n(This is for data stores)\n(Y/[N])\nTo get your data, type \"request\"\nYou can type DELETE (in all caps) to delete all save data.\n> "
)
# Login handler
if str.lower(accountCheck) == "y":
signedIn = True
print("Loading profile...")
# Check if logged in
if os.environ["REPL_OWNER"] != "five-nine":
try:
user = os.environ["REPL_OWNER"]
print(f"Logged in as {user}")
# Create profile
if user not in replit.db.keys():
replit.db[user] = {"wins": 0, "losses": 0}
print("Loaded profile!")
# Load user data
if user in replit.db.keys():
account = replit.db.get(user)
try:
print(
f"You have {account['wins']} wins and {account['losses']} losses. Rating: {round((account['wins'] / (account['wins'] + account['losses'])), 2) * 100}%"
)
except ZeroDivisionError:
print("No previous games found.")
except KeyError:
logging.error("Unable to get account information. Are you logged in?")
signedIn = False
else:
signedIn = False
print(
"It looks like you're not signed in. Please sign in to use data stores"
)
elif str.lower(accountCheck) == "request":
signedIn = True
print("Loading data...")
if os.environ["REPL_OWNER"] != "five-nine":
try:
user = os.environ["REPL_OWNER"]
print(f"Logged in as {user}")
if user not in replit.db.keys():
print("You don't have any data to request?!?!")
if user in replit.db.keys():
account = replit.db.get(user)
print(
f"\n-=+=-\nYour data looks like this:\n{replit.db.get(user)}\n-=+=-")
except KeyError:
logging.error(
"Unable to get acount information -- Not logged in somehow.")
signedIn = False
else:
signedIn = False
print(
"It looks like you're not signed in. Please sign in to view user data")
elif accountCheck == "DEBUG":
print(
"Debug commands:\nDEBUG -- WINSTAT\nDEBUG -- LOSSSTAT\n\nCase-sensitive!"
)
logging.fatal("Debug exit")
exit()
elif accountCheck == "DEBUG -- WINSTAT":
print("This is debug mode -- expect errors.")
if os.environ["REPL_OWNER"] != "five-nine":
try:
user = os.environ["REPL_OWNER"]
print(f"Logged in as {user}")
if user not in replit.db.keys():
print("You don't have any save data to edit!")
if user in replit.db.keys():
account = replit.db.get(user)
while True:
try:
editWinStat = int(input("Enter the stat to set win count to\n> "))
account["wins"] = editWinStat
print("Saved.")
print(
f"\n-=+=-\nYour data now looks like this:\n{replit.db.get(user)}\n-=+=-"
)
break
except ValueError:
print("Must be a number!")
except KeyError:
logging.error("Unable to get account information -- Not logged in.")
elif accountCheck == "DEBUG -- LOSSSTAT":
print("This is debug mode -- expect errors.")
if os.environ["REPL_OWNER"] != "five-nine":
try:
user = os.environ["REPL_OWNER"]
print(f"Logged in as {user}")
if user not in replit.db.keys():
print("You don't have any save data to edit!")
if user in replit.db.keys():
account = replit.db.get(user)
while True:
try:
editWinStat = int(input("Enter the stat to set loss count to\n> "))
account["losses"] = editWinStat
print("Saved.")
print(
f"\n-=+=-\nYour data now looks like this:\n{replit.db.get(user)}\n-=+=-"
)
break
except ValueError:
print("Must be a number!")
except KeyError:
logging.error("Unable to get account information -- Not logged in.")
elif accountCheck == "DELETE":
# Load profile
print("Loading profile...")
# Check if logged in
if os.environ["REPL_OWNER"] != "five-nine":
try:
user = os.environ["REPL_OWNER"]
print(f"Logged in as {user}")
if user not in replit.db.keys():
# Show if user tries to delete save data but isn't in the database
print("You don't have any save data to erase???")
else:
# Delete save data
del replit.db[user]
print("Save data deleted.\nLogged out.")
signedIn = False
except KeyError:
print("Unable to get account information. Are you logged in?")
signedIn = False
else:
signedIn = False
print("You aren't signed in so the data store couldn't be erased.")
else:
# If user doesn't sign in.
signedIn = False
print("Continuing without logging in...")
logging.basicConfig(format=fmt, level=logging.DEBUG)
# MAIN SEGMENT
print("\nThis is a game where you guess a number. It's so original!")
def main():
try:
playTo = int(
input(
"[SETUP] Please enter the amount of guesses you can have (I'd recommend 20)\n> "
))
except ValueError:
logging.error("Value must be an integer!\n\n")
main()
except KeyboardInterrupt:
logging.debug(f"Exiting via KeyboardInterrupt.")
exit()
except:
logging.fatal("An unhandled exception occured.")
exit()
print(
f'\nGuess a number between 1 and 1000, you will be told if your guess was too low or too high.\nYou have {playTo} guesses.'
)
finalVal = random.randrange(1, 1000)
guessLeft = playTo
for i in range(playTo):
try:
userNum = int(input("\n> "))
except ValueError:
logging.error(
"Value must be an integer!\nWasting a turn by setting the value to -1...\n\n"
)
userNum = -1
except KeyboardInterrupt:
logging.debug(
f"Exiting via KeyboardInterrupt, the number was {finalVal}")
time.sleep(5)
exit()
except:
logging.fatal("An unhandled exception occured.")
exit()
if userNum == finalVal:
print(f'-=+ YOU WIN! +=-\nWith {guessLeft} guesses remaining.')
if signedIn == True:
account["wins"] += 1
print(
f"You now have {account['wins']} win(s) with a rating of {round((account['wins'] / (account['wins'] + account['losses'])), 2) * 100}%"
)
else:
print("Did not save data as you're not signed in")
time.sleep(5)
logging.debug("Exiting...")
exit()
elif userNum < finalVal:
print("Too low")
guessLeft = guessLeft - 1
print(f'{guessLeft} guesses remaining...')
else:
print("Too high")
guessLeft = guessLeft - 1
print(f'{guessLeft} guesses remaining...')
print("\n-=+ GAME OVER +=-")
print(f'The number was {finalVal}. Better luck next time.')
if signedIn == True:
account["losses"] += 1
print(
f"You now have {account['losses']} losse(s) with a rating of {round((account['wins'] / (account['wins'] + account['losses'])), 2) * 100}%"
)
else:
print("Did not save data as you're not signed in")
time.sleep(5)
logging.debug("Exiting...")
exit()
if __name__ == "__main__":
main()
+100
View File
@@ -0,0 +1,100 @@
const express = require("express")
const app = express()
app.get("/", (req, res) => {
res.send("Hello! What are you looking for here?")
})
app.listen(3000, () => {
console.log("TGC19s Utilities started!")
})
let Discord = require("discord.js")
let client = new Discord.Client()
client.on("ready", () => {
client.user.setPresence({ activity: { name: "T19!help" } })
})
client.on("guildMemberAdd", member => {
if(member.guild.id === "730091018065805442") {
client.channels.cache.get("730091018069999618").send(`Hi ${member}! Welcome to TGC19s Community Server!`)
}
})
client.on("message", message => {
if(message.content === "T19!asdf") {
message.channel.send("What?")
}
if(message.content === "T19!help") {
message.channel.send("T19!status - Sends the link to the bot status page\nT19!ping - Checks if the bot is responding\nT19!kill - kills someone\nT19!kick - Kicks a user (Admins / Moderators only\nT19!ban - Bans a user (Admins / Moderators only\nT19!cat - Shows a picture of a cat\nT19!invite - Sends the invite link\nT19!credits - Shows the credits\nT19!info - Shows the current version\nT19!random int - Shows a random number between 1 and 10")
}
if(message.content.startsWith("T19!kill")) {
let victim = message.mentions.users.first()
if(!victim) message.reply("Mention someone to kill")
else {
message.channel.send(`${victim} randomly died. What a noob`)
}
}
if(message.content.startsWith("T19!kick")) {
if(message.member.hasPermission("KICK_MEMBERS")) {
let member = message.mentions.members.first()
if(!member) message.channel.send(":question: Please mention someone to kick")
else {
member.kick().then(mem => {
message.channel.send(`Kicked ${mem.user.username}.`)
})
}
} else {
message.reply("It seems as if you don't have permission to do that command. :x:")
}
}
if(message.content.startsWith("T19!ban")) {
if(message.member.hasPermission("BAN_MEMBERS")) {
let member = message.mentions.members.first()
if(!member) message.channel.send(":question: Please mention someone to ban")
else {
member.ban().then(mem => {
message.channel.send(`Banned ${mem.user.username}.`)
})
}
} else {
message.reply("It seems as if you don't have permission to do that command. :x:")
}
}
if(message.content === "T19!cat") {
let image = new Discord.MessageAttachment("*** REDACTED DURING MIGRATION ***", "cat.png")
message.channel.send(image)
}
if(message.content === "T19!status") {
message.channel.send("You can check the status of TGC19s bots here: *** REDACTED DURING MIGRATION *** \nThough you could just look if the bot has an online indicator.")
}
if(message.content === "T19!credits") {
let embed = new Discord.MessageEmbed()
.setTitle("Credits")
.setDescription("Scripted by TGC19")
.setColor("#ff6d00")
.setFooter("Thanks for using my bot")
message.channel.send(embed)
}
if(message.content === "T19!invite") {
message.channel.send("Use this to invite the standard version of the bot! \n*** REDACTED DURING MIGRATION ***")
}
if(message.content === "T19!ping") {
let embed = new Discord.MessageEmbed()
.setTitle("Pong!")
.setDescription("If you're seeing this, the bot is responding.")
.setColor("GREEN")
.setFooter("MAIN VER")
message.channel.send(embed)
}
if(message.content === "T19!info") {
message.channel.send("This bot is running the main version.")
}
if(message.content === "T19!random int") {
let ran_number = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
message.channel.send(`${ran_number[Math.floor(Math.random() * ran_number.length)]} is your random number!`)
}
})
client.login(process.env.token)
+94
View File
@@ -0,0 +1,94 @@
const express = require("express")
const app = express()
app.get("/", (req, res) => {
res.send("Hello! What are you looking for here?\n \nDEV VER")
})
app.listen(3000, () => {
console.log("TGC19s Utilities Dev started!")
})
let Discord = require("discord.js")
let client = new Discord.Client()
client.on("ready", () => {
client.user.setPresence({ activity: { name: "T19>help" } })
})
client.on("message", message => {
if(message.content === "T19>asdf") {
message.channel.send("English please!")
}
if(message.content === "T19>help") {
message.channel.send("T19>status - Sends the link to the bot status page\nT19>ping - Checks if the bot is responding\nT19>kill - kills someone\nT19>kick - Kicks a user (Admins / Moderators only\nT19>ban - Bans a user (Admins / Moderators only\nT19>cat - Shows a picture of a cat\nT19>invite - Sends the invite link\nT19>credits - Shows the credits\nT19>info - Shows the current version\nT19>random int - Displays a random number between 1 and 10")
}
if(message.content.startsWith("T19>kill")) {
let victim = message.mentions.users.first()
if(!victim) message.reply("Mention someone to kill")
else {
message.channel.send(`${victim} randomly died. What a noob`)
}
}
if(message.content.startsWith("T19>kick")) {
if(message.member.hasPermission("KICK_MEMBERS")) {
let member = message.mentions.members.first()
if(!member) message.channel.send(":question: Please mention someone to kick")
else {
member.kick().then(mem => {
message.channel.send(`Kicked ${mem.user.username}.`)
})
}
} else {
message.reply("It seems as if you don't have permission to do that command. :x:")
}
}
if(message.content.startsWith("T19>ban")) {
if(message.member.hasPermission("BAN_MEMBERS")) {
let member = message.mentions.members.first()
if(!member) message.channel.send(":question: Please mention someone to ban")
else {
member.ban().then(mem => {
message.channel.send(`Banned ${mem.user.username}.`)
})
}
} else {
message.reply("It seems as if you don't have permission to do that command. :x:")
}
}
if(message.content === "T19>cat") {
let image = new Discord.MessageAttachment("*** REDACTED DURING MIGRATION ***", "cat.png")
message.channel.send(image)
}
if(message.content === "T19>status") {
message.channel.send("You can check the status of TGC19s bots here: *** REDACTED DURING MIGRATION *** \nThough you could just look if the bot has an online indicator.")
}
if(message.content === "T19>ping") {
let embed = new Discord.MessageEmbed()
.setTitle("Pong!")
.setDescription("If you're seeing this, the bot is responding.")
.setColor("GREEN")
.setFooter("DEV VER")
message.channel.send(embed)
}
if(message.content === "T19>credits") {
let embed = new Discord.MessageEmbed()
.setTitle("Credits")
.setDescription("Scripted by TGC19")
.setColor("#838383")
.setFooter("Thanks for using my bot")
message.channel.send(embed)
}
if(message.content === "T19>invite") {
message.channel.send("Use this to invite the development version of the bot! \n*** REDACTED DURING MIGRATION ***")
}
if(message.content === "T19>info") {
message.channel.send("This bot is running the development version. Expect bugs to occur\n**The prefix is T19>**")
}
if(message.content === "T19>random int") {
let ran_number = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
message.channel.send(`${ran_number[Math.floor(Math.random() * ran_number.length)]} is your random number!`)
}
})
client.login(process.env.token)
+124
View File
@@ -0,0 +1,124 @@
def start():
print("""
You awake to find yourself in a dark corridor, it looks like a school but you can't be sure as there are no lights. You walk slowly up the corridor, holding onto the walls. There is a swinging light flickering on and off ahead. There is a door to your left and a door to your right... which way do you want to go?""")
option=input("Enter A for ahead, L to go left, R to go right >>> ")
# A should take you to reception
# L should take you to year7cor
# R should take you to techblock
# Anything else should display an error message and take you to start
if option == "A":
reception()
elif option == "L":
year7cor()
elif option == "R":
techblock()
else:
print("That's not an option. Try again")
start()
def reception():
print("""
You are in the reception area. The internal doors are opening and closing on their own and nobody is in sight. The whole place is trashed. You can hear some whaling in the distance and it sounds spooky. The main entrance is locked. There are 10 foot fences surrounding the entire school. You try the main entrance door but you can't get it open. There is a door to your left.""")
option=input("Enter B to go back to the corridor, or L to go through the door >>> ")
# B should take you to start
# L should take you to slt
# Anything else should display an error message and take you to reception
if option == "B":
start()
elif option == "L":
slt()
else:
print("That's not an option. Try again")
reception()
def year7cor():
print("""
You must have made a wrong turn as there are hundreds of year 7 zombies running around the corridor and classrooms. You need to get out of here quickly! There is a hole in the wall to your right.""")
option=input("Enter B to go back, or W to go through the hole in the wall >>> ")
# B should take you to reception
# W should take you to escape
# Anything else should display an error message and take you to year7cor
if option == "B":
reception()
elif option == "W":
escape()
else:
print("That's not an option. Try again")
year7cor()
def techblock():
print("""
You have arrived to the Tech block and it seems abandoned. There are no windows or doors left, the whole place has been devastated. There is a message sprayed onto the floor, it reads: 'password is 6419'. What does this mean you wonder?
You hear a loud crash and see some zombie teachers coming your way.""")
choice=input("You need to think fast - to run enter R, or fight them enter F >>> ")
# R should take you to escape
# F should take you to fight
# Anything else should display an error message and take you to techblock
if choice == "R":
escape()
elif choice == "F":
fight()
else:
print("That's not an option. Try again")
def slt():
print("""
There is nothing here. Just darkness and scary noises, you should go back.""")
option=input("Hit B to go back >>> ")
# B should take you to reception
# Anything else should display an error message and take you to slt
if option == "B":
reception()
else:
print("That's not an option. Try again")
slt()
def fight():
print("""
You fought your best but you didn't stand a chance! Game over!""")
option=input("Retry (R)? Or Quit (Q)?")
# R should take you to start
# Q should quit the program using ' quit() '
# Anything else should display an error message and take you to fight
if option == "R":
start()
elif option == "Q":
exit()
else:
print("That's not an option. Try again")
fight()
# DO NOT EDIT OR ADD ANYTHING BELOW THIS LINE!****************************************
def escape():
print("""
You arrive to the 10 foot fencing outside. The steel fences are secure, there is no way out.
You notice a box on one of the fence panels. A metal box, glistening. You approach it, it needs a security passcode! You look behind you and you can now see the year 7 zombies heading your way and they look hungry!""")
option=input("Do you have the passcode? If so, enter Y. If not, you had better run! enter N >>> ")
if option == "Y":
passcode=input("Enter the code: >> ")
if passcode == "6419":
win()
else:
print("wrong code! Try again")
escape()
elif option == "N":
print("Run, run, run!")
reception()
else:
print("Sorry I didn't understand that")
escape()
def win():
print("""
Congratulations! You escaped the *** REDACTED DURING MIGRATION ***!
GAME OVER!""")
quit()
print("Welcome to *** REDACTED DURING MIGRATION ***!")
start()
# This instructs the program to go to the start() function - do not edit!
+25
View File
@@ -0,0 +1,25 @@
########################################################
# MIGRATION NOTE: wow yeah you can tell this is from a #
# programming class #
########################################################
def cooking():
print("Meal planner")
print()
print("1. Chicken curry ")
print("2. Veggie lasagne")
print("3. Burger and salad")
print()
print("Which of these meals is your favourite? (1, 2 or 3) ")
answer = input()
if answer == "1":
print("Chicken curry coming up")
elif answer == "2":
print("Veggie lasagne coming up")
else:
print("Burger and salad coming up!")
print("Enjoy!")
cooking()
+10
View File
@@ -0,0 +1,10 @@
##############################################################
# MIGRATION NOTE: wow this is ass. you can tell this is from #
# when i was learning programming #
##############################################################
def room1():
print("You have arrived at [Room 1]")
name = input("What is your name?\n> ")
print("Hello", name, "Welcome to room 1")
room1()
+3
View File
@@ -5,3 +5,6 @@ theyre here as replit is deleting my account and it seems bad to let em just tak
theyre part of my history and all that theyre part of my history and all that
---
MIGRATION NOTE: theyre all absolute garbage.
+76
View File
@@ -0,0 +1,76 @@
import random, time
# Assign lists.
possiblePlays = ["r", "p", "s"]
possiblePlaysFull = ["Rock", "Paper", "Scissors"]
# into
print("-=+ ROCK PAPER SCISSORS +=-")
print('Type "R" for rock\n"P" for paper\nand "S" for scissors\n(I guess you can type out the whole word as well...)')
# make lose and win modules.
def lose():
print("You lose!\n")
def win():
print("You win!\n")
# You wont guess what this does!
# Gets user input
def main():
## LOGIC.
#if userPlay == computerPlay:
# print("Tie! Play again!")
# main()
#elif userPlay == "r" and computerPlay == "p":
# lose()
#elif userPlay == "r" and computerPlay == "s":
# win()
#elif userPlay == "p" and computerPlay == "r":
# win()
#elif userPlay == "p" and computerPlay == "s":
# lose()
#elif userPlay == "s" and computerPlay == "r":
# lose()
#elif userPlay == "s" and computerPlay == "p":
# win()
#else:
# print("Not a valid option! Try again.")
# main()
results = {
"rr": main,
"pp": main,
"ss": main,
"rp": lose,
"rs": win,
"pr": win,
"ps": lose,
"sr": lose,
"sp": lose
}
while True:
# Get user input
userPlay = str.lower(input("--> "))
# Computer randomly selects item from list
computerIndex = random.randrange(0,3)
computerPlay = possiblePlays[computerIndex]
# Show what the computer plays
print(f"Computer plays: {possiblePlaysFull[computerIndex]}")
response = ""
response += userPlay[0]
response += computerPlay
try:
results[response]()
except KeyError:
print("Not an option.")
# if name main. idk why I randomly started to do this but hey ho.
if __name__ == "__main__":
main()
+25
View File
@@ -0,0 +1,25 @@
import time
print("-=+ TASK 1 +=-")
studentName = input("Enter your name\n> ")
scoreOne = int(input("Enter your first score\n> "))
scoreTwo = int(input("Enter your second score\n> "))
scoreThree = int(input("Enter your third score\n> "))
beforeDiv = scoreOne+scoreTwo+scoreThree
finalScore = beforeDiv / 3
print(f'NAME: {studentName}\nSCORE: {round(finalScore, 2)}')
print("-=+ TASK 2 +=-")
nameOne = input("Enter the name of the first person\n> ")
nameTwo = input("Enter the name of the second person\n> ")
foodOne = int(input("How much did person 1 spend on food?\n£"))
foodTwo = int(input("How much did person 2 spend on food?\n£"))
drinksOne = int(input("How much did person 1 spend on drinks?\n£"))
drinksTwo = int(input("How much did person 2 spend on drinks?\n£"))
total = foodOne+foodTwo+drinksOne+drinksTwo
print(total/2)
time.sleep(5)
+119
View File
@@ -0,0 +1,119 @@
# This code is horribly inefficient
#####################################
# MIGRATION NOTE: yeah you dont say #
#####################################
def q1():
a1 = input("What is the capital of England?\nA. Bristol\nB. London\nC. England\n\n-> ")
if a1 == "a":
print("Incorrect!\nTry again.\n\n")
q1()
elif a1 == "A":
print("Incorrect!\nTry again.\n\n")
q1()
elif a1 == "b":
print("Correct!\n\n")
q2()
elif a1 == "B":
print("Correct!\n\n")
q2()
elif a1 == "c":
print("Incorrect!\n Try again.\n\n")
q1()
elif a1 == "C":
print("Incorrect!\n Try again.\n\n")
q1()
# Error handling.
else:
print("Sorry I didn't quite catch that, can you input it again?\n\n")
q1()
def q2():
a2 = input("How many states are there in The U.S.A.?\nA. 50\nB. 51\nC. 52\n\n-> ")
if a2 == "a":
print("Correct!\n\n")
q3()
elif a2 == "A":
print("Correct!\n\n")
q3()
elif a2 == "b":
print("Incorrect!\nTry again.\n\n")
q2()
elif a2 == "B":
print("Incorrect!\nTry again.\n\n")
q2()
elif a2 == "c":
print("Incorrect!\nTry again.\n\n")
q2()
elif a2 == "C":
print("Incorrect!\nTry again.\n\n")
q2()
else:
print("Sorry I didn't quite catch that, can you input it again?\n\n")
q2()
def q3():
a3 = input("What colour is the least used on flags?\nA. Orange\nB. Yellow\nC. Purple\n\n-> ")
if a3 == "a":
print("Incorrect!\nTry again.\n\n")
q3()
elif a3 == "A":
print("Incorrect!\nTry again.\n\n")
q3()
elif a3 == "B":
print("Incorrect!\nTry again.\n\n")
q3()
elif a3 == "b":
print("Incorrect! Try again.\n\n")
q3()
elif a3 == "c":
print("Correct!\n\n")
q4()
elif a3 == "C":
print("Correct!\n\n")
q4()
else:
print("Sorry I didn't quite catch that, can you input it again?\n\n")
q3()
def q4():
a4 = input("What is the capital of Sweden?\nA. Gothenburg\nB. Stockholm\nC. Malmö\n\n-> ")
if a4 == "a":
print("Incorrect!\nTry again.\n\n")
q4()
elif a4 == "A":
print("Incorrect!\nTry again.\n\n")
q4()
elif a4 == "b":
print("Correct!\n\n")
qEnd()
elif a4 == "B":
print("Correct!\n\n")
qEnd()
elif a4 == "c":
print("Incorrect!\nTry again.\n\n")
q4()
elif a4 == "C":
print("Incorrect!\nTry again.\n\n")
q4()
else:
print("Sorry I didn't quite catch that, can you input it again?\n\n")
q4()
def qEnd():
print("-=+ END +=-")
q1()
+63
View File
@@ -0,0 +1,63 @@
print("ATTENTION! This script is still being developed and will most likely have errors")
def dark_room():
print("You find yourself in an empty room")
def choice1():
choice = input("What will you do?\nLook around\nDo nothing\n> ")
if choice == ("Look around"):
print("You try to look around but you can't see a thing")
print("You find a light switch and turn it on")
light_room()
elif choice == ("Do nothing"):
print("You do nothing at all. It's very boring")
elif choice == ("idk"):
print("You could not make a choice as there was too many and thus you died")
else:
print("What was that? Try again")
choice1()
choice1()
def light_room():
print("You see that the room looks like a prison cell")
def bed_item():
bed_choice = input("You see a bed, what will you do?\nSleep\nLook under it\n> ")
if bed_choice == ("Sleep"):
print("You fall asleep and sleep until the next day")
bed_item()
elif bed_choice == ("Look under it"):
print("You find a key! You unlock the door")
hallway()
else:
print("Pardon?")
bed_item()
bed_item()
def hallway():
print("The hallway is very long. Where will you go?")
direction = input("Left\nRight\n> ")
if direction == ("Left"):
hallway_L()
elif direction == ("Right"):
hallway_R()
else:
print("You couldn't decide in time and a guard caught you and sent you back to your cell")
def hallway_L():
print("You go left and a prison guard catches you and sends you back to your cell")
def hallway_R():
print("You go to the right and find an exit door. Sadly, it's locked")
def key1():
key = input("What will you do?\nUse the key you had before\nLook around for another key\n> ")
if key == ("Use the key you had before"):
print("It doesn't work")
key1()
elif key == ("Look around for another key"):
print("You find ANOTHER key and unlock the door, you're free!")
print("(This prison has awful security)")
exit()
else:
print("I didn't quite hear you, try again")
key1()
key1()
key1()
dark_room()
+78
View File
@@ -0,0 +1,78 @@
#filename: 2example1.py
# This is all the introduction. Nothing exciting, just text to describe the situation.
print("WELCOME TO THE LUXURIOUS BEACH!")
print("You are standing on a rock with two caves in front of you and a hill behind you")
print("What will you do?")
print(" 1 ... Left cave")
print(" 2 ... Right cave")
print(" 3 ... Up the hill behind you")
# The player will be given a line starting with ">" to type in their response.
# Now, because people make typos or intentionally try to break games, the code keeps looping
# until the player types in "1" or "2" (try running the program to check this)
response = ""
while response not in ["1", "2", "3", "4"]:
response = input("> ")
# We now know for sure that they either typed "1" or "2".
# So, depending on which they typed in, we need to say if they won or not!
if response == "1":
print("You walk through the left cave.")
print("Inside you find a room full of treasure. Congratulations, you have won!")
elif response == "2":
print("You walk through the right cave.")
print("Inside you find a room containing a giant tiger! The tiger licks his lips and then pounces.")
print("You are dead. Game over...")
elif response == "3":
print ("You walk up the hill.")
print ("There is nothing there. That was boring.")
print ("You try to walk back down but you slip.")
elif response == "4":
print ("Is this a secret?")
print("Yes or No. Please use a capital letter at the start, or would not work.any")
response2 = ""
while response2 not in ["Yes", "No", "yes", "no"]:
response2 = input(">> ")
if response2 == "Yes":
print("Wow this is a secret. You just typed in the number 4 and got here or you inspected the code to find this hidden \nstring")
print("Wow.")
elif response2 == "No":
print("Oh ok")