Rev 535 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 535 | Rev 12987 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | !read data/qpuzzle/photindex |
4 | !read data/qpuzzle/photindex |
5 | 5 | ||
6 | # check value of q |
6 | # check value of q |
7 | q=!eval floor($q) |
7 | q=!eval floor($q) |
8 | !if $q = NaN or $q < 2 or $q > 11 or $q = 6 or $q = 10 |
8 | !if $q = NaN or $q < 2 or $q > 11 or $q = 6 or $q = 10 |
9 | q= |
9 | q= |
10 | !endif |
10 | !endif |
11 | 11 | ||
12 | reply_cnt=0 |
12 | reply_cnt=0 |
13 | !default q=3 |
13 | !default q=3 |
14 | # Reset reply values. |
14 | # Reset reply values. |
Line 22... | Line 22... | ||
22 | xt=!randint 0,$q-1 |
22 | xt=!randint 0,$q-1 |
23 | yt=!randint 0,$q-1 |
23 | yt=!randint 0,$q-1 |
24 | 24 | ||
25 | :randmatrix |
25 | :randmatrix |
26 | !for x=1 to 2 |
26 | !for x=1 to 2 |
27 | !for y=1 to 2 |
27 | !for y=1 to 2 |
28 | a$x$y=!randint 0,$q-1 |
28 | a$x$y=!randint 0,$q-1 |
29 | !next y |
29 | !next y |
30 | !next x |
30 | !next x |
31 | 31 | ||
32 | # If matrix is non invertible: redo random |
32 | # If matrix is non invertible: redo random |
33 | !if $q=4 or $q=8 or $q=9 |
33 | !if $q=4 or $q=8 or $q=9 |
34 | !read data/qpuzzle/table.F$q |
34 | !read data/qpuzzle/table.F$q |
35 | s=!item $a11+1 of $(mul$a22) |
35 | s=!item $a11+1 of $(mul$a22) |
36 | t=!item $a21+1 of $(mul$a12) |
36 | t=!item $a21+1 of $(mul$a12) |
37 | !ifval $s = $t |
37 | !ifval $s = $t |
38 | !goto randmatrix |
38 | !goto randmatrix |
39 | !endif |
39 | !endif |
40 | !else |
40 | !else |
41 | det=!eval ($a11*$a22-$a21*$a12)%$q |
41 | det=!eval ($a11*$a22-$a21*$a12)%$q |
42 | !if $det = 0 |
42 | !if $det = 0 |
43 | !goto randmatrix |
43 | !goto randmatrix |
44 | !endif |
44 | !endif |
45 | !endif |
45 | !endif |
46 | 46 | ||
47 | # Identity matrix is too trivial. |
47 | # Identity matrix is too trivial. |
48 | !if $a11=1 and $a22=1 and $a12=0 and $a21=0 |
48 | !if $a11=1 and $a22=1 and $a12=0 and $a21=0 |
49 | !goto randmatrix |
49 | !goto randmatrix |
50 | !endif |
50 | !endif |
51 | 51 | ||
52 | # choose photo |
52 | # choose photo |
53 | n=!itemcnt $photolist |
53 | n=!itemcnt $photolist |
54 | !if $model = $empty or $model = random |
54 | !if $model = $empty or $model = random |
55 | i=!randint 1,$n |
55 | i=!randint 1,$n |
56 | photoname=!item $i of $photolist |
56 | photoname=!item $i of $photolist |
57 | photoright=!item |
57 | photoright=!item $i of $photorights |
58 | !else |
58 | !else |
59 | model=!word 1 of $model |
59 | model=!word 1 of $model |
60 | photoname=$model |
60 | photoname=$model |
61 | !for i=1 to $n |
61 | !for i=1 to $n |
62 | na=!item $i of $photolist |
62 | na=!item $i of $photolist |
63 | !if $na=$model |
63 | !if $na=$model |
64 | photoright=!item |
64 | photoright=!item $i of $photorights |
65 | !break |
65 | !break |
66 | !endif |
66 | !endif |
67 | !next i |
67 | !next i |
68 | !endif |
68 | !endif |
69 | 69 | ||
70 | wims_module_log=$cmd: $photoname F$q |
70 | wims_module_log=$cmd: $photoname F$q |
71 | status=waiting |
71 | status=waiting |
72 | found=no |
72 | found=no |
73 | - |