So I started working on the main code of the game, which is on Python.
I'm using MongoDB as the database.
Code
So I made a collection to hold the degrees stats (I had already defined usersdb
:
degreescol = usersdb.Degrees
Then I made a function to get all the degrees a user is either preparing for or have completed:
def getdegrees(username):
myquery = { "Username": username }
mydoc = degreescol.find(myquery)
jobs = []
for x in mydoc:
jobs.append(x)
return jobs
Then I made 2 functions: one for only getting the degrees a user is preparing for, and the other for only getting the degrees they have finished:
def getpreparingdegrees(username):
myquery = { "Username": username }
mydoc = degreescol.find(myquery)
jobs = []
for x in mydoc:
jobs.append(x)
preparing = []
for x in jobs:
if x['Status'] == False:
preparing.append(x)
return preparing
def getfinisheddegrees(username):
myquery = { "Username": username }
mydoc = degreescol.find(myquery)
jobs = []
for x in mydoc:
jobs.append(x)
preparing = []
for x in jobs:
if x['Status'] == True:
preparing.append(x)
return preparing
Then I made a new Python file called lists.py
to store some lists, the first two being jobs and degrees:
jobs = []
degrees = []
Jobs and Degrees
Then I decided to think of some jobs which you could get degrees for.
First I thought of the job of a crytographer, which could be an easy job to code as I could just base it on decoding and encrypting things.
So in the jobs
list in lists.py
, I added the element "cryptographer"
, and in the degrees
list in lists.py
, I added the element "cryptography"
.
Then I got clueless on what other jobs to add, so if you have any ideas on what job or degree I could have, and what type of questions or skills could be in the skill, comment below.
Thanks for reading and next time I'll be blogging about coding the cryptography
degree!