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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# -*- coding: utf-8 -*-
print("====================================_____________________=============")
print("===== ReckonPrimer.tests/expassten/test_generate_calc.py =============")
from expassten import ExPassTen
_sett = {'topic' : 'passten',
'calclines' : 1, # or 2 iff 'newline' : True.
'MAX' : 150, # maximum of calcs generated;
# TODO: Generate fills up by varying input.
'MIN' : 10, # minimum of calcs generated 090416WN:UNUSED
'+' :True, # + crossing the ten barrier!!
'-' :False, # - goes below the ten barrier!!!
# (i.e. iteration on left arg. is "outer" loop)
'min' : 3, # +: minimum in size of number in left argument
#'min' : 5, # +: minimum in size of number in left argument
# -: minimum in size of result
'max' : 3, # +: maximum in size of number in left argument
# -: maximum in size of result
#'max' : 9, # +: maximum in size of number in left argument
'input' :[3], # list of positions in calc 3 | 5
# where input is possible;
# actual positions chosen by Generate.
'newline' : True, # display 2nd line for intermediate results
'shuffle_all' : False, # shuffle all calcs
'shuffle_inner': False, # shuffle only 1st (inner) iteration
'cut-max' : True # cut set of all calcs down to MAX
}
_ex = ExPassTen(None)
_ex.update_setting(_sett)
for _i in range(0, _ex.count()):
_calc = _ex.get_next_calc()
print('calc=',_calc)
_form = _ex.format(_calc)
print('form=',_form)
"""
('calc=', (['3', '+', '9', '=', '1', '2'], ['7', '2'], 3))
('form=',
([# list of lines to be shown before input begins
[' ', ' ', ' ', ' ', '3', ' ', '+', ' ', '_', ' ', '=', ' ', '1', '2'],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', '_', '+', '_', ' ', ' ', ' ', ' ']],
[# list of tuples, each tuple for _one_ input of _one_ digit
(0, 8, '9', '3+_=12', '3+9=12',
#^ line no.
#^ column no.
#^ correct input
#^ protocol ???
#^ protocol ???
[' ', ' ', ' ', ' ', '3', ' ', '+', ' ', '9', ' ', '=', ' ', '1', '2']),
(1, 9, '2', '3+(7+_)=12', '3+(7+2)=12',
[' ', ' ', ' ', ' ', ' ', ' ', ' ', '7', '+', '2', ' ', ' ', ' ', ' ']),
(1, 7, '7', '3+(_+_)=12', '3+(7+_)=12',
[' ', ' ', ' ', ' ', ' ', ' ', ' ', '7', '+', '_', ' ', ' ', ' ', ' '])]))
...
"""
print("===== ReckonPrimer.tests/expassten/test_generate_calc.py =============")
print("=========================== SUCCESS ~~~~~~~~~~~~~~~~~~~~==============")
|