Rev 8077 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8077 | Rev 12987 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | F=F |
4 | F=F |
5 | Z=Z |
5 | Z=Z |
6 | r=<i>r</i> |
6 | r=<i>r</i> |
7 | 7 | ||
8 | !if $cmd=reply and $status=waiting |
8 | !if $cmd=reply and $status=waiting |
9 | reply_cnt=$[$reply_cnt+1] |
9 | reply_cnt=$[$reply_cnt+1] |
10 | !endif |
10 | !endif |
11 | try_cnt=$[$reply_cnt+1] |
11 | try_cnt=$[$reply_cnt+1] |
12 | 12 | ||
13 | # Computation of the locations of pieces |
13 | # Computation of the locations of pieces |
14 | 14 | ||
15 | !if $q=4 or $q=8 or $q=9 |
15 | !if $q=4 or $q=8 or $q=9 |
16 | 16 | ||
17 | field=notprime |
17 | field=notprime |
18 | !read data/qpuzzle/table.F$q |
18 | !read data/qpuzzle/table.F$q |
19 | !for x = 0 to $q-1 |
19 | !for x = 0 to $q-1 |
20 | !if $x<=1 |
20 | !if $x<=1 |
21 | el$x=$x |
21 | el$x=$x |
22 | !else |
22 | !else |
23 | el$x=$r<sup>$[$x-1]</sup> |
23 | el$x=$r<sup>$[$x-1]</sup> |
24 | !endif |
24 | !endif |
25 | !for y = 0 to $q-1 |
25 | !for y = 0 to $q-1 |
26 | s=!item $a11+1 of $(mul$x) |
26 | s=!item $a11+1 of $(mul$x) |
27 | t=!item $a12+1 of $(mul$y) |
27 | t=!item $a12+1 of $(mul$y) |
28 | x1=!item $s+1 of $(add$t) |
28 | x1=!item $s+1 of $(add$t) |
29 | x1=!item $x1+1 of $(add$xt) |
29 | x1=!item $x1+1 of $(add$xt) |
30 | 30 | ||
31 | s=!item $a21+1 of $(mul$x) |
31 | s=!item $a21+1 of $(mul$x) |
32 | t=!item $a22+1 of $(mul$y) |
32 | t=!item $a22+1 of $(mul$y) |
33 | y1=!item $s+1 of $(add$t) |
33 | y1=!item $s+1 of $(add$t) |
34 | y1=!item $y1+1 of $(add$yt) |
34 | y1=!item $y1+1 of $(add$yt) |
35 | 35 | ||
36 | s=!item $r11+1 of $(mul$x1) |
36 | s=!item $r11+1 of $(mul$x1) |
37 | t=!item $r12+1 of $(mul$y1) |
37 | t=!item $r12+1 of $(mul$y1) |
38 | xx=!item $s+1 of $(add$t) |
38 | xx=!item $s+1 of $(add$t) |
39 | xx=!item $xx+1 of $(add$xr) |
39 | xx=!item $xx+1 of $(add$xr) |
40 | 40 | ||
41 | s=!item $r21+1 of $(mul$x1) |
41 | s=!item $r21+1 of $(mul$x1) |
42 | t=!item $r22+1 of $(mul$y1) |
42 | t=!item $r22+1 of $(mul$y1) |
43 | yy=!item $s+1 of $(add$t) |
43 | yy=!item $s+1 of $(add$t) |
44 | yy=!item $yy+1 of $(add$yr) |
44 | yy=!item $yy+1 of $(add$yr) |
45 | 45 | ||
46 | n$(xx)_$yy=$x.$y |
46 | n$(xx)_$yy=$x.$y |
47 | !next y |
47 | !next y |
48 | !next x |
48 | !next x |
49 | 49 | ||
50 | s=!item $r11+1 of $(mul$r22) |
50 | s=!item $r11+1 of $(mul$r22) |
51 | t=!item $r21+1 of $(mul$r12) |
51 | t=!item $r21+1 of $(mul$r12) |
52 | !for i = 1 to $q |
52 | !for i = 1 to $q |
53 | j=!item $i of $(add$t) |
53 | j=!item $i of $(add$t) |
54 | !if $j = $s |
54 | !if $j = $s |
55 | det=!eval $i-1 |
55 | det=!eval $i-1 |
56 | break |
56 | break |
57 | !endif |
57 | !endif |
58 | !next i |
58 | !next i |
- | 59 | ||
- | 60 | !else q=p |
|
59 | 61 | ||
60 | !else q=p |
- | |
61 | - | ||
62 | field=prime |
62 | field=prime |
63 | !for x = 0 to $q-1 |
63 | !for x = 0 to $q-1 |
64 | el$x=$x |
64 | el$x=$x |
65 | !for y = 0 to $q-1 |
65 | !for y = 0 to $q-1 |
66 | x1=($a11*$x+$a12*$y+$xt)%$q |
66 | x1=($a11*$x+$a12*$y+$xt)%$q |
67 | y1=($a21*$x+$a22*$y+$yt)%$q |
67 | y1=($a21*$x+$a22*$y+$yt)%$q |
68 | xx=!eval ($r11*$x1+$r12*$y1+$xr)%$q |
68 | xx=!eval ($r11*$x1+$r12*$y1+$xr)%$q |
69 | yy=!eval ($r21*$x1+$r22*$y1+$yr)%$q |
69 | yy=!eval ($r21*$x1+$r22*$y1+$yr)%$q |
70 | n$(xx)_$yy=$x.$y |
70 | n$(xx)_$yy=$x.$y |
71 | !next y |
71 | !next y |
72 | !next x |
72 | !next x |
73 | det=!eval ($r11*$r22-$r21*$r12)%$q |
73 | det=!eval ($r11*$r22-$r21*$r12)%$q |
74 | 74 | ||
75 | !endif q or p |
75 | !endif q or p |
76 | 76 | ||
77 | !if $det = 0 |
77 | !if $det = 0 |
78 | !for x = 0 to $q-1 |
78 | !for x = 0 to $q-1 |
79 | !for y = 0 to $q-1 |
79 | !for y = 0 to $q-1 |
80 | !if $(n$(x)_$y) = $empty |
80 | !if $(n$(x)_$y) = $empty |
81 | n$(x)_$y = bad |
81 | n$(x)_$y = bad |
82 | !endif |
82 | !endif |
83 | !next y |
83 | !next y |
84 | !next x |
84 | !next x |
85 | !endif |
85 | !endif |
86 | 86 | ||
87 | !if $n0_0=0.0 and $n1_0=1.0 and $n0_1=0.1 and $status=waiting and $reply_cnt>0 |
87 | !if $n0_0=0.0 and $n1_0=1.0 and $n0_1=0.1 and $status=waiting and $reply_cnt>0 |
88 | found=yes |
88 | found=yes |
89 | wims_module_log=success after $reply_cnt tries from $httpd_REMOTE_HOST |
89 | wims_module_log=success after $reply_cnt tries from $httpd_REMOTE_HOST |
90 | wims_print_precision=4 |
90 | wims_print_precision=4 |
91 | module_score=$[10*($q-1)/$reply_cnt] |
91 | module_score=$[10*($q-1)/$reply_cnt] |
92 | !if $module_score>10 |
92 | !if $module_score>10 |
93 | module_score=10 |
93 | module_score=10 |
94 | !endif |
94 | !endif |
95 | status=found |
95 | status=found |
96 | !endif |
96 | !endif |
97 | 97 | ||
98 | !if $cmd=help |
98 | !if $cmd=help |
99 | hdcolor=style="background-color:#D0D060" |
99 | hdcolor=style="background-color:#D0D060" |
100 | opcolor=style="background-color:#A0A0A0" |
100 | opcolor=style="background-color:#A0A0A0" |