Professional Documents
Culture Documents
Computer Project Main
Computer Project Main
-A digital adventure…
Submitted by: -
Thejas Bhat, Roll Number: 45
Samuel Mendonca, Roll Number: 33
Mohammad Rayyan Sheikh, Roll Number: 21
Submitted to: -
Tr. Shilpa A G
Computer Teacher
1. Acknowledgement 1
2.
Introduction 2
3. Algorithm 3
6. Conclusion 20
7. Bibliography 21
Acknowledgement
1
Introduction
The main aim and purpose of the game “Code of
Eternity” is to help its players understand the basics of a
computer in a better way through an entertaining and
fun medium. This game is entirely text based and is easy
to understand as well.
Some features of our game and its source code are stated
below:
It mainly uses dictionaries, nested loops etc.
The game progresses dynamically without a screen
clogged with text.
Includes some NPCs who offer a lively and interactive
setting to the player.
Unique and various map locations for the player to
explore.
Different puzzles and riddles that can enhance the
player’s knowledge of topics like logic gates, dry
running etc.
2
Algorithm
Step 1: - Devise the plot of the story.
Step 2: - Think of the main mechanics of the game.
Step 3: - Create a well-defined and easy to use map.
Step 4: - Initialize all the player variables, locations, and
attributes.
Step 5: - Implement all the locations onto the map.
Step 6: - Find ways to travel through the map and its
various locations.
Step 7: - Introduce other characters into the game and
give them certain roles in the player’s journey.
Step 8: - Make a while loop that weaves all the mechanics
and above statements.
Step 9: - Play the game and ensure that it is in accordance
with your vision.
3
Source Code
import os
# Player Variables
current_realm = 'scriptoria central' current_location = 'start'
inventory=[]
seen_map False
visited_locations = {'scriptoria central':['start'], ···
quests=['unlock hall']
health=10
coins=0
#Help List
commands = [
"look(1) Examine your surroundings.",
"look at [item] Examine a specific item.",
"go [direction] - Move in the specified direction (north, south, east, west).", "take
[item] - Pick up an item.",
"use - Use an item in your inventory.",
"inventory (i) - Check the items you have.",
"map(m) - Display a map of Scriptoria.",
"health (h) - Display current health.",
"clear(c) - Clear the screen.",
"exit(q) - Exit the game."
]
Command_aliases = {
"i": "inventory",
"1": "look"
"q": "exit",
"m": "map",
"c": "clear",
"h": "health"
}
# Descriptions of specific items
4
items = {···
# Location data: descriptions, items, and exits
realm_transitions= {···
realms = {
'scriptoria central': {
'name': 'Scriptoria Central',
'locations': {
'start': {···
'hall': {···
'garden': {···
'cryptic cave': {···
'pixel pond': {···
'algorithm arena': {···
'loop labyrinth': {···
'echo cave': {···
'code fountain': {···
'binary balcony': {···
}
},
'recursive realm': {
'name': 'Recursive Realm'
'locations': {
'recursion riviera': {···
'function forest': {···
'loop lagoon': {···
'base case beach': {···
'call stack cliffs': {···
'tail trench': {···
'memoization meadows': {···
'iterative inn': {···
'dynamic dale': {···
'fractal fountain': {···
}
},
'binary battlegrounds': {
5
'name': 'Binary Battlegrounds',
'locations': {
'bit bastion': {···
'logic lane': {··· 'byte boulevard': {···
'shift stronghold': {···
'logic gate grove': {···
'twos complement cove': {··· 'endian estate': {···
'hex haven': {···
'parity plaza': {···
'overflow oasis': {···
}
},
'variable valleys': {
'name': 'Variable Valleys',
'locations': {
'scope springs': {···
'immutable isle': {···
'string stream': {···
'boolean bluffs': {···
'numeric nook': {···
'array archipelago': {···
'tuple terrace': {···
'list lagoon': {···
'set summit': {···
'dictionary delta': {···
}
},
'' : {
'name':
'locations': {
}
}
}
# Introduction texts
6
intro_texts=[ ...
for text in intro_texts: ...
os.system('cls' if os.name == 'nt' else 'clear')
# Introduce Controls
print(''' ...
==
7
input("\nPress Enter to continue...")
# Introduce Puzzles
print("\nAlgo: The realm of Scriptoria is filled with challenges and riddles. \n\
input("\nPress Enter to continue...")
os.system('cls' if os.name == 'nt' else 'clear')
# 1. Fragmented Memory Reconstruction
print("\nAlgo: Firstly, you might come across fragmented memories.")
print("Example: 'the ... discovered ... Byte ... secret chamber ... within
Scriptoria.'")
input("Rearrange the fragments to form a coherent sentence (All lowercase works
as well): \n").strip()
if answer.lower() == "byte discovered the secret chamber within scriptoria.":···
else: ...
input("\nPress Enter to continue...")
os.system('cls' if os.name == 'nt' else 'clear')
# Logic Gate Challenge
print("\nAlgo: Now, let's test your understanding of logic gates. Here's an AND
Gate challenge.\n\··· while True:
input("\nPress Enter to continue...")
os.system('cls' if os.name == 'nt' else 'clear')
# 3. Coding Decipher
print('''\nAlgo: Ancient code scripts lie hidden. Deciphering them could reveal
secrets. \n\ answer = input("Given the above code, what is the value of mystery
(5)? ")
if answer == '120': # 5 factorial
print("Algo: Brilliant! That's the spirit. \n\
The function you deciphered is a recursive implementation of factorial
calculation.")
else:
print("Algo: Not quite. The function is actually computing factorials using
recursion. \n\ mystery(5) computes 5 factorial, which is 5 x 4 x 3 x 2 x 1 = 120.")
input("\nPress Enter to continue...")
os.system('cls' if os.name == 'nt' else 'clear')
# 4. Narrative Riddle
print("\nAlgo: Last but not least, riddles might guard important areas or items.")
answer input("Without me, software's just a wish. \n\......
if answer == "code": ...
8
else: ...
input("\nPress Enter to continue...")
os.system('cls' if os.name == 'nt' else 'clear')
#villain encounter
narrative = [ ---
for segment in narrative: ...
os.system('cls' if os.name == 'nt' else 'clear')
print("Algo: The AND gate will output true (1) only if BOTH its inputs are true (1). \
n\···
#get outta the cocoon
attempts = 3
while attempts > 0: ···
for text in ['Algo: The corrupted minion has been vanquished, but our path to the
north remains sealed.', ···
input(text)
os.system('cls' if os.name 'nt' else 'clear')
#Map Dimensions
map_size = 5
half_size
map_size // 2
# Main game loop
while True:
if health<=0: ...
action = input("What do you want to do? ").lower()
if action in command_aliases:···
# Handle game exit
if action == "exit":···
#Help command
elif action ==
"help": ...
elif action ==
"map": ...
# Handle map display
# Handle movement
elif action.startswith("go "):
direction = action.split("go")[1].strip()
if direction=='north' and current_location=='start':···
9
if direction in realms[current_realm]['locations'][current_location]\
['exits']:
current_location=realms[current_realm][‘locations’]\
[current_location][‘exits’][direction]
if current_location not in visited_locations[current_realm]:
elif current_location=='garden': ···
elif current_location=='hall': ···
elif current_location== 'code fountain':···
elif current_location=='cryptic cave': ···
elif current_location== 'loop labyrinth': ···
visited_locations \
[current_realm].append(current_location)
#display map anyways lmao
if seen_map: ···
print(realms[current_realm]['locations'][current_location]\
['description’]
else:
print(f"You can't go {direction} from here.")
#Inspect specific item
elif "look" at in action: ...
# General look around
elif "look" in action: ...
# Handle picking up items
elif action.startswith("take "):...
#Use [anything] handling
elif action.strip() == 'use':
use_inv=True
current_location_data = realms[current_realm]['locations']\
[current_location]
if 'transition_gate' in current_location_data:···
10
if use_inv:
for index,item in enumerate(inventory,1):···
print(f'{index+1}. Exit')
Choice2 = input("Enter Item Number: ")
if choice2.isdigit() and 1 <= int(choice2) <= len (inventory): ···
elif choice2.isdigit() and int(choice2)==index+1: ···
else: ···
Current_location_data = realms[current_realm]['locations']
\[current_location]
teleport_crystals = {···
if item_name == "universal teleporter" and item_name in
inventory:
if item_name=='a coding tome' and current_location==\
'garden': ···
if item_name=='debug': ···
if item_name=='cipheras note': ···
if item_name=='ottos shop': ···
if item_name=='challengers orb': ···
#budget intrarealm teleport
current_realm_name = realms [current_realm]['name'].lower()
if item_name in teleport_crystals.values() and item_name in\
inventory: ···
else: ···
# Check inventory
elif action == "inventory": ···
# check currency
elif action == 'currency' : ···
# Check health
elif action=="health": ···
# Clear screen
elif action == "clear": .......
else: ...
11
# link to actual source code
https://drive.google.com/file/d/1NfeLtk3BDOdsyVOon06i59j6lVmmOgat/view
12
Output
We have added the main highlights and instances from the game.
Here, we have displayed a small portion of the tutorial part. And the list
of commands
13
14
Some gameplay: -
15
The in-game map in display
16
Interactive puzzles and currency intro
17
Unlocking the shop
Final fight
18
End screen
Conclusion
19
and interfaces. This experience has not only highlighted
Python's versatility but also reinforced the significance of
collaboration in achieving shared goals. It has been an
enriching adventure that deepened our appreciation for
both coding and teamwork alike.
Bibliography
We developed this game mostly by ourselves using our
own knowledge and the only external references we took
were from old story based single player games like the
Pokémon series.
Some links which give you information about the game
references which we have used and played have been
credited below: -
20
https://en.wikipedia.org/wiki/Pok
%C3%A9mon_FireRed_and_LeafGreen
https://en.wikipedia.org/wiki/Pok
%C3%A9mon_Ruby_and_Sapphire
21