File: javacurve.bound

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 (132 lines) | stat: -rw-r--r-- 3,371 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

rlist=!translate internal ; to , in $rlist
rlist=!nonempty items $rlist
glist=!nonempty items $glist
imgtest=$(glist[1])
glist=$(glist[2..-1])
m=!itemcnt $glist
n=!itemcnt $rlist

!if $n<1
  :badrep
  reply$i=
  test=NaN
  !exit
!endif
!if $m<1
  Test=bad $i
  !exit
!endif

ifile=$image
!if $imagedir isin $image
  ifile=!translate internal / to $ $ in $ifile
  ifile=!word -1 of $ifile
!else
  !if getfile isin $image
    ifile=!translate internal =/ to $  $ in $ifile
    ifile=!word -1 of $ifile
  !else
    !if getins isin $image
      ifile=!replace internal &modif= by $ $ in $ifile
      ifile=!replace internal &+modif= by $ $ in $ifile
      ifile=!replace internal special_parm= by $ $ in $ifile
      ifile=!word 2 of $ifile
    !endif
  !endif
!endif

correct=
util=
Bon1=0
!for si = 1 to $[$m/2]
  !!on parcourt les points  cliquer
  !if NaN isin $x$y
    test=NaN
    !exit
  !endif
  !for sj=1 to $[$n/2]
     x=$[round($(rlist[2*$sj-1]))]
     y=$[round($(rlist[2*$sj]))]
     tester=bound,$imgtest,$[round($(glist[2*$si-1]))],$[round($(glist[2*$si]))]
     error_back=$wims_exec_error
     wims_exec_error=
    test=!exec clickzone $x,$y\
$tester

    test1=!line 1 of $test
    test2=!line 2 to -1 of $test
    !distribute words $test1 into i_,prec
    !if $i_=1
      correct=!append item $si to $correct
      util=!append item $sj to $util
     !reset i_
    !endif
  !next
!next

m_clickzone_error=!trim $wims_exec_error
m_clickzone_error=!line 2 to -1 of $m_clickzone_error
wims_exec_error=$error_back
correct=!listuniq $correct
Bon1=!itemcnt $correct
util1=!itemcnt $util
trop1 = $[$n/2 -$util1]
trop = $[($n -2*$util1)/$m]
manque1 = $[$m/2 - $Bon1]
manque= $[1 - 2*$Bon1/$m]
Bon = $[2*$Bon1/$m]

!if NaN isin $Bon or Inf isin $Bon
 !goto badrep
!endif

:diag

!if $trop=0 and $manque=0
  diareply$i=good
  !advance freegot
!else
  freegot=$[$freegot + max(0,$Bon - $trop)]
  !ifval $Bon > $trop + $manque
    partialgood$i=yes
    diareply$i=good
  !else
    diareply$i=bad
  !endif
!endif
##nombre de bons points, nombre de points oublis, nombre de points en trop,
##numro des points corrects
m_reply$i =$Bon1,$manque1,$trop1;$correct

:end

!if $(replytype$i)=javacurve
  primitive1=linewidth 1

  !for si = 1 to $[$n/2]
    primitive1=$primitive1\
  line $[$(rlist[2*$si-1])-6],$[$(rlist[2*$si])-6], $[$(rlist[2*$si-1])+6],$[$(rlist[2*$si])+6], $color1\
  line $[$(rlist[2*$si-1])+6],$[$(rlist[2*$si])-6], $[$(rlist[2*$si-1])-6],$[$(rlist[2*$si])+6], $color1
  !next

  primitive2=linewidth 8\
  points $color2,$glist
  !exit
!endif

!! $(replytype$i)=jsxgraphcurve
!if $wims_read_parm!=nocompare
  !for j=1 to $m/2
    !if $j notin $correct
      script$i=!append line brd$i.create('point',[$(glist[2*$j-1]),$(glist[2*$j])],{face:'o', size:'8',fixed:true,name:'',strokeColor:'$color2',fillColor:'none' ,showInfobox:false}); to $(script$i)
    !else
      sj=!positionof item $j in $correct
      script$i=!append line brd$i.create('point',[$(rlist[2*$(util[$sj])-1]),$(rlist[2*$(util[$sj])])],{face:'o', size:'8',fixed:true,name:'',strokeColor:'blue',fillColor:'none' ,showInfobox:false}); to $(script$i)
    !endif
  !next
!endif
!for j=1 to $n/2
  script$i=!append line brd$i.create('point',[$(rlist[2*$j-1]),$(rlist[2*$j])],{face:'+', size:'8',fixed:true,name:'',strokeColor:'$color1',showInfobox:false}); to $(script$i)
!next
!endif