REBOL[ Title: "Nombre mystérieux" version: 1.0.0 Date: 19/03/2003 ] cpt1: 0 ;###########Début des fonctions################## f: func [var1][ random/seed now random var1 ] f_eval: has [N] [ if nombre/text = "" [ return none ] if error? try [ N: to-integer nombre/text] [return none] if resultat < to-integer to-integer nombre/text [ return comp: 1] if resultat > to-integer to-integer nombre/text [ return comp: 2] if resultat = to-integer to-integer nombre/text [ return comp: 3] ] ;###################Fin des fonctions########################### fen2: layout [ backcolor 0.120.200 indent 10 vh1 "Gagné !!!" cmdquit2: button "quitter" #"^M" [ cpt1: 0 info1/text: copy "" show info1 hide cmdtest unview] ] ;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" fen: layout [ size 460x180 backcolor 0.120.200 across indent 45 cent: radio true of 'info1 text "0 à 100" font-size 14 indent 10 cinqcent: radio of 'info1 text " 0 à 500" font-size 14 indent 10 mille: radio of 'info1 text "0 à 1000" font-size 14 indent 48 lab3: label 55x20 "essais" font-size 14 below across indent 22 lab1: label 100x45 "Plus petit" font-size 20 with [show?: false] nombre: field 100x45 "" 255.255.255 font-size 32 center white lab2: label 110x45 "Plus grand" font-size 20 with [show?: false] indent 15 info1: info 50x45 "" font-size 32 center across return return across cmdnouv: button 100x50 "nouveau nombre" [ focus nombre show cmdtest hide [lab1 lab2] nombre/text: copy "" show nombre info1/text: copy "" show info1 if cent/data = true [ resultat: f 100] if cinqcent/data = true [resultat: f 500] if mille/data = true [ resultat: f 1000] ] indent 22 cmdtest: button 100x50 "tester" #"^M" [ either found? res: f_eval [][focus nombre cpt1: cpt1 - 1] hide [lab1 lab2] cpt1: cpt1 + 1 if f_eval = 1 [ show lab1 ] if f_eval = 2 [ show lab2 ] if f_eval = 3 [ view/new fen2 ] nombre/text: copy "" show nombre info1/text: cpt1 show info1 ] indent 25 cmdquit: button 100x50 "quitter" [quit] ] fen2/offset: 330x165 fen/offset: 240x150 view fen