File: puzzle

package info (click to toggle)
wims 2%3A4.29a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,704 kB
  • sloc: xml: 366,687; javascript: 120,570; ansic: 62,341; java: 62,170; sh: 7,744; perl: 3,937; yacc: 3,217; cpp: 1,915; lex: 1,805; makefile: 1,084; lisp: 914; pascal: 601; python: 520; php: 318; asm: 7
file content (88 lines) | stat: -rw-r--r-- 1,899 bytes parent folder | download | duplicates (3)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
option:text

!if $lang=fr
  !set name_searchmore=... cherchez un peu plus
!else
  !set name_searchmore=... you should search a little more
!endif

!if $wims_read_parm=nocompare
  !exit
!endif

reply=$(reply$i)
replyurl=$(reply[2;])
reply$i=$(reply[1;])
repclic=$(reply[3;])

!set answer=!lines2rows $(replygood$i)
!set answer=!lines2rows $answer
!set N=!line 3 of $(oef_answer_option$i)
!distribute items $N into ny,nx,width,height
!set nb_im=$[$nx*$ny]
!set test=!line 1 of $(oef_answer_option$i)
!set rep=$(reply$i)
!set good_url=!line 2 of $(oef_answer_option$i)

!set test=!nospace $test
!set rep=!nospace $rep

!set diff=
!for a = 1 to $nb_im
  !if $(test[$a])=$(rep[$a])
    !set diff=!append item 1 to $diff
  !else
    !set diff=!append item 0 to $diff
  !endif
!next
!if $test issametext $rep
  score=1
!else
  score=0
!endif
!read anstype/puzzle_css.inc

!if text notwordof $(replyoption$i)
  !set row_style=$empty
!else
  !set row_style=style="flex-wrap:wrap"
!endif

!set r_out=$empty
!set g_out=$empty
!for y=1 to $ny
  r_out=$r_out <div class="puzzle_row" $row_style>
  g_out=$g_out <div class="puzzle_row" $row_style>
  !for x=1 to $nx
    !set t_rep=!item $[$x+($y-1)*($nx)] of $replyurl
    !set t_good=!item $[$x+($y-1)*($nx)] of $good_url
    !if $t_rep issametext $t_good
      !set t_class=oef_indgood
    !else
      !set t_class=oef_indbad
    !endif
    !set r_out=$r_out\
    <div class="puzzle_piece $t_class" style="width:$(width)px;height:$(height)px">$t_rep</div>

    !set g_out=$g_out\
    <div class="puzzle_piece oef_indgood" style="width:$(width)px;height:$(height)px">$t_good</div>
  !next x
  r_out=$r_out </div>
  g_out=$g_out </div>
!next y

m_reply$i=$diff

reply_$i=$r_out
!if $repclic > 2
  replyGood$i=$g_out
!else
  replyGood$i=&nbsp; $name_searchmore
!endif
reply__$i=&nbsp;
!if $score=1
  diareply$i=good
  !advance freegot
!else
  diareply$i=bad
!endif