-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinput.py
47 lines (39 loc) · 1.09 KB
/
input.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
size = int(input("Size (or sudoku)?"))
blocks = []
cells = []
if size == 'sudoku':
print "Awaiting sudoku set values..."
while True:
b = []
v = raw_input("Value?")
if v == "": break
b.append("%s=" % (v,))
c_str = raw_input("Cell?")
if c_str == "": break
c = tuple(int(i) for i in c_str.split(','))
if c in cells:
print "WTF?"
continue
b.append(c)
cells.append(c)
blocks.append(b)
else:
print "Awaiting mathdoku conditions and blocks..."
max_cells = size**2
while len(cells)<max_cells:
b = []
blocks.append(b)
cond = raw_input("Condition?")
b.append(cond)
while True:
c_str = raw_input("Cell?")
if c_str == "": break
c = tuple(int(i) for i in c_str.split(','))
if c in cells:
print "WTF?"
continue
b.append(c)
cells.append(c)
name = raw_input("Name?")
print """add(%s, %s,
*%s)""" % (repr(name), repr(size), repr(blocks))