Subversion Repositories wimsdev

Rev

Rev 14516 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
23 reyssat 1
files=!record 1 of scenarios/$thisexo.def/.files
2
files=!words2items $files
3
file=!randitem $files
4
 
5
deffile=scenarios/$thisexo.def/$file
6
allcnt=!recordcnt $deffile
7
header=!record 1 of $deffile
8
header=!trim $header
9
hcnt=!linecnt $header
10
cc=1
11
!for i=7 to $hcnt
14516 bpr 12
  l=!line $i of $header
13
  !if @ notin $l
14
    r$cc=!randitem $l
15
    !advance cc
16
  !else
17
    l=!translate @ to $\
23 reyssat 18
$ in $l
14516 bpr 19
    l=!trim $l
20
    l1=!line 1 of $l
21
    c1=!itemcnt $l1
22
    s=!randint 1,$c1
23
    lc=!linecnt $l
24
    !for j=1 to $lc
25
      lj=!line $j of $l
26
      r$cc=!item $s of $lj
27
      !advance cc
28
    !next j
29
  !endif
23 reyssat 30
!next i
31
 
32
presentation=!record 2 of $deffile
33
good=!record 3 of $deffile
34
traps=!record 4 of $deffile
35
remarks=!record 5 of $deffile
36
reserved=!record 6 of $deffile
37
good=!trim $good
38
!distribute lines $header into title,author,amail,translator,tmail,format
39
!distribute items $ into bad_1,bad_2,bad_3,bad_4,bad_5,bad_6,bad_7,bad_8,bad_9,bad_10,bad_11,bad_12
40
scorecnt=0
41
 
42
!for i=7 to $allcnt
14516 bpr 43
  t=!record $i of $deffile
44
  s=!item 1 of $t
45
  bad_$s=!append item $i to $(bad_$s)
23 reyssat 46
!next i
47
 
48
!if $sstyle=1
14516 bpr 49
  r=!random 0,1
50
  !distribute item $ into bad_steps, bad_reasons
51
  !if $r<0.75
52
    t=!randint 7, $allcnt
53
    t=!record $t of $deffile
54
    !distribute lines $t into l,bad_reason
55
    s=!item 1 of $l
56
    tt=!line 3 to -1 of $t
57
    picked=!line 1 to $s-1 of $good
58
    picked=!append line $tt to $picked
59
    n=!itemcnt $l
60
    !for i=1 to $n/2
61
      s1=!item 2*$i-1 of $l
62
      s2=!item 2*$i of $l
63
      bad_steps=!append item $s1 to $bad_steps
64
      bad_reasons=!append item $s2 to $bad_reasons
65
    !next i
66
  !else
67
    picked=$good
68
  !endif
69
  stepcnt=!linecnt $picked
70
  step=$stepcnt
23 reyssat 71
!else
14516 bpr 72
  step=1
73
  stepcnt=!linecnt $good
74
  !read scenario/var.step
23 reyssat 75
!endif
76
 
77
status=waiting
78
substep=0