-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsudoku.py
31 lines (31 loc) · 1.26 KB
/
sudoku.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sudokuengine, shittyleveling, random, utils
sudokus = []
diffs = {'easy':50,'normal':30,'hard':10}
def mainloop(args):
assert args != []
assert len(args) == 1
diffi = args[0]
if diffi in diffs.keys():
diff = diffs.get(diffi)
else:
diff = random.randint(5,50)
diffi = 'random'
puzzle = sudokuengine.random_puzzle(diff)
sudokus.append(puzzle)
print(''.join(sudokuengine.solve(puzzle).values()))
return 'Difficulty: '+diffi+'\n'+'\n'.join(sudokuengine.display(sudokuengine.grid_values(puzzle)))
def check(arg, author):
if arg != [] and sudokus != []:
sudoku = arg
sudoku = ''.join([(i) for i in sudoku])
if sudoku == ''.join(sudokuengine.solve(sudokus[-1]).values()):
ath = shittyleveling.Leveling(author)
vals = ath.ReadValues()
crntxp = int(vals[1])
ath.UpdateValues(crntxp+10, 'exp')
del sudokus[-1]
return {'result':'Correct!', 'colorize': utils.Colors.green, 'embedding': True}
else:
return {'result':'Incorrect', 'colorize': utils.Colors.red, 'embedding': True}
else:
return {'result':'Nothing to check!', 'colorize': utils.Colors.red, 'embedding': True}