Added some documentation so whoever's working on this isn't entirely in the dark
This commit is contained in:
13
game.py
13
game.py
@ -7,6 +7,11 @@ import random
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
def normalDist(difficulty):
|
def normalDist(difficulty):
|
||||||
|
"""
|
||||||
|
This function generates a random number between 0-1
|
||||||
|
that should be used to get a font with a difficulty
|
||||||
|
equal to or less than the number returned.
|
||||||
|
"""
|
||||||
# Create a random number between 0-1
|
# Create a random number between 0-1
|
||||||
v = random.randint(-1000, 1000) / 1000
|
v = random.randint(-1000, 1000) / 1000
|
||||||
# Redistribute the number
|
# Redistribute the number
|
||||||
@ -40,6 +45,9 @@ class Game(gameUtils.Game):
|
|||||||
|
|
||||||
self.fonts = {}
|
self.fonts = {}
|
||||||
|
|
||||||
|
# I haven't finished this yet, you might want to create
|
||||||
|
# an object or something, I don't know. Keep in mind you
|
||||||
|
# have to load all of the font files for use later.
|
||||||
with open(f'./fonts/fonts.json', 'r') as f:
|
with open(f'./fonts/fonts.json', 'r') as f:
|
||||||
j = json.loads(f.read())
|
j = json.loads(f.read())
|
||||||
|
|
||||||
@ -47,6 +55,11 @@ class Game(gameUtils.Game):
|
|||||||
# self.fonts.update()
|
# self.fonts.update()
|
||||||
|
|
||||||
def createCaptcha(self):
|
def createCaptcha(self):
|
||||||
|
"""
|
||||||
|
Use PIL (https://pillow.readthedocs.io/en/stable/handbook/tutorial.html)
|
||||||
|
to draw the fonts, add noise, random shapes, transforms etc. based on
|
||||||
|
self.gameDifficulty
|
||||||
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def onEvent(self, event):
|
def onEvent(self, event):
|
||||||
|
|||||||
Reference in New Issue
Block a user