Prepare Capital Quest public edition and player manual
This commit is contained in:
1 parent
46f4b9cae0
commit
afa6f3c2a0
40 files changed
+1072
-106
No files matched your search
@@ -3,10 +3,11 @@ from pathlib import Path
|
||||
import runpy,json,sys,uuid
|
||||
from pathlib import Path
|
||||
sys.path.insert(0,str(Path(__file__).parent));from framebuffer import Screen,ROOT,shuffle,EVIDENCE
|
||||
from map_colors import check_map_colors
|
||||
c=runpy.run_path(str(Path(__file__).with_name('playtest_support.py')));state=json.load(open(os.environ['CAPITAL_TEST_STATE']))
|
||||
r=c['call']('start_playtest',dict(project_id=state['cap']['project_id'],revision=state['cap']['revision'],artifact_id=state['artifact']['artifact_id'],request_id=str(uuid.uuid4())))
|
||||
run=r['run_id'];state['typed_run']=r;Path(os.environ['CAPITAL_TEST_STATE']).write_text(json.dumps(state))
|
||||
rows=[x.split('\t') for x in (ROOT/'data/states.tsv').read_text().splitlines()];order,_=shuffle();report=[];score=corrections=0
|
||||
rows=[x.split('\t') for x in (ROOT/'data/states.tsv').read_text().splitlines()];order,_=shuffle();report=[];score=corrections=0;outcomes={}
|
||||
|
||||
def press(k,hold=4,settle=12):return c['key'](run,k,hold,settle)
|
||||
def settle():c['inp'](run,[{'keys':[],'fields':600},{'keys':[],'fields':300}])
|
||||
@@ -24,15 +25,17 @@ settle();c['key'](run,'2',8,600);settle();c['inp'](run,[dict(keys=['shift','0'],
|
||||
# First alias in mixed case. Capture input before submission to verify the real keys.
|
||||
type_text('sT pAuL');s=cap('typed-alias-input');print('input=',s.text(8,158,45),flush=True)
|
||||
assert s.text(8,158,45)=='sT pAuL_',s.text(8,158,45)
|
||||
check_map_colors(s,order[0],outcomes)
|
||||
press('enter',8,600);s=cap('typed-alias-feedback');assert s.text(8,158,30)=='CORRECT!',s.text(8,158,30)
|
||||
c['inp'](run,[dict(keys=[],fields=300)]);s=cap('typed-feedback-waits')
|
||||
assert s.text(8,19,45)=='Question 1 of 50 Score 1'
|
||||
assert s.text(8,183,48)=='Release your key, then SPACE to continue.'
|
||||
score=1;report.append(dict(question=1,code='MN',answer='sT pAuL',correct=True,correction=False));c['key'](run,'space',8,600);settle()
|
||||
score=1;outcomes[order[0]]=True;report.append(dict(question=1,code='MN',answer='sT pAuL',correct=True,correction=False));c['key'](run,'space',8,600);settle()
|
||||
for q in range(1,50):
|
||||
st=order[q];code,name,capital=rows[st];s=cap(f'typed-q{q+1:02d}-{code}')
|
||||
assert s.text(8,19,45)==f'Question {q+1} of 50 Score {score}',(q,s.text(8,19,45),score)
|
||||
assert s.text(8,145,50)==name+': what is its capital?'
|
||||
check_map_colors(s,st,outcomes)
|
||||
spelling=False;right=True
|
||||
if q==1 or code=='CO':
|
||||
# Adjacent transpositions, followed by a real Backspace correction.
|
||||
@@ -64,6 +67,7 @@ for q in range(1,50):
|
||||
assert s.text(8,170,50)==f'The capital is {capital}.'
|
||||
if right:score+=1
|
||||
if spelling:corrections+=1
|
||||
outcomes[st]=right
|
||||
report.append(dict(question=q+1,code=code,answer=answer,correct=right,correction=spelling))
|
||||
c['key'](run,'space',8,600)
|
||||
if q!=49:settle()
|
||||
|
||||
Reference in new issue
Block a user