Précédente Accueil Remonter Suivante

GEOMETRIE

Visual Basic for MS-DOS

 

 

DECLARE SUB orth (prog%, re%, ni%, mo$(), rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB fleches (v%, h%, w$(), np%, r%, coul%, drap%, v2%, h3%)
DECLARE SUB getinvimouse (rr%)
DECLARE SUB ouinon (r$)
DECLARE SUB tableauexo (p$())
DECLARE SUB cadre (v%, h%, l%, nli%, c%)
DECLARE SUB attendre (tx!)
DECLARE SUB bilan (ma$(), niveaux%(), VarEnreg AS ANY)
DECLARE SUB cadrenb (v%, h%, l%, nli%, c%, c2%, c3%)
DECLARE SUB calmoy (t$(), moy$(), niveaux%())
DECLARE SUB centre (v%, coul%, ph$)
DECLARE SUB chiffres ()
DECLARE SUB convertir (z$)
DECLARE SUB entree ()
DECLARE SUB flechesmenu (w$(), r%, coul%)
DECLARE SUB getinvi (rr%)
DECLARE SUB lettres ()
DECLARE SUB niveau (r%, np%, titr$)
DECLARE SUB quitter ()
DECLARE SUB titre (titr$)
DECLARE SUB agrand (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB frise (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB symetrie (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB aire (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB convexe (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB droitegauche (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB intrus (re%, ni%, motintrus$(), rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB trouve (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB angle1 (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB angle2 (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB paraperpen (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB recoformes (re%, ni%, s%, n$(), rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!, programme1$)
DECLARE SUB solide2 (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB verti (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB vocabu (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB coord (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB frise1 (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB reproduction (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB reproduction1 (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB symetrie1 (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)
DECLARE SUB heure (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%)
DECLARE SUB mesureduree (re%, ni%, rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%)
'EXERCICES 1 GEOMETRIE souris
'Clerc Daniel 19/12/2001
'version 1.4.3

DEFINT A-Z
'procédures

'variables globales
COMMON SHARED prog, programme1$, eleve, rt$, gg$, gg2$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!

' Inclut les fichiers contenant les déclarations relatives aux procédures appelées.
'$INCLUDE: 'MOUSE.BI'
'$INCLUDE: 'VBDOS.BI'

CONST FALSE = 0
CONST TRUE = NOT FALSE

SCREEN 9
SCREEN 0

rt$ = CHR$(17) + CHR$(196) + CHR$(217)
gg$ = CHR$(24) + " " + CHR$(25) + " puis " + rt$
gg2$ = CHR$(24) + " " + CHR$(25) + " " + CHR$(27) + " " + CHR$(26) + " puis " + rt$

coef1! = .72 'pour carré
coef2! = .72 'pour cercle

programme1$ = "exo_ge" '===
programme2$ = "menuexo" '===
ON ERROR GOTO erreur '===

TYPE TypeEnreg
nom AS STRING * 20
prenom AS STRING * 20
nbexo AS STRING * 21
Divers AS STRING * 50
notes AS STRING * 3000
END TYPE
DIM VarEnreg AS TypeEnreg

ma = 21 '===
DIM niveaux(ma), t$(100), moy$(21), p$(21), un$(9), di$(9), n$(ma)
DIM motintrus$(90), motorth$(40)

RANDOMIZE TIMER
OPEN "pointeur.dat" FOR INPUT AS #1
INPUT #1, eleve, sens, couleur, texte, lecture$
CLOSE
OPEN "pointeur.dat" FOR OUTPUT AS #1
WRITE #1, eleve, 2, 1, texte, lecture$
CLOSE

couleur = 1
noir = 0: bleu = 1: vert = 2: rouge = 4: marron = 6: blanc = 7: vertclair = 10: cyanclair = 11: rougeclair = 12: jaune = 14: blancbrill = 15

SCREEN 0: COLOR , noir, noir: CLS : KEY OFF: LOCATE , , 0
GOSUB init

IF sens = 1 AND eleve > 0 THEN
CALL bilan(p$(), niveaux(), VarEnreg)
END IF

menuprincipal:
' Vérifie que le gestionnaire de souris est installé.
MouseInit
MouseShow

COLOR , bleu, noir: CLS
CALL cadre(2, 20, 40, 2, vert)
COLOR , vert
CALL centre(3, blancbrill, "ACTIVITES de GEOMETRIE et de MESURES")
COLOR , bleu

IF eleve <> 0 THEN
'lecture des notes
OPEN "fichier.dat" FOR RANDOM AS #1 LEN = LEN(VarEnreg)
GET #1, eleve, VarEnreg
nom$ = RTRIM$(VarEnreg.nom)
pre$ = RTRIM$(VarEnreg.prenom)
'géométrie en 5°
nbexo$ = LTRIM$(STR$(VAL(MID$(VarEnreg.nbexo, 13, 3))))
resultat$ = MID$(VarEnreg.notes, 1601, 400)
j = 1
FOR i = 1 TO 200 STEP 2 '===
t$(j) = MID$(resultat$, i, 2)
j = j + 1
NEXT
CLOSE
CALL calmoy(t$(), moy$(), niveaux())
END IF

IF VAL(nbexo$) > 1 THEN
COLOR jaune
z$ = RTRIM$(nbexo$) + " exercices"
LOCATE 4, 79 - LEN(z$): PRINT z$
END IF
LOCATE 4, 2
COLOR jaune
IF eleve <> 0 THEN
w$ = pre$ + " " + nom$
IF LEN(w$) > 17 THEN
PRINT nom$
ELSE
PRINT w$
END IF
END IF

CALL tableauexo(p$())

'affiche liste exo
h1 = 6: h3 = 32: h3 = 58
COLOR blancbrill
LOCATE 7
FOR i = 1 TO 7
LOCATE , h1: PRINT p$(i): PRINT
NEXT
LOCATE 7
FOR i = 8 TO 14
LOCATE , h3: PRINT p$(i): PRINT
NEXT
LOCATE 7
FOR i = 15 TO 21
LOCATE , h3: PRINT p$(i): PRINT
NEXT

IF eleve <> 0 THEN
'affiche éval sur trois colonnes
COLOR , noir
debut = 1: fin = 7: h = 4
FOR boucle = 1 TO 3
LOCATE 7
FOR i = debut TO fin
LOCATE , h
IF moy$(i) = "" THEN
PRINT " ": PRINT
ELSEIF (VAL(moy$(i)) = 9 OR VAL(moy$(i)) = 10) THEN
COLOR vertclair: PRINT "A": PRINT
ELSEIF (VAL(moy$(i)) = 7 OR VAL(moy$(i)) = 8) THEN
COLOR vert: PRINT "B": PRINT
ELSEIF (VAL(moy$(i)) = 6 OR VAL(moy$(i)) = 5) THEN
COLOR jaune: PRINT "C": PRINT
ELSE
COLOR rougeclair: PRINT "D": PRINT
END IF
COLOR blancbrill
NEXT
debut = fin + 1: fin = fin + 7: IF fin > ma THEN fin = ma
h = h + 26
NEXT boucle
COLOR , bleu
END IF

CALL flechesmenu(p$(), prog, rouge)
COLOR , bleu

IF prog = 0 THEN
LOCATE 22, 1: PRINT SPACE$(80)
LOCATE 22, 28
COLOR blanc: BEEP: PRINT "Quitter ";
CALL ouinon(r$)
IF r$ = "O" THEN GOTO fin
GOTO menuprincipal
END IF

IF prog = 42 THEN
CALL bilan(p$(), niveaux(), VarEnreg)
GOTO menuprincipal
END IF

COLOR , noir: CLS
titr$ = p$(prog): ni = 1

'valeur de la matière
mat = 0
FOR i = 1 TO prog - 1
mat = mat + niveaux(i)
NEXT

SELECT CASE prog
CASE 1
CALL droitegauche(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)

CASE 2
CALL verti(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)

CASE 3
CALL trouve(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)

CASE 4
CALL recoformes(re, ni, 1, n$(), rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!, programme1$)

CASE 5
CALL recoformes(re, ni, 6, n$(), rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!, programme1$)

CASE 6
CALL recoformes(re, ni, 11, n$(), rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!, programme1$)

CASE 7
CALL vocabu(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)

CASE 8
CALL paraperpen(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)

CASE 9
CALL convexe(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)

CASE 10
CALL coord(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)

CASE 11
CALL niveau(ni, 4, titr$)
IF ni = 1 THEN
CALL reproduction1(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
ELSE
CALL reproduction(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
END IF

CASE 12
CALL niveau(ni, 4, titr$)
IF ni = 1 OR ni = 2 THEN
CALL frise1(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
ELSE
CALL frise(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
END IF

CASE 13
CALL agrand(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)

CASE 14
CALL niveau(ni, 4, titr$)
IF ni = 1 OR ni = 2 THEN
CALL symetrie1(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
ELSE
CALL symetrie(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
END IF

CASE 15
CALL aire(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)

CASE 16
CALL niveau(ni, 2, titr$)
IF ni = 1 THEN
CALL recoformes(re, ni, 16, n$(), rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!, programme1$)
ELSE
CALL solide2(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
END IF

CASE 17
CALL angle1(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)

CASE 18
CALL angle2(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)

CASE 19
titr$ = "heures - minutes"
CALL niveau(ni, 4, titr$)
IF ni = 1 OR ni = 2 THEN
CALL heure(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill)
ELSE
CALL mesureduree(re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill)
END IF

CASE 20
CALL orth(prog, re, ni, motorth$(), rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)

CASE 21
CALL intrus(re, ni, motintrus$(), rt$, gg$, pre$, titr$, noir%, bleu%, vert%, rouge%, marron%, blanc%, vertclair%, cyanclair%, rougeclair%, jaune%, blancbrill%, couleur%, coef1!, coef2!)

END SELECT

GOSUB enregistre
COLOR blanc: LOCATE 23, 37: PRINT rt$
CALL getinvimouse(rr)

GOTO menuprincipal
END

fin:
IF eleve > 0 THEN
CALL bilan(p$(), niveaux(), VarEnreg)
END IF
COLOR , noir: CLS
RUN programme2$
END

init:
DATA Droite-Gauche,3
DATA Verticale-Horizont.,2
DATA Reconnaissance,3
DATA Figures simples,1
DATA Triangles,1
DATA Quadrilatères,1
DATA Vocabulaire,2
DATA Parallèle-Perpend.,2
DATA Convexe-Concave,1
DATA Coordonnées,3

DATA Reproduction,4
DATA Frises,4
DATA Agrandir-Réduire,2
DATA Symétrie,4
DATA Périmètre-Aire,1
DATA Solides,2
DATA Nom des angles,1
DATA Valeur des angles,2
DATA Heures-Minutes,4
DATA Orthographe,3
DATA Intrus,2

FOR i = 1 TO ma: READ p$(i), niveaux(i): NEXT

'data pour recoformes
DATA rectangle,carré,cercle,losange,triangle
DATA triangle quelconque,triangle rectangle (non isocèle),triangle isocèle,triangle équilatéral,triangle rectangle isocèle
DATA rectangle,carré,losange,trapèze,parallélogramme quelconque
DATA cube,parallélépipède quelconque,pyramide,cône,cylindre
FOR i = 1 TO 20: READ n$(i): NEXT i


'data intrus
DATA mm,cm,dm,m²*,dam,hm,km,Le "m²" n'est pas une unité de longueur mais d'aire.,"="
DATA carré,rectangle,cercle*,losange,triangle,hexagone,Le cercle n'est pas composé de lignes droites.,"="
DATA rectangle,carré,losange,hexagone*,trapèze,parallélogramme,L'hexagone n'est pas un quadrilatère. Il a 6 côtés.,"="
DATA carré,trapèze*,hexagone,pentagone,octogone,triangle équilatéral,Le trapèze n'est pas un polygone régulier (angles et côtés égaux).,"="
DATA carré,rectangle,triangle rectangle,trapèze rectangle,triangle équilatéral*,Le triangle équilatéral n'a pas d'angle droit.,"="

DATA diamètre,diagonale,périmètre,hauteur,surface*,rayon,largeur,La surface n'est pas une longueur.,"="
DATA cube,sphère,cône,cylindre,parallépipède,disque*,tétraèdre,Le disque n'est pas un solide.,"="
DATA mm²,cm*,dm²,m²,dam²,hm²,km²,Le 'cm' n'est pas une unité d'aire mais de longueur.,"="
DATA cube*,cercle,carré,triangle,ellipse,hexagone,pentagone,Le cube n'est pas une surface. C'est un solide.,"="
DATA rayon,circonférence,arc de cercle,diamètre,hauteur*,La hauteur n'est pas utilisée dans les cercles.,"="

DATA ""

i = 0
DO
i = i + 1
READ motintrus$(i)
LOOP WHILE motintrus$(i) <> ""

'niveau 1 (13)
DATA carré,rectangle,losange,largeur,longueur,sommet,triangle,cube,cercle,disque
DATA hauteur,verticale,horizontale
'niveau 2 (13)
DATA angle,aigu,obtus,diagonale,arc,diamètre,rayon,aire,isocèle,parallèle
DATA circonférence,périmètre,trapèze
'niveau 3 (13)
DATA ellipse,pentagone,sphère,coordonnée,cylindre,hexagone,équilatéral,symétrie,pyramide
DATA parallélogramme,périmètre,perpendiculaire,octogone
DATA ""

i = 0
DO
i = i + 1
READ motorth$(i)
LOOP WHILE motorth$(i) <> ""
'39
RETURN

enregistre:
COLOR , noir
IF eleve = 0 THEN RETURN
CALL centre(23, blanc, "Enregistrement de la note")
re$ = LTRIM$(STR$(re)): IF LEN(re$) = 1 THEN re$ = " " + re$
pointeur = ni + mat
OPEN "fichier.dat" FOR RANDOM AS #1 LEN = LEN(VarEnreg)
GET #1, eleve, VarEnreg

nbexo$ = VarEnreg.nbexo

nombre$ = LTRIM$(STR$(VAL(MID$(nbexo$, 13, 3)) + 1))
IF LEN(nombre$) = 1 THEN
nombre$ = "00" + nombre$
ELSEIF LEN(nombre$) = 2 THEN
nombre$ = "0" + nombre$
END IF

'=== geo est en 5° -> 12
IF VAL(nombre$) < 1000 THEN
VarEnreg.nbexo = MID$(nbexo$, 1, 12) + nombre$ + MID$(nbexo$, 16)
END IF

notes$ = MID$(VarEnreg.notes, 1601, 400)
IF pointeur = 1 THEN
notes$ = re$ + MID$(notes$, 2 * pointeur + 1)
ELSE
notes$ = MID$(notes$, 1, (pointeur - 1) * 2) + re$ + MID$(notes$, 2 * pointeur + 1)
END IF

VarEnreg.notes = MID$(VarEnreg.notes, 1, 1600) + notes$ + MID$(VarEnreg.notes, 2001)
PUT #1, eleve, VarEnreg
CLOSE #1
CALL attendre(.5)
LOCATE 23: PRINT SPACE$(80)
re = 0
RETURN

erreur:
programme$ = "exo_ge"
SCREEN 0
COLOR , bleu: CLS
BEEP
CALL cadre(8, 5, 70, 9, rouge)
COLOR , rouge
CALL centre(10, blanc, "ATTENTION")

IF ERR = 5 THEN
CALL centre(12, blancbrill, "Votre ordinateur ne possède pas de carte graphique EGA ou VGA.")
CALL centre(14, blancbrill, "Les activités de GEOMETRIE et de MESURES ne sont pas accessibles.")
COLOR , noir
CALL getinvimouse(w)
RUN
END IF


SELECT CASE ERR
CASE 71
CALL centre(12, blancbrill, "Disque non prêt")

CASE 70
CALL centre(12, blancbrill, "Disquette protégée")

CASE 53, 57, 72
CALL centre(12, blancbrill, "Problème sur le disque")

CASE 61
CALL centre(12, blancbrill, "Disque plein")

CASE 25, 26, 68
CALL centre(12, blancbrill, "Imprimante non prête")

CASE 27
CALL centre(12, blancbrill, "Imprimante sans papier")

CASE ELSE
CALL centre(12, blancbrill, "Erreur système n°" + LTRIM$(STR$(ERR)))
CALL centre(14, blancbrill, "Essayez de relancez le programme.")
CLOSE
w$ = INPUT$(1)
COLOR , noir: CLS
END

END SELECT

CALL centre(14, blancbrill, "Corrigez puis tapez " + rt$ + " [Echap] = Fin")
CALL getinvimouse(r)
IF r = 27 THEN COLOR , noir: CLS : END
COLOR , bleu: CLS : RUN programme$
RESUME


DEFINT A-Z
SUB attendre (tx!)
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
t! = tx! * 2
debut! = TIMER
DO
IF INKEY$ <> "" THEN EXIT DO
fin! = TIMER
LOOP WHILE fin! - debut! < t!

END SUB

DEFINT A-Z
SUB bilan (ma$(), niveaux(), VarEnreg AS TypeEnreg)
ma = 21
DIM t$(100), moy$(ma), bi$(ma)
FOR i = 1 TO ma
bi$(i) = ma$(i)
IF LEN(bi$(i)) > 20 THEN bi$(i) = LEFT$(bi$(i), 19) + "."
NEXT

ll$ = STRING$(30, ".")
pt$ = MID$(ll$, 1, 15)
ni$ = "Niveau " + CHR$(26) + " 1 2 3 4"

COLOR , noir: CLS

'lecture des notes
OPEN "fichier.dat" FOR RANDOM AS #1 LEN = LEN(VarEnreg)
GET #1, eleve, VarEnreg
nom$ = RTRIM$(VarEnreg.nom)
pre$ = RTRIM$(VarEnreg.prenom)
'géométrie en 5°
nbexo$ = LTRIM$(MID$(VarEnreg.nbexo, 13, 3))

IF VAL(nbexo$) = 0 THEN CLOSE : EXIT SUB

resultat$ = MID$(VarEnreg.notes, 1601, 400)
j = 1
FOR i = 1 TO 200 STEP 2 '===
t$(j) = MID$(resultat$, i, 2)
j = j + 1
NEXT
CLOSE
CALL calmoy(t$(), moy$(), niveaux())

CALL titre("bilan")

'moy générale
tt = 0: nt = 0
FOR j = 1 TO ma
IF moy$(j) <> "" THEN tt = tt + VAL(moy$(j)): nt = nt + 1
NEXT j
IF nt = 0 THEN moygen$ = " " ELSE moygen$ = LTRIM$(STR$(INT((tt / nt) * 10) / 10))

z$ = pre$ + " " + nom$ + " a fait" + STR$(VAL(nbexo$)) + " exercice"
IF VAL(nbexo$) > 1 THEN z$ = z$ + "s"
z$ = z$ + " de géométrie"
COLOR , marron
CALL centre(4, blancbrill, " " + z$ + " ")
COLOR , bleu

LOCATE 6, 16: COLOR vertclair: PRINT ni$: COLOR jaune: LOCATE 6, 36: PRINT "Moy"
COLOR vertclair: LOCATE 6, 57: PRINT ni$: COLOR jaune: LOCATE 6, 77: PRINT "Moy"

COLOR , rouge

v = 7: h = 1: debut = 8: fin = 18: GOSUB cadre
v = 7: h = 42: debut = 8: fin = 17: GOSUB cadre
LOCATE 8
FOR i = 1 TO 11
LOCATE , 2: PRINT bi$(i); " "; LEFT$(ll$, 20 - LEN(bi$(i)))
NEXT
LOCATE 8
FOR i = 12 TO ma
LOCATE , 43: PRINT bi$(i); " "; LEFT$(ll$, 20 - LEN(bi$(i)))
NEXT

'affichage des moyennes
LOCATE 8
FOR i = 1 TO 11
LOCATE , 36
IF moy$(i) = "" THEN
PRINT
ELSEIF VAL(moy$(i)) = 9 OR VAL(moy$(i)) = 10 THEN
COLOR blancbrill
PRINT moy$(i);
COLOR vertclair
LOCATE , 38
PRINT "A"
ELSEIF VAL(moy$(i)) = 7 OR VAL(moy$(i)) = 8 THEN
COLOR blancbrill
PRINT moy$(i);
COLOR vert
LOCATE , 38
PRINT "B"
ELSEIF VAL(moy$(i)) = 6 OR VAL(moy$(i)) = 5 THEN
COLOR blancbrill
PRINT moy$(i);
LOCATE , 38
COLOR jaune
PRINT "C"
ELSE
COLOR blancbrill
PRINT moy$(i);
COLOR rougeclair
LOCATE , 38
PRINT "D"
END IF
NEXT
LOCATE 8
FOR i = 12 TO ma
LOCATE , 77
IF moy$(i) = "" THEN
PRINT
ELSEIF VAL(moy$(i)) = 9 OR VAL(moy$(i)) = 10 THEN
COLOR blancbrill
PRINT moy$(i);
COLOR vertclair
LOCATE , 79
PRINT "A"
ELSEIF VAL(moy$(i)) = 7 OR VAL(moy$(i)) = 8 THEN
COLOR blancbrill
PRINT moy$(i);
COLOR vert
LOCATE , 79
PRINT "B"
ELSEIF VAL(moy$(i)) = 5 OR VAL(moy$(i)) = 6 THEN
COLOR blancbrill
PRINT moy$(i);
LOCATE , 79
COLOR jaune
PRINT "C"
ELSE
COLOR blancbrill
PRINT moy$(i);
COLOR rougeclair
LOCATE , 79
PRINT "D"
END IF
NEXT
COLOR blanc

'++++++++++++++
v = 8
debut = 1
FOR Valeur = 1 TO 11
fin = debut + (niveaux(Valeur) - 1)
h = 24: GOSUB place
debut = fin + 1: v = v + 1
NEXT

v = 8
FOR Valeur = 12 TO ma
fin = debut + (niveaux(Valeur) - 1)
h = 65: GOSUB place
debut = fin + 1: v = v + 1
NEXT
'++++++++++
COLOR , bleu
IF VAL(moygen$) <> 0 THEN
COLOR cyanclair: LOCATE 19, 43
CALL convertir(moygen$)
PRINT "Moyenne générale : "; moygen$; " sur 10"
END IF
CALL entree

EXIT SUB

place:
LOCATE v
FOR i = debut TO fin
LOCATE , h
IF VAL(t$(i)) < 10 THEN PRINT " ";
IF t$(i) <> " " THEN PRINT LTRIM$(t$(i)); ELSE PRINT "-";
h = h + 3
NEXT
RETURN

cadre:
COLOR blancbrill
LOCATE v, h: PRINT "┌─────────────────────┬──┬──┬──┬──┬───┐"
FOR i = debut TO fin
LOCATE , h: PRINT "│ │ │ │ │ │ │"
NEXT i
LOCATE , h: PRINT "└─────────────────────┴──┴──┴──┴──┴───┘"
RETURN


END SUB

DEFINT A-Z
SUB cadre (v, h, l, nli, c)
'c est l'intérieur
'le fond écran est bleu

v2 = v

'cadre
COLOR c, bleu

LOCATE v2, h
PRINT STRING$(l + 2, 220)
FOR i = 1 TO nli - 1
v2 = v2 + 1: LOCATE v2, h
PRINT STRING$(l + 2, 219)
NEXT

COLOR , bleu
LOCATE v2 + 1, h: PRINT CHR$(223)

COLOR , 0
LOCATE v + 1
FOR i = 1 TO nli
LOCATE , h + l + 2
PRINT " "
NEXT
LOCATE v2 + 1, h + 1
PRINT STRING$(l + 1, 223)
COLOR blancbrill
END SUB

DEFINT A-Z
SUB cadre3 (v, h, nb, coul)
'inversion de v et h !
LINE (((h - 1) * 8) - 5, ((v - 1) * 14) - 2)-(((h - 1 + nb) * 8) + 5, (v * 14) + 2), coul, B
END SUB

DEFINT A-Z
SUB calmoy (t$(), moy$(), niveaux())
'5/5/96

debut = 1
FOR Valeur = 1 TO 21 '===
fin = debut + (niveaux(Valeur) - 1)
GOSUB calcul
debut = fin + 1
NEXT

EXIT SUB

calcul:
tt = 0: nt = 0
FOR j = debut TO fin
IF t$(j) <> " " THEN tt = tt + VAL(t$(j)): nt = nt + 1
NEXT j
IF nt = 0 THEN moy$(Valeur) = "" ELSE moy$(Valeur) = LTRIM$(STR$(INT(INT(tt / nt) * 10) / 10))
RETURN

END SUB

DEFINT A-Z
SUB centre (v, coul, ph$)
COLOR coul
LOCATE v, INT(41 - (LEN(ph$) / 2))
PRINT ph$
COLOR blancbrill
END SUB

DEFINT A-Z
SUB chiffres ()
LOCATE 23, 1, 0
FOR i = 1 TO 80
xx$ = xx$ + CHR$(SCREEN(23, i))
NEXT
LOCATE 23, 1: PRINT SPACE$(80)
CALL centre(23, rougeclair, "Des chiffres !")
CALL attendre(1)
COLOR blanc: LOCATE 23, 1: PRINT xx$
END SUB

DEFINT A-Z
SUB claviernumerique (z$)
CALL titre(titr$)
CALL cadre(4, 5, 70, 15, marron)
COLOR , marron
w$ = "Avec les touches du clavier numérique, tu vas devoir"
IF eleve <> 0 THEN
CALL centre(6, blancbrill, pre$ + ","): w$ = LCASE$(w$)
CALL centre(8, blancbrill, w$)
ELSE
CALL centre(7, blancbrill, w$)
END IF
CALL centre(9, blancbrill, z$)
LOCATE 11: h = 35
LOCATE , h: PRINT "7 8 9"
LOCATE , h: PRINT " \ │ /"
LOCATE , h: PRINT "4───┼───6"
LOCATE , h: PRINT " / │ \"
LOCATE , h: PRINT "1 2 3"
CALL centre(17, blancbrill, "Tu peux corriger tes erreurs avec la touche " + CHR$(27) + "- ou la touche suppr.")

CALL entree
z$ = "": w$ = ""
END SUB

DEFINT A-Z
SUB consigne (nl, w$, z$, xx$)
CALL titre(titr$)
IF nl = 1 THEN z$ = "": xx$ = ""
IF nl = 2 THEN xx$ = ""
l = LEN(w$)
IF LEN(z$) > l THEN l = LEN(z$)
IF LEN(xx$) > l THEN l = LEN(xx$)

l = l + 6
h = INT(40 - l / 2)

IF eleve <> 0 THEN nl = nl + 1

IF nl = 1 OR nl = 2 THEN
v = 8
ELSEIF nl = 3 THEN
v = 7
ELSEIF nl = 4 THEN
v = 6
END IF

CALL cadre(v, h, l, 4 + (nl * 2), marron)
COLOR , marron
IF eleve <> 0 THEN
CALL centre(v + 3, blancbrill, pre$ + ","): w$ = LCASE$(w$)
CALL centre(v + 5, blancbrill, w$)
CALL centre(v + 7, blancbrill, z$)
CALL centre(v + 9, blancbrill, xx$)
ELSE
CALL centre(v + 3, blancbrill, w$)
CALL centre(v + 5, blancbrill, z$)
CALL centre(v + 7, blancbrill, xx$)
END IF
CALL entree
w$ = "": z$ = "": xx$ = ""


END SUB

DEFINT A-Z
SUB convertir (z$)
'convertir les . en ,
s = INSTR(1, z$, ".")
IF s <> 0 THEN z$ = MID$(z$, 1, s - 1) + "," + MID$(z$, s + 1)
END SUB

DEFINT A-Z
SUB entree ()
COLOR 7, 0
LOCATE 23, , 0: PRINT SPACE$(37); CHR$(17) + CHR$(196) + CHR$(217) + SPACE$(40)
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
r$ = ""
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
IF lButton THEN
r$ = CHR$(13)
CALL attendre(.5)
END IF
LOOP WHILE r$ = ""

IF LEN(r$) < 2 THEN rr = ASC(r$) ELSE rr = ASC(RIGHT$(r$, 1))

'IF rr = 27 THEN CALL quitter
END SUB

DEFINT A-Z
SUB erreur (tx!)
LOCATE 23: PRINT SPACE$(60)
CALL centre(23, rougeclair, "Erreur"): CALL attendre(tx!)
END SUB

DEFINT A-Z
SUB erreur3 (tx!)
CALL centre(23, noir, SPACE$(10))
CALL centre(23, rougeclair, "Erreur"): CALL attendre(tx!)
CALL centre(23, blancbrill, " ")

END SUB

DEFINT A-Z
SUB exact (tx!)
LOCATE 23: PRINT SPACE$(70)
CALL centre(23, jaune, "Exact"): CALL attendre(tx!)
END SUB

DEFINT A-Z
SUB exact3 (tx!)
CALL centre(23, noir, SPACE$(10))
CALL centre(23, jaune, "Exact"): CALL attendre(tx!)
CALL centre(23, blancbrill, " ")

END SUB

DEFINT A-Z
SUB fleches (v, h, w$(), np, r, coul, drap, v2, h3)
'PRINT v2, h3
'v2 et h3 sont la ligne colonne des fleches
DIM p$(np)

LOCATE , , 0
FOR i = 1 TO np: p$(i) = w$(i): NEXT
l2 = 0
FOR i = 1 TO np
l1 = LEN(p$(i)): IF l2 < l1 THEN l2 = l1
NEXT
FOR i = 1 TO np
p$(i) = p$(i) + SPACE$(l2 - LEN(p$(i)))
NEXT

IF h3 > 0 THEN
COLOR blanc, noir
LOCATE v2, h3: PRINT gg$
END IF

'souris
v_mini = v: v_maxi = v_mini + np - 1
h_mini = h - 1: h_maxi = LEN(p$(1)) + h_mini + 1
'LOCATE 22, 1: PRINT v_mini, v_maxi, h_mini, h_maxi '===
'cadre
IF drap = 1 THEN
CALL cadre(v - 1, h - 3, l2 + 4, np + 1, coul)
END IF
COLOR blancbrill, coul

LOCATE v
FOR i = 1 TO np
LOCATE , h - 1: PRINT " "; p$(i); " "
NEXT
vt = v - 1
LOCATE v, h - 1
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(1); " "
COLOR blancbrill, coul
DO
DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
POKE 1050, PEEK(1052)
DEF SEG
souris = 0
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'LOCATE 21, 1: PRINT "Position de la souris : "; v_mouse; ", "; h_mouse '===
IF lButton THEN
IF v_mouse >= v_mini AND v_mouse <= v_maxi THEN
IF h_mouse >= h_mini AND h_mouse <= h_maxi THEN
LOCATE v_mini
FOR i = 1 TO np
LOCATE , h_mini: PRINT " "; p$(i); " "
NEXT
calcul = v_mouse - v_mini + 1
LOCATE v_mouse, h_mini
COLOR coul, blancbrill
PRINT " "; p$(calcul); " "
CALL attendre(.3)
r = calcul
EXIT SUB
ELSE
BEEP
END IF
ELSEIF v_mouse = v2 AND h_mouse = h3 THEN
rr = 72 'fleche haut
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND h_mouse = h3 + 2 THEN
rr = 80 'fleche bas
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND (h_mouse >= h3 + 9 AND h_mouse <= h3 + 11) THEN
rr = 13
souris = 1
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF

LOOP WHILE r$ = ""

IF souris = 0 THEN
IF LEN(r$) < 2 THEN
rr = ASC(r$)
ELSE
rr = ASC(RIGHT$(r$, 1))
END IF
END IF

IF rr = 27 THEN
CALL quitter
END IF


LOCATE v, h - 1: PRINT " "; p$(v - vt); " "
IF rr = 72 THEN v = v - 1: IF v = vt THEN v = vt + np
IF rr = 80 THEN v = v + 1: IF v = vt + np + 1 THEN v = vt + 1
LOCATE v, h - 1
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(v - vt); " "
COLOR blancbrill, coul
LOOP WHILE rr <> 13
r = v - vt
COLOR blancbrill

END SUB

DEFINT A-Z
SUB fleches2 (v%, h%, ll%, nm%, h3%, w$(), r, coul)
DIM p$(nm%)
CONST gauche = 75, droite = 77, bas = 80, haut = 72

'on met des espaces à la fin
FOR i = 1 TO nm
p$(i) = w$(i)
NEXT
l2 = 0
FOR i = 1 TO nm
l1 = LEN(p$(i)): IF l2 < l1 THEN l2 = l1
NEXT
FOR i = 1 TO nm
p$(i) = p$(i) + SPACE$(l2 - LEN(p$(i)))
NEXT
'+++
n! = nm / 2
paire = 0: IF n! = INT(nm / 2) THEN paire = 1
vv = v: hh = h: r = 1
GOSUB affiche

'fleches
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
LOCATE v, h - 1
PRINT " "; p$(1); " "
COLOR blancbrill, coul

DO
DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
POKE &H417, (PEEK(&H417) AND &HBF) 'minus
POKE 1050, PEEK(1052)
DEF SEG

souris = 0
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'LOCATE 22, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF v_mouse >= vv AND v_mouse <= vv + ll - 1 THEN
FOR nombre = 1 TO nm
IF v_mouse = vv + nombre - 1 THEN
IF h_mouse >= h AND h_mouse <= h + l2 THEN
GOSUB affiche
LOCATE v_mouse, h - 1
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(nombre); " "
COLOR blancbrill, coul
CALL attendre(.3)
r = nombre
EXIT SUB

ELSEIF h_mouse >= h3 AND h_mouse <= h3 + l2 THEN
GOSUB affiche
LOCATE v_mouse, h3 - 1
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(nombre + ll); " "
COLOR blancbrill, coul
CALL attendre(.3)
r = nombre + ll
EXIT SUB
END IF
END IF
NEXT

ELSEIF v_mouse = 23 THEN
IF h_mouse = 33 THEN
'fleche haut
rr = haut
CALL attendre(.3)
souris = 1
EXIT DO
ELSEIF h_mouse = 35 THEN
'fleche bas
rr = bas
CALL attendre(.3)
souris = 1
EXIT DO
ELSEIF h_mouse = 37 THEN
'fleche gauche
rr = gauche
CALL attendre(.3)
souris = 1
EXIT DO
ELSEIF h_mouse = 39 THEN
'fleche droite
rr = droite
CALL attendre(.3)
souris = 1
EXIT DO
ELSEIF h_mouse >= 46 AND h_mouse <= 48 THEN
'entree
rr = 13
CALL attendre(.3)
souris = 1
EXIT DO

END IF
ELSE
BEEP
END IF
END IF

LOOP WHILE r$ = ""

IF souris = 0 THEN
IF LEN(r$) < 2 THEN rr = ASC(r$) ELSE rr = ASC(RIGHT$(r$, 1))
IF rr = 27 THEN r = 0: EXIT SUB
END IF

LOCATE v, hh - 1
PRINT " "; p$(r); " "

GOSUB fldirect
LOCATE v, hh - 1
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
COLOR blancbrill, coul
LOOP WHILE rr <> 13

EXIT SUB

fldirect:
IF rr = gauche THEN r = r - ll: IF hh = h3 THEN hh = h ELSE IF hh = h THEN hh = h3 'gauche
IF rr = droite THEN
IF paire = 0 AND r = ll + 1 THEN
r = r + ll + 1
ELSE
r = r + ll
END IF
IF hh = h3 THEN hh = h ELSE IF hh = h THEN hh = h3 'droite
END IF
IF rr = haut THEN v = v - 1: r = r - 1 'haut
IF rr = bas THEN v = v + 1: r = r + 1 'bas

IF r = ll + 1 THEN v = vv: hh = h3
IF r = ll THEN v = ll + (vv - 1): hh = h
IF r = 2 * ll THEN v = ll + (vv - 1): hh = h3
IF r > nm THEN r = 1: v = vv: hh = h
IF r >= 1 THEN RETURN
r = nm
v = (vv - 1) + nm - ll: hh = h3
RETURN

affiche:
COLOR , coul
LOCATE vv
FOR i = 1 TO ll: LOCATE , h - 1: PRINT " "; p$(i); " ": NEXT
LOCATE vv
FOR i = ll + 1 TO nm: LOCATE , h3 - 1: PRINT " "; p$(i); " ": NEXT
RETURN
END SUB

DEFINT A-Z
SUB flechesbis (v, h, p$(), np, r)
v2 = 18: h3 = 62
DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG
COLOR blancbrill

LOCATE v
l = 0
FOR i = 1 TO np
LOCATE , h: PRINT p$(i)
IF LEN(p$(i)) > l THEN l = LEN(p$(i))
NEXT
vt = v - 1
LOCATE v, h - 1: COLOR jaune: PRINT "-"; p$(1); "-": COLOR blancbrill

'souris
v_mini = v: v_maxi = v_mini + np - 1
h_mini = h - 1: h_maxi = l + h_mini + 1

DO
MouseBorder 46, 435, 260, 620
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG

DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'LOCATE 21, 1: PRINT v_mouse, h_mouse'===
'matrice 14 x 8 = transforme en coord écran
v_mouse = INT(v_mouse / 14) + 1
h_mouse = INT(h_mouse / 8) + 1
IF lButton THEN
IF v_mouse >= v_mini AND v_mouse <= v_maxi THEN
IF h_mouse >= h_mini AND h_mouse <= h_maxi THEN
MouseHide
LOCATE v_mini
FOR i = 1 TO np
LOCATE , h_mini: PRINT " "; p$(i); " "
NEXT
calcul = v_mouse - v_mini + 1
LOCATE v_mouse, h_mini
COLOR jaune
PRINT "-"; p$(calcul); "-"
CALL attendre(.3)
r = calcul
EXIT SUB
ELSE
BEEP
END IF
ELSEIF v_mouse = v2 AND h_mouse = h3 THEN
rr = 72 'fleche haut
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND h_mouse = h3 + 2 THEN
rr = 80 'fleche bas
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND (h_mouse >= h3 + 9 AND h_mouse <= h3 + 11) THEN
rr = 13
souris = 1
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF

LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN rr = ASC(r$) ELSE rr = ASC(RIGHT$(r$, 1))
END IF

IF rr = 27 THEN r = 0: EXIT SUB
LOCATE v, h - 1: PRINT " "; p$(v - vt); " "
IF rr = 72 THEN v = v - 1: IF v = vt THEN v = vt + np
IF rr = 80 THEN v = v + 1: IF v = vt + np + 1 THEN v = vt + 1
LOCATE v, h - 1: COLOR jaune: PRINT "-"; p$(v - vt); "-": COLOR blancbrill
LOOP WHILE rr <> 13
r = v - vt
COLOR blancbrill

END SUB

DEFINT A-Z
SUB flechesmenu (w$(), r, coul)
nm = 21 '===
DIM p$(nm)
CONST gauche = 75, droite = 77, bas = 80, haut = 72
h1 = 6: h3 = 32: h3 = 58

'on met des espaces à la fin
FOR i = 1 TO nm
p$(i) = w$(i)
NEXT
l2 = 0
FOR i = 1 TO nm
l1 = LEN(p$(i)): IF l2 < l1 THEN l2 = l1
NEXT
FOR i = 1 TO nm
p$(i) = p$(i) + SPACE$(l2 - LEN(p$(i)))
NEXT
'+++

h = h1: v = 7
r = 1

DO

IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
LOCATE v, h - 1
PRINT " "; p$(r); " "
COLOR blancbrill, coul

hh = h: vv = v

'fleches
DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
POKE &H417, (PEEK(&H417) AND &HBF) 'minus
POKE 1050, PEEK(1052)
DEF SEG

souris = 0
DO
r$ = INKEY$

' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 1: PRINT "Position de la souris : "; v_mouse; ", "; h_mouse '===
IF lButton THEN
'ligne fleches et entree
IF v_mouse = 22 THEN
IF h_mouse = 33 THEN
'fleche haut
rr = haut
CALL attendre(.3)
souris = 1
EXIT DO
ELSEIF h_mouse = 35 THEN
'fleche bas
rr = bas
CALL attendre(.3)
souris = 1
EXIT DO
ELSEIF h_mouse = 37 THEN
'fleche gauche
rr = gauche
CALL attendre(.3)
souris = 1
EXIT DO
ELSEIF h_mouse = 39 THEN
'fleche droite
rr = droite
CALL attendre(.3)
souris = 1
EXIT DO
ELSEIF h_mouse >= 46 AND h_mouse <= 48 THEN
'entree
rr = 13
CALL attendre(.3)
souris = 1
EXIT DO
ELSEIF h_mouse >= 3 AND h_mouse <= 15 THEN
'ligne echap et *
rr = 27
CALL attendre(.3)
souris = 1
EXIT DO
ELSEIF h_mouse >= 68 AND h_mouse <= 78 THEN
rr = 42
CALL attendre(.3)
souris = 1
EXIT DO
ELSE
BEEP
END IF
END IF

'lignes noms des activités
IF v_mouse = 7 THEN
IF h_mouse >= 6 AND h_mouse <= 24 THEN
GOSUB afficheliste
r = 1
LOCATE v_mouse, 5
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB
ELSEIF h_mouse >= 32 AND h_mouse <= 50 THEN
GOSUB afficheliste
r = 8
LOCATE v_mouse, 31
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB
ELSEIF h_mouse >= 57 AND h_mouse <= 76 THEN
GOSUB afficheliste
r = 15
LOCATE v_mouse, 57
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB

ELSE
BEEP
END IF
ELSEIF v_mouse = 9 THEN
IF h_mouse >= 6 AND h_mouse <= 24 THEN
GOSUB afficheliste
r = 2
LOCATE v_mouse, 5
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB
ELSEIF h_mouse >= 32 AND h_mouse <= 50 THEN
GOSUB afficheliste
r = 9
LOCATE v_mouse, 31
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB
ELSEIF h_mouse >= 57 AND h_mouse <= 76 THEN
GOSUB afficheliste
r = 16
LOCATE v_mouse, 57
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB
ELSE
BEEP
END IF
ELSEIF v_mouse = 11 THEN
IF h_mouse >= 6 AND h_mouse <= 24 THEN
GOSUB afficheliste
r = 3
LOCATE v_mouse, 5
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB

ELSEIF h_mouse >= 32 AND h_mouse <= 50 THEN
GOSUB afficheliste
r = 10
LOCATE v_mouse, 31
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB
ELSEIF h_mouse >= 57 AND h_mouse <= 76 THEN
GOSUB afficheliste
r = 17
LOCATE v_mouse, 57
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB

ELSE
BEEP
END IF
ELSEIF v_mouse = 13 THEN
IF h_mouse >= 6 AND h_mouse <= 24 THEN
GOSUB afficheliste
r = 4
LOCATE v_mouse, 5
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB

ELSEIF h_mouse >= 32 AND h_mouse <= 50 THEN
GOSUB afficheliste
r = 11
LOCATE v_mouse, 31
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB
ELSEIF h_mouse >= 57 AND h_mouse <= 76 THEN
GOSUB afficheliste
r = 18
LOCATE v_mouse, 57
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB

ELSE
BEEP
END IF
ELSEIF v_mouse = 15 THEN
IF h_mouse >= 6 AND h_mouse <= 24 THEN
GOSUB afficheliste
r = 5
LOCATE v_mouse, 5
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB

ELSEIF h_mouse >= 32 AND h_mouse <= 50 THEN
GOSUB afficheliste
r = 12
LOCATE v_mouse, 31
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB
ELSEIF h_mouse >= 57 AND h_mouse <= 76 THEN
GOSUB afficheliste
r = 19
LOCATE v_mouse, 57
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB

ELSE
BEEP
END IF
ELSEIF v_mouse = 17 THEN
IF h_mouse >= 6 AND h_mouse <= 24 THEN
GOSUB afficheliste
r = 6
LOCATE v_mouse, 5
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB

ELSEIF h_mouse >= 32 AND h_mouse <= 50 THEN
GOSUB afficheliste
r = 13
LOCATE v_mouse, 31
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB
ELSEIF h_mouse >= 57 AND h_mouse <= 76 THEN
GOSUB afficheliste
r = 20
LOCATE v_mouse, 57
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB

ELSE
BEEP
END IF

ELSEIF v_mouse = 19 THEN
IF h_mouse >= 6 AND h_mouse <= 24 THEN
GOSUB afficheliste
r = 7
LOCATE v_mouse, 5
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB

ELSEIF h_mouse >= 32 AND h_mouse <= 50 THEN
GOSUB afficheliste
r = 14
LOCATE v_mouse, 31
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB
ELSEIF h_mouse >= 57 AND h_mouse <= 76 THEN
GOSUB afficheliste
r = 21
LOCATE v_mouse, 57
IF couleur = 1 THEN COLOR coul, blanc ELSE COLOR noir, blanc
PRINT " "; p$(r); " "
CALL attendre(.5)
EXIT SUB

ELSE
BEEP

END IF

ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

IF souris = 0 AND LEN(r$) < 2 THEN
rr = ASC(r$)
ELSEIF souris = 0 THEN
rr = ASC(RIGHT$(r$, 1))
END IF

SELECT CASE rr

CASE gauche
h = h - 26
IF h < h1 THEN
v = v - 2: h = h3
END IF
IF v < 7 THEN
v = 19
END IF

CASE droite
h = h + 26
IF h > h3 THEN
v = v + 2: h = h1
END IF
IF v > 19 THEN
v = 7
END IF

CASE bas
v = v + 2
IF v > 19 THEN
IF h = h1 THEN
h = h3: v = 7
ELSEIF h = h3 THEN
h = h3: v = 7
ELSEIF h = h3 THEN
h = h1: v = 7
END IF
END IF

CASE haut
v = v - 2
IF v < 7 THEN
IF h = h3 THEN
h = h3: v = 19
ELSEIF h = h3 THEN
h = h1: v = 19
ELSEIF h = h1 THEN
h = h3: v = 19
END IF
END IF

CASE 13
GOSUB calculr
EXIT SUB

CASE 27
r = 0
EXIT SUB

CASE 42, 36, 56, 230, 43
IF eleve <> 0 THEN
'l'étoile
r = 42
EXIT SUB
END IF

END SELECT

COLOR blancbrill, coul
LOCATE vv, hh - 1
PRINT " "; p$(r); " "

GOSUB calculr

LOOP

EXIT SUB

calculr:
IF h = h1 THEN
r = ((v - 7) / 2) + 1
ELSEIF h = h3 THEN
r = ((v - 7) / 2) + 8
ELSEIF h = h3 THEN
r = ((v - 7) / 2) + 15
END IF
RETURN

afficheliste:
'affiche liste exo
h1 = 5: h3 = 31: h3 = 57
COLOR blancbrill
LOCATE 7
FOR i = 1 TO 7
LOCATE , h1: PRINT " "; p$(i); " ": PRINT
NEXT
LOCATE 7
FOR i = 8 TO 14
LOCATE , h3: PRINT " "; p$(i); " ": PRINT
NEXT
LOCATE 7
FOR i = 15 TO 21
LOCATE , h3: PRINT " "; p$(i); " ": PRINT
NEXT
RETURN

END SUB

DEFINT A-Z
SUB getinvi (rr%)
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
LOOP WHILE r$ = ""
IF LEN(r$) < 2 THEN rr = ASC(r$) ELSE rr = ASC(RIGHT$(r$, 1))
END SUB

DEFINT A-Z
SUB getinvimouse (rr)
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
IF lButton THEN
r$ = CHR$(13)
CALL attendre(.5)
END IF
LOOP WHILE r$ = ""
IF LEN(r$) < 2 THEN rr = ASC(r$) ELSE rr = ASC(RIGHT$(r$, 1))


END SUB

DEFINT A-Z
SUB inputgen (nl%, r$, deb%, fin%)
DIM re$(nl + 1)

inpdebut:
r$ = "."
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
IF prog = 20 THEN 'orth
COLOR noir, blanc
END IF

ligne = CSRLIN
col = POS(0)
LOCATE ligne, col: IF fin% = 57 THEN PRINT LEFT$(SPACE$(40), nl)
LOCATE ligne, col, 1
FOR ii = 1 TO nl + 1
input0:
IF ii <= 0 THEN ii = 1
DO
re$(ii) = INKEY$
LOOP WHILE re$(ii) = ""

IF ASC(re$(ii)) = 27 THEN
LOCATE , , 0
CALL quitter
r$ = ""
EXIT FOR
END IF

IF LEN(re$(ii)) = 2 THEN z2 = ASC(RIGHT$(re$(ii), 1)): IF ii > 1 AND (z2 = 75 OR z2 = 83 OR z2 = 15) THEN PRINT CHR$(29); " "; CHR$(29); : ii = ii - 1: z2 = 0: GOTO input0 ELSE GOTO input0

IF ASC(re$(ii)) = 13 THEN EXIT FOR

IF ii > 1 AND ASC(re$(ii)) = 8 THEN PRINT CHR$(29); " "; CHR$(29); : ii = ii - 1: GOTO input0 ELSE IF ASC(re$(ii)) = 8 THEN GOTO input0

IF ASC(re$(ii)) < deb OR ASC(re$(ii)) > fin THEN IF deb = 48 THEN CALL chiffres: r$ = "": EXIT FOR ELSE CALL lettres: r$ = "": EXIT FOR

IF ii = nl + 1 THEN BEEP: GOTO input0

PRINT re$(ii);
NEXT ii
IF r$ = "" THEN LOCATE ligne, col: GOTO inpdebut
PRINT
r$ = "": FOR JJ = 1 TO ii - 1: r$ = r$ + re$(JJ): NEXT
r$ = LTRIM$(r$): r$ = RTRIM$(r$)
IF r$ = "" THEN BEEP: LOCATE ligne, col: GOTO inpdebut
LOCATE , , 0

END SUB

DEFINT A-Z
SUB lettres ()
LOCATE 23, 1, 0
FOR i = 1 TO 80
xx$ = xx$ + CHR$(SCREEN(23, i))
NEXT
LOCATE 23, 1: PRINT SPACE$(80)
CALL centre(23, rougeclair, "Des lettres !")
CALL attendre(1)
COLOR blanc: LOCATE 23, 1: PRINT xx$
END SUB

DEFINT A-Z
SUB niveau (r%, np%, titr$)
CALL titre(titr$)
DIM p$(4)
p$(1) = "1": p$(2) = "2": p$(3) = "3": p$(4) = "4"
CALL cadre(7, 25, 30, 2, vert)
COLOR , vert
CALL centre(8, blancbrill, "Niveau de difficulté")
COLOR blanc, noir
CALL centre(23, blanc, gg$)
COLOR 15, bleu
p$(1) = "1": p$(2) = "2": p$(3) = "3": p$(4) = "4"
'CALL cadre(11, 36, 7, 3 + np, rouge)

DO
CALL fleches(13, 40, p$(), np, r, rouge, 1, 23, 35)
IF r = 0 THEN
CALL quitter
END IF
LOOP WHILE r = 0
END SUB

DEFINT A-Z
SUB ouinon (r$)
h = POS(0)
v = CSRLIN

DIM regs AS RegType
regs.ax = &HF00
INTERRUPT &H10, regs, regs ' &H10 renvoie informations
' sur vidéo.
sWidth = (regs.ax AND &HFF00) \ 256 ' Octet fort de AX (AH).
sMode = regs.ax AND &HFF ' Octet faible de AX (AL).

SELECT CASE sMode ' Fait correspondre numéros
CASE 3 ' de mode vidéo MS-DOS et
sMode = 0 ' modes affichage Basic.
CASE 16
sMode = 9
MouseInit
END SELECT

LOCATE v, h
COLOR blanc: PRINT "["; : COLOR jaune: PRINT "O"; : COLOR blanc: PRINT "]ui ou ["; : COLOR jaune: PRINT "N"; : COLOR blanc: PRINT "]on ?"

MouseShow

DO
r$ = ""
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
IF sMode = 9 THEN
'matrice 14 x 8 = transforme en coord écran
v_mouse = INT(v_mouse / 14) + 1
h_mouse = INT(h_mouse / 8) + 1
END IF
IF lButton THEN
IF v_mouse = v AND (h_mouse >= h AND h_mouse <= h + 5) THEN
r$ = "o"
CALL attendre(.3)
ELSEIF v_mouse = v AND (h_mouse >= h + 10 AND h_mouse <= h + 14) THEN
r$ = "n"
CALL attendre(.3)
ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

r$ = UCASE$(r$)
LOOP UNTIL r$ = "O" OR r$ = "N" OR r$ = CHR$(27) OR r$ = CHR$(13)

END SUB

DEFINT A-Z
SUB quitter ()
'25/2/96
DIM c(80), xx$(80)
x = noir: y = noir
F = 0
'on mémorise la zone quitter
LOCATE 23, 1, 0
COLOR blanc, x
FOR i = 1 TO 80
xx$(i) = CHR$(SCREEN(23, i))
c(i) = SCREEN(23, i, 1): IF c(i) > 15 THEN F = 1 'erreur à cause du fond
NEXT

LOCATE 23, 1: PRINT SPACE$(80)

LOCATE 23, 28
BEEP: PRINT "Quitter ";
CALL ouinon(r$)
IF UCASE$(r$) = "O" THEN COLOR , 0: CLS : RUN "exo_ge" '===

'on restitue la zone quitter
LOCATE 23, 1
FOR i = 1 TO 80
IF F = 0 THEN
COLOR c(i)
END IF
PRINT xx$(i);
NEXT
PRINT
COLOR 15, y
END SUB

DEFINT A-Z
SUB resultats (re%, ni%)
SCREEN 0
MouseInit
MouseShow
tit$ = titr$
titr$ = "resultats"
CALL titre(titr$)

w! = LEN(tit$) / 2
IF w! = INT(LEN(tit$) / 2) THEN n = 4 ELSE n = 2
CALL cadre(5, 38 - INT(LEN(tit$) / 2), INT(LEN(tit$)) + n, 2, blanc)
COLOR , blanc
CALL centre(6, noir, tit$)
COLOR , bleu

IF re > 8 THEN
cc = vertclair: z$ = "Acquis"
ELSEIF re > 4 AND re < 9 THEN
cc = jaune: z$ = "En cours d'acquisition"
ELSE
cc = rougeclair: z$ = "Non acquis"
END IF

IF nbniv <> 1 THEN
s$ = " au niveau" + RTRIM$(STR$(ni))
ELSE
s$ = ""
END IF

CALL centre(10, cc, z$ + s$)
CALL cadre(12, 20, 40, 2, rouge)
LOCATE 13
i2 = 0
FOR i = 1 TO re
LOCATE , 21 + i2: PRINT "████"; '219
i2 = i2 + 4
NEXT
COLOR noir, noir
FOR i = re + 1 TO 10
LOCATE , 21 + i2: PRINT " ";
i2 = i2 + 4
NEXT
PRINT
COLOR , bleu
CALL centre(16, 15, "Pourcentage de réussite :" + STR$(re * 10) + " %")
CALL centre(18, 15, "(" + LTRIM$(STR$(re)) + " sur 10)")

COLOR blancbrill
END SUB

DEFINT A-Z
SUB tableauexo (p$())

'tableau des exercices
CALL cadre(5, 2, 75, 16, rouge)
COLOR , bleu
LOCATE 22, 3: PRINT "["; : COLOR jaune: PRINT "Echap"; : COLOR blancbrill: PRINT "] = Fin"
CALL centre(22, blanc, gg2$)
IF eleve <> 0 THEN
COLOR blancbrill
LOCATE 22, 68: PRINT "["; : COLOR jaune: PRINT "*"; : COLOR blancbrill: PRINT "] = Bilan"
END IF


l3$ = SPACE$(24) + "│" + SPACE$(25) + "│" + SPACE$(23)
l4$ = STRING$(24, "─") + "┼" + STRING$(25, "─") + "┼" + STRING$(23, "─")
l5$ = STRING$(24, "─") + "┬" + STRING$(25, "─") + "┬" + STRING$(23, "─")
l6$ = STRING$(24, "─") + "┴" + STRING$(25, "─") + "┴" + STRING$(23, "─")

COLOR blanc, rouge
LOCATE 6
LOCATE , 3: PRINT l5$
'LOCATE , 3: PRINT l3$
FOR i = 1 TO 6
LOCATE , 3: PRINT l3$
LOCATE , 3: PRINT l4$
NEXT
LOCATE , 3: PRINT l3$
LOCATE , 3: PRINT l6$

'affiche liste exo
h1 = 6: h3 = 32: h3 = 58
COLOR blancbrill
LOCATE 7
FOR i = 1 TO 7
LOCATE , h1: PRINT p$(i): PRINT
NEXT
LOCATE 7
FOR i = 8 TO 14
LOCATE , h3: PRINT p$(i): PRINT
NEXT
LOCATE 7
FOR i = 15 TO 21
LOCATE , h3: PRINT p$(i): PRINT
NEXT


END SUB

DEFINT A-Z
SUB titre (titr$)
w$ = titr$
COLOR , noir, noir: CLS
FOR i = 1 TO LEN(w$)
IF MID$(w$, i, 1) = "é" OR MID$(w$, i, 1) = "è" THEN
w$ = MID$(w$, 1, i - 1) + "E" + MID$(w$, i + 1)
END IF
NEXT
FOR i = 1 TO LEN(w$)
IF MID$(w$, i, 1) = "à" THEN
w$ = MID$(w$, 1, i - 1) + "A" + MID$(w$, i + 1)
END IF
NEXT

COLOR , vert
LOCATE 2, 1: PRINT SPACE$(80)
CALL centre(2, noir, UCASE$(w$))
LOCATE 21, 1: PRINT SPACE$(80)
VIEW PRINT 3 TO 20: COLOR blancbrill, bleu: CLS 2: VIEW PRINT

END SUB

DEFINT A-Z
SUB titre2 (titr$)
COLOR , noir: CLS
w$ = titr$
FOR i = 1 TO LEN(w$)
IF MID$(w$, i, 1) = "é" OR MID$(w$, i, 1) = "è" THEN
w$ = MID$(w$, 1, i - 1) + "E" + MID$(w$, i + 1)
END IF
NEXT
LINE (0, 14)-(640, 27), vert, BF
CALL centre(2, jaune, " " + UCASE$(w$) + " ")
LINE (0, 28)-(639, 279), bleu, BF
LINE (0, 279)-(640, 292), vert, BF
COLOR blancbrill
END SUB

DEFINT A-Z
SUB titre3 (titr$)
COLOR , noir: CLS
w$ = titr$
FOR i = 1 TO LEN(w$)
IF MID$(w$, i, 1) = "é" OR MID$(w$, i, 1) = "è" THEN
w$ = MID$(w$, 1, i - 1) + "E" + MID$(w$, i + 1)
END IF
NEXT

LINE (0, 14)-(640, 27), vert, BF
CALL centre(2, jaune, " " + UCASE$(w$) + " ")

LINE (0, 28)-(639, 279), bleu, BF
LINE (430, 38)-(630, 269), noir, BF
LINE (430, 38)-(630, 269), rouge, B
LINE (0, 279)-(640, 292), vert, BF
COLOR blancbrill
END SUB
 

 

DECLARE SUB MouseBorder (row1%, col1%, row2%, col2%)
DECLARE SUB MouseHide ()
DECLARE SUB MousePoll (row%, col%, lButton%, rButton%)
DECLARE SUB MouseShow ()
DECLARE SUB getinvimouse (rr%)
DECLARE SUB claviernumerique (z$)
DECLARE SUB consigne (nl%, w$, z$, xx$)
DECLARE SUB centre (v%, coul%, ph$)
DECLARE SUB quitter ()
DECLARE SUB getinvi (rr%)
DECLARE SUB niveau (r%, np%, titr$)
DECLARE SUB titre (titr$)
DECLARE SUB attendre (tx!)
DECLARE SUB entree ()
DECLARE SUB erreur (tx!)
DECLARE SUB exact (tx!)
DECLARE SUB resultats (re%, ni%)
DECLARE SUB titre2 (titr$)
'exo 2 géométrie
'Daniel Clerc 7/4/96
'version 3.0


DEFINT A-Z
SUB agrand (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
DIM dessin$(10), dessin2$(10), solution$(10), x(10), y(10), z(5), fois(10)
DIM cercle(1 TO 50) AS INTEGER
titr$ = "agrandir-reduire"
CONST gauche = 75, droite = 77
CONST haut = 72, bas = 80, hautgauche = 71, hautdroite = 73, basgauche = 79, basdroite = 81

re = 0

'niveau 1
dessin$(1) = "u20 r10 u10 r10 u20 l10 u10 r30 d10 l10 d20 r10 d10 r10 d20 l30"
dessin2$(1) = "u60 r30 u30 r30 u60 l30 u30 r90 d30 l30 d60 r30 d30 r30 d60 l90"
solution$(1) = "hhhhhhdddhhhdddhhhhhhggghhhdddddddddbbbgggbbbbbbdddbbbdddbbbbbbggggggggg"
fois(1) = 3
dessin$(2) = "u60 r30 u30 r30 u30 l30 u60 r90 d30 r30 d60 r60 d90 l90"
dessin2$(2) = "u20 r10 u10 r10 u10 l10 u20 r30 d10 r10 d20 r20 d30 l30"
solution$(2) = "hhdhdhghhdddbdbbddbbbggg"
fois(2) = -3
dessin$(3) = "u30 r20 u20 l10 u20 r20 u20 r30 d30 r10 d20 l20 d40 r30"
dessin2$(3) = "u60 r40 u40 l20 u40 r40 u40 r60 d60 r20 d40 l40 d80 r60"
solution$(3) = "hhhhhhddddhhhhgghhhhddddhhhhddddddbbbbbbddbbbbggggbbbbbbbbdddddd"
fois(3) = 2
dessin$(4) = "u80 r20 d40 r20 u60 r20 d40 r40 u100 l20 u40 r60 d80 r20 d120 l60"
dessin2$(4) = "u40 r10 d20 r10 u30 r10 d20 r20 u50 l10 u20 r30 d40 r10 d60 l30"
solution$(4) = "hhhhdbbdhhhdbbddhhhhhghhdddbbbbdbbbbbbggg"
fois(4) = -2
dessin$(5) = "u30 r10 u10 l10 u10 r20 d20 r10 u10 r10 d20 l10 d10 l10 d10 r20"
dessin2$(5) = "u120 r40 u40 l40 u40 r80 d80 r40 u40 r40 d80 l40 d40 l40 d40 r80"
solution$(5) = "hhhhhhhhhhhhddddhhhhgggghhhhddddddddbbbbbbbbddddhhhhddddbbbbbbbbggggbbbbggggbbbbdddddddd"
fois(5) = 4


'niveau 2 angle 45
dessin$(6) = "m+10,-10 u10 m+10,-10 u10 m-10,-10 m+10,-10 r10 m+10,+10 m-10,+10 d10 m+10,+10 d10 m+10,+10"
dessin2$(6) = "m+30,-30 u30 m+30,-30 u30 m-30,-30 m+30,-30 r30 m+30,+30 m-30,+30 d30 m+30,+30 d30 m+30,+30"
solution$(6) = "kkkhhhkkkhhhjjjkkkdddlllmmmbbblllbbblll"
fois(6) = 3
dessin$(7) = "u30 r30 m+30,-30 l30 m+30,-30 l30 u60 r60 d30 m+30,+30 m+30,-30 d30 m-30,+30 d30 m+30,+30 u30 r30 d30"
dessin2$(7) = "u10 r10 m+10,-10 l10 m+10,-10 l10 u20 r20 d10 m+10,+10 m+10,-10 d10 m-10,+10 d10 m+10,+10 u10 r10 d10"
solution$(7) = "hdkgkghhddblkbmblhdb"
fois(7) = -3
dessin$(8) = "u20 r30 m-10,-10 m+20,-20 m-10,-10 u10 l10 m+20,-20 u10 r10 m+20,+20 d20 m-30,+30 r20 d10 r10 d10 r20 u30 r10 u20 r10 u30"
dessin2$(8) = "u40 r60 m-20,-20 m+40,-40 m-20,-20 u20 l20 m+40,-40 u20 r20 m+40,+40 d40 m-60,+60 r40 d20 r20 d20 r40 u60 r20 u40 r20 u60"
solution$(8) = "hhhhddddddjjkkkkjjhhggkkkkhhddllllbbbbmmmmmmddddbbddbbddddhhhhhhddhhhhddhhhhhh"
fois(8) = 2
dessin$(9) = "m+60,-60 m-40,-40 m+80,-80 r40 d60 l20 d40 r60 m+20,+20 d20 m+20,+20 r20 d20"
dessin2$(9) = "m+30,-30 m-20,-20 m+40,-40 r20 d30 l10 d20 r30 m+10,+10 d10 m+10,+10 r10 d10"
solution$(9) = "kkkjjkkkkddbbbgbbdddlbldb"
fois(9) = -2
dessin$(10) = "m+10,-10 u20 m+10,+10 u20 m+10,+10 u20 r10 d20 m+10,-10 d20 m+10,-10 d30 l20"
dessin2$(10) = "m+40,-40 u80 m+40,+40 u80 m+40,+40 u80 r40 d80 m+40,-40 d80 m+40,-40 d120 l80"
solution$(10) = "kkkkhhhhhhhhllllhhhhhhhhllllhhhhhhhhddddbbbbbbbbkkkkbbbbbbbbkkkkbbbbbbbbbbbbgggggggg"
fois(10) = 4
DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG
CALL niveau(ni, 2, titr$)

SELECT CASE ni
CASE 1
nombre = 0
CASE 2
nombre = 5
END SELECT
GOSUB agra40 'présentation

SCREEN 9
x = 635: y = 35
CIRCLE (x, y), 4, jaune, , , coef2!
GET (x - 4, y - 4)-(x + 4, y + 4), cercle

FOR jj = 1 TO 5
x = 10: y = 200: erreurs = 0
GOSUB agra6 'tirage

LOCATE 1: PRINT SPACE$(80)
IF SGN(fois(choix)) = 1 THEN
ag$ = "Agrandir": ag2$ = "Agrandissement"
ELSE
ag$ = "Réduire": ag2$ = "Reduction"
END IF

CALL titre2(ag2$)
LINE (320, 35)-(320, 275), blancbrill
DRAW "TA0 B m30,250"
DRAW "c=" + VARPTR$(jaune) + dessin$(choix)

'fenetre gauche
VIEW (20, 50)-(300, 260)
coul = rougeclair: GOSUB agra1
GOSUB agra2
'fenetre droite
VIEW (340, 50)-(630, 270)
agra13:
x = 10: y = 200
coul = vertclair: GOSUB agra1
GOSUB agra2
GOSUB agra14

IF ni = 1 THEN COLOR vertclair: LOCATE 22: PRINT "Niveau"; ni: LOCATE 22, 77: PRINT 6 - jj
CALL centre(22, jaune, ag$ + " :" + STR$(ABS(fois(choix))) + " fois")

flag = 0: reponse$ = ""

IF ni = 1 THEN
GOSUB agraniveau1
ELSE
GOSUB agraniveau2
END IF

LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)

IF solution$(choix) = reponse$ THEN
CALL exact(.7)
IF erreurs = 0 THEN re = re + 2
ELSE
CALL erreur(.8)
erreurs = erreurs + 1
DRAW "TA0 B m350,250"
DRAW "c=" + VARPTR$(rougeclair) + dessin2$(choix)
CALL centre(23, rougeclair, "Regarde")
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
LOCATE 23: PRINT SPACE$(80)
VIEW (335, 45)-(635, 275)
LINE (0, 0)-(290, 220), bleu, BF
VIEW (340, 50)-(630, 270)

IF erreurs >= 2 AND couleur = 1 THEN DRAW "TA0 B m350,250 c=" + VARPTR$(rougeclair) + dessin2$(choix)

GOTO agra13
END IF
VIEW
NEXT jj

'résultats
CALL resultats(re, ni)

EXIT SUB
'++++++++++++++++++++++++


agra14:
IF ni = 1 THEN
CALL centre(23, blanc, CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + " = tracer <-- = corriger " + rt$ + " = valider")
ELSE
COLOR blanc
LOCATE 23, 23: PRINT "= tracer <-- = corriger " + rt$ + " = valider"
LOCATE 21, 10: PRINT "[7] [8] [9]"
LOCATE 22, 10: PRINT "[4] [6]"
LOCATE 23, 10: PRINT "[1] [2] [3]"
END IF
RETURN

agra1:
FOR j = 0 TO 280 STEP 10
FOR k = 0 TO 210 STEP 10
PSET (j, k), coul
NEXT k
NEXT j
RETURN

agra2:
PUT (x - 4, y - 4), cercle, XOR
PSET (x, y), rougeclair
RETURN

agra5:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB agra2
IF r$ = "g" THEN
xx = x + 10: yy = y
ELSEIF r$ = "d" THEN
xx = x - 10: yy = y
ELSEIF r$ = "h" THEN
xx = x: yy = yy + 10
ELSEIF r$ = "b" THEN
xx = x: yy = yy - 10
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

agra6:
'tirage
DO
f = 0
z(jj) = INT(RND * 5) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj) + nombre
RETURN

agraniveau1:
DO
agra11:

MouseBorder 308, 10, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF v_mouse >= 308 AND v_mouse <= 320 THEN
'fleches
IF h_mouse >= 100 AND h_mouse <= 112 THEN
'gauche
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 116 AND h_mouse <= 128 THEN
'droite
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 133 AND h_mouse <= 145 THEN
'haut
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 150 AND h_mouse <= 160 THEN
'bas
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 270 AND h_mouse <= 380 THEN
'del
valtouche = 8
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 420 AND h_mouse <= 528 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF


IF (valtouche = 8 OR valtouche = 83) AND flag = 0 THEN BEEP: GOTO agra11
IF valtouche = 50 THEN valtouche = bas
IF valtouche = 52 THEN valtouche = gauche
IF valtouche = 54 THEN valtouche = droite
IF valtouche = 56 THEN valtouche = haut

SELECT CASE valtouche
CASE gauche
IF RIGHT$(reponse$, 1) = "d" THEN GOSUB agra5: GOTO agra12
xx = x - 10: yy = y
GOSUB agra2
IF xx < 0 THEN
xx = 0: BEEP
ELSE
reponse$ = reponse$ + "g"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE droite
IF RIGHT$(reponse$, 1) = "g" THEN GOSUB agra5: GOTO agra12
xx = x + 10: yy = y
GOSUB agra2
IF xx > 280 THEN
xx = 280: BEEP
ELSE
reponse$ = reponse$ + "d"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE haut
IF RIGHT$(reponse$, 1) = "b" THEN GOSUB agra5: GOTO agra12
xx = x: yy = y - 10
GOSUB agra2
IF yy < 0 THEN
yy = 0: BEEP
ELSE
reponse$ = reponse$ + "h"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE bas
IF RIGHT$(reponse$, 1) = "h" THEN GOSUB agra5: GOTO agra12
xx = x: yy = y + 10
GOSUB agra2
IF yy > 210 THEN
yy = 210: BEEP
ELSE
reponse$ = reponse$ + "b"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE 8, 83 'correction
GOSUB agra5

CASE 27
CALL quitter: GOSUB agra14: GOTO agra11
CASE 13
IF reponse$ = "" THEN GOTO agra11
EXIT DO
CASE ELSE
BEEP

END SELECT
agra12:
IF valtouche = 8 OR valtouche = 83 OR valtouche = gauche OR valtouche = droite OR valtouche = haut OR valtouche = bas THEN
PSET (x, y), rougeclair
x = xx: y = yy
GOSUB agra2
END IF

LOOP

RETURN

agraniveau2:
DO
agra31:
MouseBorder 282, 75, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'LOCATE 21, 40: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = hautgauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 106 AND h_mouse <= 126) THEN
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = hautdroite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 296 AND v_mouse <= 306) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 296 AND v_mouse <= 306) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = basgauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 106 AND h_mouse <= 126) THEN
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = basdroite
CALL attendre(.2)
souris = 1
EXIT DO
END IF
'ok
IF v_mouse >= 308 AND v_mouse <= 320 THEN
IF h_mouse >= 280 AND h_mouse <= 390 THEN
'del
valtouche = 8
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 440 AND h_mouse <= 540 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
END IF
END IF

LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

IF (valtouche = 8 OR valtouche = 83) AND flag = 0 THEN BEEP: GOTO agra31
IF valtouche = 49 THEN valtouche = basgauche
IF valtouche = 50 THEN valtouche = bas
IF valtouche = 51 THEN valtouche = basdroite
IF valtouche = 52 THEN valtouche = gauche
IF valtouche = 54 THEN valtouche = droite
IF valtouche = 55 THEN valtouche = hautgauche
IF valtouche = 56 THEN valtouche = haut
IF valtouche = 57 THEN valtouche = hautdroite

SELECT CASE valtouche

CASE gauche
IF RIGHT$(reponse$, 1) = "d" THEN GOSUB agra5: GOTO agra32
xx = x - 10: yy = y
GOSUB agra2
IF xx < 0 THEN
xx = 0: BEEP
ELSE
reponse$ = reponse$ + "g"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE droite
IF RIGHT$(reponse$, 1) = "g" THEN GOSUB agra5: GOTO agra32
xx = x + 10: yy = y
GOSUB agra2
IF xx > 280 THEN
xx = 280: BEEP
ELSE
reponse$ = reponse$ + "d"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE haut
IF RIGHT$(reponse$, 1) = "b" THEN GOSUB agra5: GOTO agra32
xx = x: yy = y - 10
GOSUB agra2
IF yy < 0 THEN
yy = 0: BEEP
ELSE
reponse$ = reponse$ + "h"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE bas
IF RIGHT$(reponse$, 1) = "h" THEN GOSUB agra5: GOTO agra32
xx = x: yy = y + 10
GOSUB agra2
IF yy > 210 THEN
yy = 210: BEEP
ELSE
reponse$ = reponse$ + "b"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE hautgauche
IF RIGHT$(reponse$, 1) = "l" THEN GOSUB agra35: GOTO agra32
xx = x - 10: yy = y - 10
GOSUB agra2
IF yy < 0 OR xx < 0 THEN
IF yy < 0 THEN
yy = 0: xx = xx + 10: BEEP
ELSEIF xx < 0 THEN
xx = 0: yy = yy + 10: BEEP
END IF
ELSE
reponse$ = reponse$ + "j"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE hautdroite
IF RIGHT$(reponse$, 1) = "m" THEN GOSUB agra35: GOTO agra32
xx = x + 10: yy = y - 10
GOSUB agra2
IF yy < 0 OR xx > 280 THEN
IF yy < 0 THEN
yy = 0: xx = xx - 10: BEEP
ELSEIF xx > 280 THEN
xx = 280: yy = yy + 10: BEEP
END IF
ELSE
reponse$ = reponse$ + "k"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE basgauche
IF RIGHT$(reponse$, 1) = "k" THEN GOSUB agra35: GOTO agra32
xx = x - 10: yy = y + 10
GOSUB agra2
IF yy > 210 OR xx < 0 THEN
IF yy > 210 THEN
yy = 210: xx = xx + 10: BEEP
ELSEIF xx < 0 THEN
xx = 0: yy = yy - 10: BEEP
END IF
ELSE
reponse$ = reponse$ + "m"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE basdroite
IF RIGHT$(reponse$, 1) = "j" THEN GOSUB agra35: GOTO agra32
xx = x + 10: yy = y + 10
GOSUB agra2
IF yy > 210 OR xx > 280 THEN
IF yy > 210 THEN
yy = 210: xx = xx - 10: BEEP
ELSEIF xx > 280 THEN
xx = 280: yy = yy - 10: BEEP
END IF
ELSE
reponse$ = reponse$ + "l"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE 8, 83 'correction
r$ = RIGHT$(reponse$, 1)
IF r$ = "h" OR r$ = "b" OR r$ = "g" OR r$ = "d" THEN
GOSUB agra5
ELSE
GOSUB agra35
END IF

CASE 27
CALL quitter: GOSUB agra14: GOTO agra31
CASE 13
IF reponse$ = "" THEN GOTO agra31
EXIT DO
CASE ELSE
BEEP

END SELECT

agra32:
IF valtouche = 71 OR valtouche = 73 OR valtouche = 79 OR valtouche = 81 OR valtouche = 8 OR valtouche = 83 OR valtouche = gauche OR valtouche = droite OR valtouche = haut OR valtouche = bas THEN
PSET (x, y), rougeclair
x = xx: y = yy
GOSUB agra2
END IF

LOOP

RETURN

agra35:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB agra2
IF r$ = "j" THEN
xx = x + 10: yy = y + 10
ELSEIF r$ = "k" THEN
xx = x - 10: yy = y + 10
ELSEIF r$ = "m" THEN
xx = x + 10: yy = yy - 10
ELSEIF r$ = "l" THEN
xx = x - 10: yy = yy - 10
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

agra40:


IF ni = 1 THEN
w$ = "Avec les flèches " + CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + ", tu vas devoir agrandir ou réduire"
z$ = "un certain nombre de fois un chemin."
xx$ = "Tu peux corriger tes erreurs avec la touche " + CHR$(27) + "- ou la touche suppr."
CALL consigne(3, w$, z$, xx$)

ELSE

z$ = "agrandir ou réduire la taille d'un chemin."
CALL claviernumerique(z$)
END IF

RETURN


END SUB

DEFINT A-Z
SUB frise (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
DIM dessin$(10), solution$(10), x(10), y(10), x2(10), z(5), lo(10)
DIM cercle(1 TO 50) AS INTEGER
'pour niveau 3 et 4
'3/12/96 souris

CONST gauche = 75, droite = 77
CONST haut = 72, bas = 80, hautgauche = 71, hautdroite = 73, basgauche = 79, basdroite = 81

DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG

dessin$(1) = "r50 d25 m-25,+25 d50 r25 u25 m+25,-25 r25 u50"
solution$(1) = "ddbmbbdhkdhh"
x(1) = 50: y(1) = 75: x2(1) = 250: lo(1) = 100
dessin$(2) = "d50 m+25,+25 d25 r25 u50 m+25,-25 u25 r25"
solution$(2) = "bblbdhhkhd"
x(2) = 50: y(2) = 50: x2(2) = 250: lo(2) = 100
dessin$(3) = "m+25,-25 m-25,-25 u25 r25 m+25,-25 d50 r25 d75 m+25,-25"
solution$(3) = "kjhdkbbdbbbk"
x(3) = 50: y(3) = 150: x2(3) = 250: lo(3) = 100
dessin$(4) = "m+25,+25 d25 m+25,+25 u50 m-25,-25 m+25,-25 u25 m+50,+50"
solution$(4) = "lblhhjkhll"
x(4) = 50: y(4) = 100: x2(4) = 250: lo(4) = 100
dessin$(5) = "m+25,-25 m-25,-25 u25 m+50,-50 r25 d25 m-25,+25 m+25,+25 d25 m+25,+25"
solution$(5) = "kjhkkdbmlbl"
x(5) = 50: y(5) = 175: x2(5) = 250: lo(5) = 100

dessin$(6) = "r25 d25 l25 m+25,+25 d25 m-25,+25 m+25,+25 d25 r25 u50 m+25,-25 m-25,-25 u25 r25 m+25,-25"
solution$(6) = "dbglbmlbdhhkjhdk"
x(6) = 50: y(6) = 25: x2(6) = 250: lo(6) = 100
dessin$(7) = "d25 m+25,+25 l25 m+25,+25 d25 m+25,-25 r25 m+25,+25 u25 m-75,-75 u25 r25 u25 m+25,+25 d25 r25"
solution$(7) = "blglbkdlhjjjhdhlbd"
x(7) = 50: y(7) = 75: x2(7) = 250: lo(7) = 100
dessin$(8) = "m+25,-25 u75 r25 d75 m+25,-25 u50 m-75,-75 m+25,-25 m+75,+75 d125"
solution$(8) = "khhhdbbbkhhjjjklllbbbbb"
x(8) = 50: y(8) = 200: x2(8) = 250: lo(8) = 100
dessin$(9) = "r25 u50 r25 d50 m-50,+50 d75 m+25,+25 m+25,-25 m-25,-25 m+25,-25 m+25,+25 u25 m-25,-25 m+50,-50"
solution$(9) = "dhhdbbmmbbblkjklhjkk"
x(9) = 50: y(9) = 50: x2(9) = 250: lo(9) = 100
dessin$(10) = "u75 m+25,+25 d50 m+50,-50 d25 m-50,+50 r25 m+25,-25 d25 m-50,+50 d25 m-25,+25 r25 m+25,-25 m+25,+25 m+25,-25 m-25,-25 m+25,-25 u50"
solution$(10) = "hhhlbbkkbmmdkbmmbmdklkjkhh"
x(10) = 50: y(10) = 75: x2(10) = 250: lo(10) = 100

IF ni = 3 THEN nombre = 0 ELSE nombre = 5
re = 0

GOSUB frise40 'présentation

SCREEN 9
x = 635: y = 35
CIRCLE (x, y), 4, jaune, , , coef2!
GET (x - 4, y - 4)-(x + 4, y + 4), cercle

FOR jj = 1 TO 5
erreurs = 0
GOSUB frise6 'tirage

frise13:
CALL titre2(titr$)
'COLOR vertclair: LOCATE 22: PRINT "Niveau"; ni
'LOCATE 22, 77: PRINT 6 - jj
x = x(choix) + 20: y = y(choix) + 55
FOR i = 1 TO 5
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
IF i = 3 THEN cc = bleu ELSE cc = cyanclair
IF i = 3 AND erreurs > 2 AND couleur = 1 THEN cc = rougeclair
DRAW "c=" + VARPTR$(cc) + dessin$(choix)
x = x + lo(choix)
NEXT

'fenetre
VIEW (20, 55)-(630, 260)
IF ni = 3 OR erreurs > 0 THEN GOSUB frise1
x = x2(choix): y = y(choix)
GOSUB frise2

GOSUB frise14
flag = 0: reponse$ = ""

GOSUB friseprog

VIEW

LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)

IF solution$(choix) = reponse$ THEN
CALL exact(.7)
IF erreurs = 0 THEN re = re + 2
ELSE
erreurs = erreurs + 1
IF erreurs > 1 THEN
CALL centre(23, rougeclair, "Regarde...")
x = x(choix) + 20 + (2 * lo(choix)): y = y(choix) + 55
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(rougeclair) + dessin$(choix)
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
ELSE
CALL erreur(4)
END IF
LOCATE 23: PRINT SPACE$(80)
GOTO frise13
END IF

NEXT jj

'résultats
CALL resultats(re, ni)

EXIT SUB

'++++++++++++++++++++++++

frise1:
FOR x = 0 TO 600 STEP 25
FOR y = 0 TO 200 STEP 25
PSET (x, y), rougeclair
NEXT y
NEXT x
RETURN

frise14:
COLOR blanc
LOCATE 23, 23: PRINT "= tracer <-- = corriger " + rt$ + " = valider"
LOCATE 21, 10: PRINT "[7] [8] [9]"
LOCATE 22, 10: PRINT "[4] [6]"
LOCATE 23, 10: PRINT "[1] [2] [3]"
RETURN

frise2:
PUT (x - 4, y - 4), cercle, XOR
IF ni = 3 OR erreurs > 0 THEN PSET (x, y), rougeclair
RETURN

frise5:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB frise2
IF r$ = "g" THEN
xx = x + 25: yy = y
ELSEIF r$ = "d" THEN
xx = x - 25: yy = y
ELSEIF r$ = "h" THEN
xx = x: yy = yy + 25
ELSEIF r$ = "b" THEN
xx = x: yy = yy - 25
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

frise6:
'tirage
DO
f = 0
z(jj) = INT(RND * 5) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj) + nombre
RETURN

friseprog:
DO
frise31:
MouseBorder 282, 75, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 40: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = hautgauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 106 AND h_mouse <= 126) THEN
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = hautdroite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 296 AND v_mouse <= 306) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 296 AND v_mouse <= 306) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = basgauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 106 AND h_mouse <= 126) THEN
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = basdroite
CALL attendre(.2)
souris = 1
EXIT DO
END IF
'ok
IF v_mouse >= 308 AND v_mouse <= 320 THEN
IF h_mouse >= 280 AND h_mouse <= 390 THEN
'del
valtouche = 8
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 440 AND h_mouse <= 540 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
END IF
END IF

LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

IF (valtouche = 8 OR valtouche = 83) AND flag = 0 THEN BEEP: GOTO frise31

IF valtouche = 49 OR valtouche = 38 THEN valtouche = basgauche
IF valtouche = 50 OR valtouche = 130 THEN valtouche = bas
IF valtouche = 51 OR valtouche = 34 THEN valtouche = basdroite
IF valtouche = 52 OR valtouche = 39 THEN valtouche = gauche
IF valtouche = 54 OR valtouche = 45 THEN valtouche = droite
IF valtouche = 55 OR valtouche = 138 THEN valtouche = hautgauche
IF valtouche = 56 OR valtouche = 95 THEN valtouche = haut
IF valtouche = 57 OR valtouche = 135 THEN valtouche = hautdroite

SELECT CASE valtouche

CASE gauche
IF RIGHT$(reponse$, 1) = "d" THEN GOSUB frise5: GOTO frise32
xx = x - 25: yy = y
GOSUB frise2
IF xx < 0 THEN
xx = 0: BEEP
ELSE
reponse$ = reponse$ + "g"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE droite
IF RIGHT$(reponse$, 1) = "g" THEN GOSUB frise5: GOTO frise32
xx = x + 25: yy = y
GOSUB frise2
IF xx > 600 THEN
xx = 600: BEEP
ELSE
reponse$ = reponse$ + "d"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE haut
IF RIGHT$(reponse$, 1) = "b" THEN GOSUB frise5: GOTO frise32
xx = x: yy = y - 25
GOSUB frise2
IF yy < 0 THEN
yy = 0: BEEP
ELSE
reponse$ = reponse$ + "h"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE bas
IF RIGHT$(reponse$, 1) = "h" THEN GOSUB frise5: GOTO frise32
xx = x: yy = y + 25
GOSUB frise2
IF yy > 200 THEN
yy = 200: BEEP
ELSE
reponse$ = reponse$ + "b"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE hautgauche
IF RIGHT$(reponse$, 1) = "l" THEN GOSUB frise35: GOTO frise32
xx = x - 25: yy = y - 25
GOSUB frise2
IF yy < 0 OR xx < 0 THEN
IF yy < 0 THEN
yy = 0: xx = xx + 25: BEEP
ELSEIF xx < 0 THEN
xx = 0: yy = yy + 25: BEEP
END IF
ELSE
reponse$ = reponse$ + "j"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE hautdroite
IF RIGHT$(reponse$, 1) = "m" THEN GOSUB frise35: GOTO frise32
xx = x + 25: yy = y - 25
GOSUB frise2
IF yy < 0 OR xx > 600 THEN
IF yy < 0 THEN
yy = 0: xx = xx - 25: BEEP
ELSEIF xx > 600 THEN
xx = 600: yy = yy + 25: BEEP
END IF
ELSE
reponse$ = reponse$ + "k"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE basgauche
IF RIGHT$(reponse$, 1) = "k" THEN GOSUB frise35: GOTO frise32
xx = x - 25: yy = y + 25
GOSUB frise2
IF yy > 200 OR xx < 0 THEN
IF yy > 200 THEN
yy = 200: xx = xx + 25: BEEP
ELSEIF xx < 0 THEN
xx = 0: yy = yy - 25: BEEP
END IF
ELSE
reponse$ = reponse$ + "m"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE basdroite
IF RIGHT$(reponse$, 1) = "j" THEN GOSUB frise35: GOTO frise32
xx = x + 25: yy = y + 25
GOSUB frise2
IF yy > 200 OR xx > 600 THEN
IF yy > 200 THEN
yy = 200: xx = xx - 25: BEEP
ELSEIF xx > 600 THEN
xx = 600: yy = yy - 25: BEEP
END IF
ELSE
reponse$ = reponse$ + "l"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE 8, 83 'correction
r$ = RIGHT$(reponse$, 1)
IF r$ = "h" OR r$ = "b" OR r$ = "g" OR r$ = "d" THEN
GOSUB frise5
ELSE
GOSUB frise35
END IF

CASE 27
CALL quitter: GOSUB frise14: GOTO frise31
CASE 13
IF reponse$ = "" THEN GOTO frise31
EXIT DO
CASE ELSE
BEEP

END SELECT

frise32:
IF valtouche = 71 OR valtouche = 73 OR valtouche = 79 OR valtouche = 81 OR valtouche = 8 OR valtouche = 83 OR valtouche = gauche OR valtouche = droite OR valtouche = haut OR valtouche = bas THEN
IF ni = 3 OR erreurs > 0 THEN PSET (x, y), rougeclair
x = xx: y = yy
GOSUB frise2
END IF

LOOP

RETURN

frise35:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB frise2
IF r$ = "j" THEN
xx = x + 25: yy = y + 25
ELSEIF r$ = "k" THEN
xx = x - 25: yy = y + 25
ELSEIF r$ = "m" THEN
xx = x + 25: yy = yy - 25
ELSEIF r$ = "l" THEN
xx = x - 25: yy = yy - 25
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

frise40:
z$ = "compléter une frise en partie effacée."
CALL claviernumerique(z$)
RETURN

END SUB

DEFINT A-Z
SUB symetrie (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
DIM dessin1$(10), dessin2$(10), sol2$(10), sol3$(10), sol4$(10), x(10), y(10), x2(10), y2(10), x3(10), y3(10), x4(10), y4(10), z(5)
DIM cercle(1 TO 50) AS INTEGER
'3/12/96 souris
'programme pour niveau 3 et 4

titr$ = "symetrie"
CONST gauche = 75, droite = 77
CONST haut = 72, bas = 80, hautgauche = 71, hautdroite = 73, basgauche = 79, basdroite = 81

re = 0

'niveau 1
dessin1$(1) = "u60 l20 d40 l20 u20 l20 d20 l60 u40 l20 d20 l20 u20 l20 d40 l20 d20 l40 u40 l20 u20 r20"
dessin2$(1) = "u60 r20 d40 r20 u20 r20 d20 r60 u40 r20 d20 r20 u20 r20 d40 r20 d20 r40 u40 r20 u20 l20"
sol2$(1) = "hhhdbbdhdbdddhhdbdhdbbdbddhhdhg"
sol3$(1) = "bbbghhgbghgggbbghgbghhghggbbgbd"
sol4$(1) = "bbbdhhdbdhdddbbdhdbdhhdhddbbdbg"
x(1) = 280: y(1) = 80
x2(1) = 0: y2(1) = 80
x3(1) = 280: y3(1) = 0
x4(1) = 0: y4(1) = 0
dessin1$(2) = "l20 d20 l20 u40 l40 d40 l20 d20 r40 d20 r60 u20 r20 d20 r20 u20 r20 u40 r20 d20 r20 u20 r20 d40"
dessin2$(2) = "r20 d20 r20 u40 r40 d40 r20 d20 l40 d20 l60 u20 l20 d20 l20 u20 l20 u40 l20 d20 l20 u20 l20 d40"
sol2$(2) = "dbdhhddbbdbggbggghgbghghhgbghgbb"
sol3$(2) = "ghgbbgghhghddhdddbdhdbdbbdhdbdhh"
sol4$(2) = "dhdbbddhhdhgghgggbghgbgbbghgbghh"
x(2) = 140: y(2) = 20
x2(2) = 140: y2(2) = 20
x3(2) = 140: y3(2) = 60
x4(2) = 140: y4(2) = 60
dessin1$(3) = "u20 l20 u20 r40 u20 r20 d40 r20 d40 r40 u20 r20 u40 r20 d20 r20 u40 r20 d80 r20 u40 r20 u20 r20 d40"
dessin2$(3) = "u20 r20 u20 l40 u20 l20 d40 l20 d40 l40 u20 l20 u40 l20 d20 l20 u40 l20 d80 l20 u40 l20 u20 l20 d40"
sol2$(3) = "hdhgghgbbgbbgghghhgbghhgbbbbghhghgbb"
sol3$(3) = "bgbddbdhhdhhddbdbbdhdbbdhhhhdbbdbdhh"
sol4$(3) = "bdbggbghhghhggbgbbghgbbghhhhgbbgbghh"
x(3) = 40: y(3) = 60
x2(3) = 240: y2(3) = 60
x3(3) = 40: y3(3) = 20
x4(3) = 240: y4(3) = 20
dessin1$(4) = "l60 d20 r40 d20 l60 d20 r20 d20 l60 u20 r20 u20 l60 u20 r40 u20 l60 d80 l40 u40 l20 u20"
dessin2$(4) = "r60 d20 l40 d20 r60 d20 l20 d20 r60 u20 l20 u20 r60 u20 l40 u20 r60 d80 r40 u40 r20 u20"
sol2$(4) = "dddbggbdddbgbdddhghdddhgghdddbbbbddhhdh"
sol3$(4) = "ggghddhggghdhgggbdbgggbddbggghhhhggbbgb"
sol4$(4) = "dddhgghdddhghdddbgbdddbggbdddhhhhddbbdb"
x(4) = 280: y(4) = 0
x2(4) = 0: y2(4) = 0
x3(4) = 280: y3(4) = 80
x4(4) = 0: y4(4) = 80
dessin1$(5) = "u20 l20 d20 l20 u20 l20 d20 l20 u60 r20 d20 r20 u20 r20 d20 r20 u20 r60 d40 r40 u20 r20 d20 r20 u60 r20 d20"
dessin2$(5) = "u20 r20 d20 r20 u20 r20 d20 r20 u60 l20 d20 l20 u20 l20 d20 l20 u20 l60 d40 l40 u20 l20 d20 l20 u60 l20 d20"
sol2$(5) = "hdbdhdbdhhhgbghgbghgggbbgghgbghhhgb"
sol3$(5) = "bghgbghgbbbdhdbdhdbdddhhddbdhdbbbdh"
sol4$(5) = "bdhdbdhdbbbghgbghgbggghhggbghgbbbgh"
x(5) = 100: y(5) = 80
x2(5) = 180: y2(5) = 80
x3(5) = 100: y3(5) = 0
x4(5) = 180: y4(5) = 0

'niveau 2 = angle 45
dessin1$(6) = "u20 m-20,-20 u20 l20 d20 m-20,-20 m-20,+20 d20 l20 u40 l20 d60 l40 u20 m-20,-20 m-40,+40 u40 m+20,-20 l60 d40"
dessin2$(6) = "u20 m+20,-20 u20 r20 d20 m+20,-20 m+20,+20 d20 r20 u40 r20 d60 r40 u20 m+20,-20 m+40,+40 u40 m-20,-20 r60 d40"
sol2$(6) = "hkhdbklbdhhdbbbddhkllhhjdddbb"
sol3$(6) = "bmbghmjhgbbghhhggbmjjbblggghh"
sol4$(6) = "blbdhlkhdbbdhhhddblkkbbmdddhh"
x(6) = 280: y(6) = 80
x2(6) = 0: y2(6) = 80
x3(6) = 280: y3(6) = 0
x4(6) = 0: y4(6) = 0
dessin1$(7) = "m-20,-20 m+20,-20 r20 m+20,+20 r20 m+20,-20 m+20,+20 d40 r40 u20 m+20,-20 r20 m+20,-20 m+20,+20 d40 l20"
dessin2$(7) = "m+20,-20 m-20,-20 l20 m-20,+20 l20 m-20,-20 m-20,+20 d40 l40 u20 m-20,-20 l20 m-20,-20 m-20,+20 d40 r20"
sol2$(7) = "kjgmgjmbbgghjgjmbbd"
sol3$(7) = "mldkdlkhhddbldlkhhg"
sol4$(7) = "lmgjgmjhhggbmgmjhhd"
x(7) = 60: y(7) = 60
x2(7) = 220: y2(7) = 60
x3(7) = 60: y3(7) = 20
x4(7) = 220: y4(7) = 20
dessin1$(8) = "m-20,+20 l60 m-20,+20 l20 m+20,-20 l60 d40 r60 m+20,+20 r60 m+20,-20 u20 r20 m+20,+20 r20 m-20,-20 r40 m+20,-20 u20"
dessin2$(8) = "m+20,+20 r60 m+20,+20 r20 m-20,-20 r60 d40 l60 m-20,+20 l60 m-20,-20 u20 l20 m-20,+20 l20 m+20,-20 l40 m-20,-20 u20"
sol2$(8) = "ldddldjdddbbgggmgggjhgmgkggjh"
sol3$(8) = "jgggjglggghhdddkdddlbdkdmddlb"
sol4$(8) = "kdddkdmdddhhgggjgggmbgjglggmb"
x(8) = 180: y(8) = 0
x2(8) = 100: y2(8) = 0
x3(8) = 180: y3(8) = 80
x4(8) = 100: y4(8) = 80
dessin1$(9) = "m-60,+60 m-20,-20 l20 m-40,+40 u40 l60 m-20,+20 m-20,-20 m+40,-40 m+20,+20 r20"
dessin2$(9) = "m+60,+60 m+20,-20 r20 m+40,+40 u40 r60 m+20,+20 m+20,-20 m-40,-40 m-20,+20 l20"
sol2$(9) = "lllkdllhhdddlkjjmg"
sol3$(9) = "jjjmgjjbbgggjmllkd"
sol4$(9) = "kkkldkkbbdddklmmjg"
x(9) = 280: y(9) = 0
x2(9) = 0: y2(9) = 0
x3(9) = 280: y3(9) = 80
x4(9) = 0: y4(9) = 80
dessin1$(10) = "m-60,-60 m+20,-20 m+80,+80 m+20,-20 m-40,-40 m+20,-20 m+80,+80 m+20,-20 m-20,-20 m+20,-20 r20 d60"
dessin2$(10) = "m+60,-60 m-20,-20 m-80,+80 m-20,-20 m+40,-40 m-20,-20 m-80,+80 m-20,-20 m+20,-20 m-20,-20 l20 d60"
sol2$(10) = "kkkjmmmmjkkjmmmmjkjgbbb"
sol3$(10) = "mmmlkkkklmmlkkkklmldhhh"
sol4$(10) = "lllmjjjjmllmjjjjmlmghhh"
x(10) = 120: y(10) = 80
x2(10) = 160: y2(10) = 80
x3(10) = 120: y3(10) = 0
x4(10) = 160: y4(10) = 0
DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG

SELECT CASE ni
CASE 3
nombre = 0
CASE 4
nombre = 5
END SELECT

GOSUB sym40 'présentation

CLS
x = 635: y = 35
CIRCLE (x, y), 4, jaune, , , coef2!
GET (x - 4, y - 4)-(x + 4, y + 4), cercle

FOR jj = 1 TO 3
GOSUB sym6 'tirage
erreurs = 0
CALL titre2(titr$)
LINE (320, 35)-(320, 275), blancbrill
LINE (5, 155)-(635, 155), blancbrill
x = x(choix) + 20: y = y(choix) + 50
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(jaune) + dessin1$(choix)
'fenetre gauchehaute
VIEW (20, 50)-(300 + 4, 130 + 4)
coul = rougeclair: GOSUB sym1
x = x(choix): y = y(choix)
GOSUB sym2

FOR jj2 = 1 TO 3
erreurs = 0
sym13:
IF ni = 3 THEN COLOR vertclair: LOCATE 22: PRINT "Niveau"; ni: LOCATE 22, 77: PRINT 4 - jj

SELECT CASE jj2
CASE 1
'fenetre droitehaute 1
VIEW (340, 50)-(625, 135)
coul = vertclair: GOSUB sym1
x = x2(choix): y = y2(choix): GOSUB sym2
sol$ = sol2$(choix)
CASE 2
'fenetre gauchebasse 2
VIEW (20, 180)-(305, 265)
coul = vertclair: GOSUB sym1
x = x3(choix): y = y3(choix): GOSUB sym2
sol$ = sol3$(choix)
CASE 3
'fenetre droitebasse 3
VIEW (340, 180)-(625, 265)
coul = vertclair: GOSUB sym1
x = x4(choix): y = y4(choix): GOSUB sym2
sol$ = sol4$(choix)
END SELECT

GOSUB sym14

flag = 0: reponse$ = ""
IF ni = 3 THEN
GOSUB symniveau1
ELSEIF ni = 4 THEN
GOSUB symniveau2
END IF
'VIEW
LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)

IF sol$ = reponse$ THEN
CALL exact(.7): GOSUB sym2: IF erreurs = 0 THEN re = re + 1
ELSE
erreurs = erreurs + 1
CALL centre(23, rougeclair, "Les chemins ne sont pas symétriques.")
CALL attendre(1.5)
LOCATE 23: PRINT SPACE$(80)
CALL centre(23, rougeclair, "Regarde")

SELECT CASE jj2
CASE 1
x = x2(choix) + 340: y = y2(choix) + 50
dessin$ = dessin2$(choix)
CASE 2
x = x3(choix) + 20: y = y3(choix) + 180
dessin$ = "a2 " + dessin2$(choix)
CASE 3
x = x4(choix) + 340: y = y4(choix) + 180
dessin$ = "a2 " + dessin1$(choix)
END SELECT
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(rougeclair) + dessin$
CALL getinvi(r): IF r = 27 THEN CALL quitter
LOCATE 23: PRINT SPACE$(80)

SELECT CASE jj2
CASE 1
VIEW (335, 45)-(625, 135)
LINE (0, 0)-(290, 90), bleu, BF
VIEW (340, 50)-(620 + 4, 130 + 4)
CASE 2
VIEW (15, 175)-(305, 265)
LINE (0, 0)-(290, 90), bleu, BF
VIEW (20, 180)-(305, 265)
CASE 3
VIEW (335, 175)-(625, 265)
LINE (0, 0)-(290, 90), bleu, BF
VIEW (340, 180)-(625, 265)
END SELECT
GOSUB sym1

IF erreurs > 1 AND couleur = 1 THEN DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y): DRAW "c=" + VARPTR$(rougeclair) + dessin$
GOTO sym13
END IF
VIEW
NEXT jj2

CALL entree

NEXT jj

'résultats
re = re + 1 'neuf essais
CALL resultats(re, ni)

EXIT SUB
'++++++++++++++++++++++++

sym14:
IF ni = 3 THEN
CALL centre(23, blanc, CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + " = tracer <-- = corriger " + rt$ + " = valider")
ELSE
COLOR blanc
LOCATE 23, 23: PRINT "= tracer <-- = corriger " + rt$ + " = valider"
LOCATE 21, 10: PRINT "[7] [8] [9]"
LOCATE 22, 10: PRINT "[4] [6]"
LOCATE 23, 10: PRINT "[1] [2] [3]"
END IF
RETURN

sym1:
FOR w = 0 TO 300 STEP 20
FOR z = 0 TO 130 STEP 20
PSET (w, z), coul
NEXT z
NEXT w
RETURN

sym2:
PUT (x - 4, y - 4), cercle, XOR
PSET (x, y), rougeclair
RETURN

sym5:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB sym2
IF r$ = "g" THEN
xx = x + 20: yy = y
ELSEIF r$ = "d" THEN
xx = x - 20: yy = y
ELSEIF r$ = "h" THEN
xx = x: yy = yy + 20
ELSEIF r$ = "b" THEN
xx = x: yy = yy - 20
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

sym6:
'tirage
DO
f = 0
z(jj) = INT(RND * 3) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj) + nombre
RETURN

symniveau1:
DO
sym11:
MouseBorder 308, 10, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF v_mouse >= 308 AND v_mouse <= 320 THEN
'fleches
IF h_mouse >= 100 AND h_mouse <= 112 THEN
'gauche
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 116 AND h_mouse <= 128 THEN
'droite
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 133 AND h_mouse <= 145 THEN
'haut
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 150 AND h_mouse <= 160 THEN
'bas
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 270 AND h_mouse <= 380 THEN
'del
valtouche = 8
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 420 AND h_mouse <= 528 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF


IF (valtouche = 8 OR valtouche = 83) AND flag = 0 THEN BEEP: GOTO sym11
IF valtouche = 50 THEN valtouche = bas
IF valtouche = 52 THEN valtouche = gauche
IF valtouche = 54 THEN valtouche = droite
IF valtouche = 56 THEN valtouche = haut

SELECT CASE valtouche
CASE gauche
IF RIGHT$(reponse$, 1) = "d" THEN GOSUB sym5: GOTO sym12
xx = x - 20: yy = y
GOSUB sym2
IF xx < 0 THEN
xx = 0: BEEP
ELSE
reponse$ = reponse$ + "g"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE droite
IF RIGHT$(reponse$, 1) = "g" THEN GOSUB sym5: GOTO sym12
xx = x + 20: yy = y
GOSUB sym2
IF xx > 280 THEN
xx = 280: BEEP
ELSE
reponse$ = reponse$ + "d"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE haut
IF RIGHT$(reponse$, 1) = "b" THEN GOSUB sym5: GOTO sym12
xx = x: yy = y - 20
GOSUB sym2
IF yy < 0 THEN
yy = 0: BEEP
ELSE
reponse$ = reponse$ + "h"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE bas
IF RIGHT$(reponse$, 1) = "h" THEN GOSUB sym5: GOTO sym12
xx = x: yy = y + 20
GOSUB sym2
IF yy > 80 THEN
yy = 80: BEEP
ELSE
reponse$ = reponse$ + "b"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE 8, 83 'correction
GOSUB sym5

CASE 27
CALL quitter: GOSUB sym14: GOTO sym11
CASE 13
IF reponse$ = "" THEN GOTO sym11
EXIT DO
CASE ELSE
BEEP

END SELECT
sym12:
IF valtouche = 8 OR valtouche = 83 OR valtouche = gauche OR valtouche = droite OR valtouche = haut OR valtouche = bas THEN
PSET (x, y), rougeclair
x = xx: y = yy
GOSUB sym2
END IF

LOOP

RETURN

symniveau2:
DO
sym31:
MouseBorder 282, 75, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 40: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = hautgauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 106 AND h_mouse <= 126) THEN
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = hautdroite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 296 AND v_mouse <= 306) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 296 AND v_mouse <= 306) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = basgauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 106 AND h_mouse <= 126) THEN
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = basdroite
CALL attendre(.2)
souris = 1
EXIT DO
END IF
'ok
IF v_mouse >= 308 AND v_mouse <= 320 THEN
IF h_mouse >= 280 AND h_mouse <= 390 THEN
'del
valtouche = 8
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 440 AND h_mouse <= 540 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
END IF
END IF

LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

IF (valtouche = 8 OR valtouche = 83) AND flag = 0 THEN BEEP: GOTO sym31

IF valtouche = 49 OR valtouche = 38 THEN valtouche = basgauche
IF valtouche = 50 OR valtouche = 130 THEN valtouche = bas
IF valtouche = 51 OR valtouche = 34 THEN valtouche = basdroite
IF valtouche = 52 OR valtouche = 39 THEN valtouche = gauche
IF valtouche = 54 OR valtouche = 45 THEN valtouche = droite
IF valtouche = 55 OR valtouche = 138 THEN valtouche = hautgauche
IF valtouche = 56 OR valtouche = 95 THEN valtouche = haut
IF valtouche = 57 OR valtouche = 135 THEN valtouche = hautdroite

SELECT CASE valtouche

CASE gauche
IF RIGHT$(reponse$, 1) = "d" THEN GOSUB sym5: GOTO sym32
xx = x - 20: yy = y
GOSUB sym2
IF xx < 0 THEN
xx = 0: BEEP
ELSE
reponse$ = reponse$ + "g"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE droite
IF RIGHT$(reponse$, 1) = "g" THEN GOSUB sym5: GOTO sym32
xx = x + 20: yy = y
GOSUB sym2
IF xx > 280 THEN
xx = 280: BEEP
ELSE
reponse$ = reponse$ + "d"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE haut
IF RIGHT$(reponse$, 1) = "b" THEN GOSUB sym5: GOTO sym32
xx = x: yy = y - 20
GOSUB sym2
IF yy < 0 THEN
yy = 0: BEEP
ELSE
reponse$ = reponse$ + "h"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE bas
IF RIGHT$(reponse$, 1) = "h" THEN GOSUB sym5: GOTO sym32
xx = x: yy = y + 20
GOSUB sym2
IF yy > 80 THEN
yy = 80: BEEP
ELSE
reponse$ = reponse$ + "b"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE hautgauche
IF RIGHT$(reponse$, 1) = "l" THEN GOSUB sym35: GOTO sym32
xx = x - 20: yy = y - 20
GOSUB sym2
IF yy < 0 OR xx < 0 THEN
IF yy < 0 THEN
yy = 0: xx = xx + 20: BEEP
ELSEIF xx < 0 THEN
xx = 0: yy = yy + 20: BEEP
END IF
ELSE
reponse$ = reponse$ + "j"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE hautdroite
IF RIGHT$(reponse$, 1) = "m" THEN GOSUB sym35: GOTO sym32
xx = x + 20: yy = y - 20
GOSUB sym2
IF yy < 0 OR xx > 280 THEN
IF yy < 0 THEN
yy = 0: xx = xx - 20: BEEP
ELSEIF xx > 280 THEN
xx = 280: yy = yy + 20: BEEP
END IF
ELSE
reponse$ = reponse$ + "k"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE basgauche
IF RIGHT$(reponse$, 1) = "k" THEN GOSUB sym35: GOTO sym32
xx = x - 20: yy = y + 20
GOSUB sym2
IF yy > 80 OR xx < 0 THEN
IF yy > 80 THEN
yy = 80: xx = xx + 20: BEEP
ELSEIF xx < 0 THEN
xx = 0: yy = yy - 20: BEEP
END IF
ELSE
reponse$ = reponse$ + "m"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE basdroite
IF RIGHT$(reponse$, 1) = "j" THEN GOSUB sym35: GOTO sym32
xx = x + 20: yy = y + 20
GOSUB sym2
IF yy > 80 OR xx > 280 THEN
IF yy > 80 THEN
yy = 80: xx = xx - 20: BEEP
ELSEIF xx > 280 THEN
xx = 280: yy = yy - 20: BEEP
END IF
ELSE
reponse$ = reponse$ + "l"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE 8, 83 'correction
r$ = RIGHT$(reponse$, 1)
IF r$ = "h" OR r$ = "b" OR r$ = "g" OR r$ = "d" THEN
GOSUB sym5
ELSE
GOSUB sym35
END IF

CASE 27
CALL quitter: GOSUB sym14: GOTO sym31
CASE 13
IF reponse$ = "" THEN GOTO sym31
EXIT DO
CASE ELSE
BEEP

END SELECT

sym32:
IF valtouche = 71 OR valtouche = 73 OR valtouche = 79 OR valtouche = 81 OR valtouche = 8 OR valtouche = 83 OR valtouche = gauche OR valtouche = droite OR valtouche = haut OR valtouche = bas THEN
PSET (x, y), rougeclair
x = xx: y = yy
GOSUB sym2
END IF

LOOP

RETURN

sym35:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB sym2
IF r$ = "j" THEN
xx = x + 20: yy = y + 20
ELSEIF r$ = "k" THEN
xx = x - 20: yy = y + 20
ELSEIF r$ = "m" THEN
xx = x + 20: yy = yy - 20
ELSEIF r$ = "l" THEN
xx = x - 20: yy = yy - 20
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

sym40:
IF ni = 3 THEN
w$ = "Avec les flèches " + CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + ", tu vas devoir"
z$ = "reproduire symétriquement un chemin."
xx$ = "Tu peux corriger tes erreurs avec la touche " + CHR$(27) + "- ou la touche suppr."
CALL consigne(3, w$, z$, xx$)

ELSEIF ni = 4 THEN
z$ = "reproduire symétriquement un chemin."
CALL claviernumerique(z$)
END IF

SCREEN 9

CALL titre2(titr$)
LINE (320, 35)-(320, 275), blancbrill
LINE (5, 155)-(635, 155), blancbrill
IF ni = 3 THEN c = 1 ELSE c = 6
dessin1$ = dessin1$(c)
dessin2$ = dessin2$(c)
x = 300: y = 130
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(jaune) + dessin1$
x = 340: y = 130
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(blancbrill) + dessin2$
x = 300: y = 180
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(blancbrill) + "a2" + dessin2$
x = 300 + 40: y = 180
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(blancbrill) + "a2" + dessin1$

CALL centre(23, jaune, "Un exemple")
CALL getinvimouse(r): IF r = 27 THEN CALL quitter

RETURN

END SUB
 

 

DECLARE SUB MouseBorder (row1%, col1%, row2%, col2%)
DECLARE SUB MouseInit ()
DECLARE SUB fleches (v%, h%, w$(), np%, r%, coul%, drap%, v2%, h3%)
DECLARE SUB MouseHide ()
DECLARE SUB MousePoll (row%, col%, lButton%, rButton%)
DECLARE SUB MouseShow ()
DECLARE SUB getinvimouse (rr%)
DECLARE SUB consigne (nl%, w$, z$, xx$)
DECLARE SUB cadre (v%, h%, l%, nli%, c%)
DECLARE SUB centre (v%, coul%, ph$)
DECLARE SUB quitter ()
DECLARE SUB getinvi (rr%)
DECLARE SUB niveau (r%, np%, titr$)
DECLARE SUB titre (titr$)
DECLARE SUB attendre (tx!)
DECLARE SUB cadre3 (v%, h%, nb%, coul%)
DECLARE SUB entree ()
DECLARE SUB erreur (tx!)
DECLARE SUB exact (tx!)
DECLARE SUB inputgen (nl%, r$, deb%, fin%)
DECLARE SUB resultats (re%, ni%)
DECLARE SUB titre2 (titr$)
DECLARE SUB titre3 (titr$)
DECLARE SUB flechesbis (v%, h%, p$(), np%, r%)
'exo 3 géométrie
'Daniel Clerc 7/4/96
'version 1.5


DEFINT A-Z
SUB aire (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
DIM z(10)
DIM a(1 TO 30) AS INTEGER
DIM B(1 TO 30) AS INTEGER
DIM c(1 TO 30) AS INTEGER
DIM d(1 TO 30) AS INTEGER

titr$ = "perimetre - aire"
DEF SEG = 0
POKE &H417, (PEEK(&H417) OR &h30)'numérique
POKE &H417, (PEEK(&H417) OR &H40) 'MAJ
DEF SEG
'présentation
w$ = "Des carrés ou des rectangles vont s'afficher à l'écran."
z$ = "Tu devras calculer le périmètre puis l'aire de ces figures."
CALL consigne(2, w$, z$, xx$)

SCREEN 9, , 0, 1
'mémorisation des lettres : matrice 8 x 14
x = 0: y = 0
PRINT "A B C D"
GET (x, y)-(x + 7, y + 13), a
x = x + 16
GET (x, y)-(x + 7, y + 13), B
x = x + 16
GET (x, y)-(x + 7, y + 13), c
x = x + 16
GET (x, y)-(x + 7, y + 13), d
LOCATE 1: PRINT SPACE$(10)

SCREEN 9, , 0, 0

FOR jj = 1 TO 5
CALL titre3(titr$)
erreurs = 0
'tirage
DO
f = 0
z(jj) = INT(RND * 5) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj)

SELECT CASE choix
CASE 1
y! = coef1! * 100: x1 = 60: y1 = 105: x2 = 300: y2 = 100
CASE 2
y! = coef1! * 120: x1 = 160: y1 = 95: x2 = 120: y2 = 120'carre
CASE 3
y! = coef1! * 60: x1 = 100: y1 = 125: x2 = 240: y2 = 60
CASE 4
y! = coef1! * 20: x1 = 50: y1 = 145: x2 = 320: y2 = 20
CASE 5
y! = coef1! * 160: x1 = 140: y1 = 75: x2 = 160: y2 = 160'carré
END SELECT


LOCATE 23: PRINT SPACE$(80)
LOCATE 22, 77: COLOR vertclair: PRINT 6 - jj

GOSUB aire0bis
perimetre = (ab + bc) * 2
surface = ab * bc
COLOR blancbrill
LOCATE 7, 58: PRINT "Calcul du périmètre"
COLOR vertclair
LOCATE 10, 62: PRINT "AB ="; ab; "m"
LOCATE 12, 62: PRINT "BC ="; bc; "m"
'COLOR blanc
CALL cadre3(18, 67, 2, blancbrill)
aire10:
COLOR blanc
LOCATE 15, 59: PRINT "Tape la réponse : "
COLOR blancbrill
LOCATE 18, 71: PRINT "m "
LOCATE 18, 67: CALL inputgen(2, r$, 48, 57)
r = VAL(r$)
IF r = perimetre THEN
CALL exact(.7)
IF erreurs = 0 THEN re = re + 1
ELSE
erreurs = erreurs + 1
CALL erreur(.5)
LOCATE 23: PRINT SPACE$(80)
GOSUB aire1bis
IF r = perimetre / 2 THEN
CALL centre(23, rougeclair, "Tu as calculé le demi-périmètre !")
GOTO aire10
ELSEIF r = surface THEN
CALL centre(23, rougeclair, "Tu as calculé l'aire !")
GOTO aire10
END IF
SELECT CASE erreurs
CASE 1
IF ab = bc THEN
CALL centre(23, jaune, "Périmètre du carré = côté x 4")
ELSE
CALL centre(23, jaune, "Périmètre = (longueur + largeur) x 2")
END IF
CASE 2
IF ab = bc THEN
CALL centre(23, jaune, "Périmètre du carré = " + LTRIM$(STR$(ab)) + " x 4")
ELSE
CALL centre(23, jaune, "Périmètre = (" + LTRIM$(STR$(ab)) + " + " + LTRIM$(STR$(bc)) + ") x 2")
END IF
CASE ELSE
CALL centre(23, rougeclair, "solution :" + STR$(perimetre))
END SELECT
GOTO aire10
END IF
LOCATE 23: PRINT SPACE$(80)
IF erreurs <> 0 THEN
LINE (0, 28)-(426, 279), bleu, BF
GOSUB aire0bis
END IF
PAINT (210, 147), rouge, blancbrill
CALL cadre3(18, 67, 2, blancbrill)
erreurs = 0

aire11:
LOCATE 7, 58: PRINT "Calcul de l'aire "
COLOR blanc
LOCATE 15, 59: PRINT "Tape la réponse : "
COLOR blancbrill
LOCATE 18, 71: PRINT "m²"
LOCATE 18, 67: CALL inputgen(2, r$, 48, 57)

r = VAL(r$)
IF r = surface THEN
CALL exact(.7)
IF erreurs = 0 THEN re = re + 1
ELSE
erreurs = erreurs + 1
CALL erreur(.5)
LOCATE 23: PRINT SPACE$(80)
GOSUB aire2bis
IF r = perimetre / 2 THEN
CALL centre(23, rougeclair, "L'aire n'est pas une longueur !")
GOTO aire11
ELSEIF r = perimetre THEN
CALL centre(23, rougeclair, "Tu as confondu le périmètre et l'aire !")
GOTO aire11
END IF
SELECT CASE erreurs
CASE 1
IF ab = bc THEN
CALL centre(23, jaune, "Aire du carré = côté x côté")
ELSE
CALL centre(23, jaune, "Aire = longueur x largeur")
END IF
CASE 2
CALL centre(23, jaune, "Aire = " + LTRIM$(STR$(ab)) + " x " + LTRIM$(STR$(bc)))
CASE ELSE
CALL centre(23, rougeclair, "solution :" + STR$(surface))
END SELECT

GOTO aire11
END IF

NEXT jj

'++++++++++

'résultats
CALL resultats(re, ni)
EXIT SUB

aire0bis:
DRAW "b m=" + VARPTR$(x1) + ",=" + VARPTR$(y1) + " c15 d=" + VARPTR$(y!) + "r=" + VARPTR$(x2) + " u=" + VARPTR$(y!) + " l=" + VARPTR$(x2)
x = x1 - 17: y = y1 - 10: GOSUB lettrea
x = x1 + x2 + 10: y = y1 - 10: GOSUB lettreb
x = x1 + x2 + 10: y = y! + y1 - 2: GOSUB lettrec
x = x1 - 17: y = y! + y1 - 2: GOSUB lettred
ab = x2 / 20: bc = y2 / 20
RETURN

aire1bis:
FOR j = 0 TO x2 STEP 20
LINE (j + x1, y1 - 3)-(j + x1, 2 + y1), rougeclair
LINE (j + x1, y1 + y! - 2)-(j + x1, 3 + y1 + y!), rougeclair
NEXT
'
FOR j = 0 TO y! - 8 STEP 20 * coef1!
LINE (x1 - 3, j + y1)-(x1 + 2, j + y1), rougeclair
LINE (x1 + x2 - 2, j + y1)-(x1 + x2 + 3, j + y1), rougeclair
NEXT
'- 8 pour annuler la dernière ligne
LINE (x1 - 3, y1 + y!)-(x1 + 2, y! + y1), rougeclair
LINE (x1 + x2 - 2, y! + y1)-(x1 + x2 + 3, y! + y1), rougeclair
RETURN

aire2bis:
IF couleur = 1 THEN cc = blancbrill ELSE cc = 0
FOR j = 0 TO x2 STEP 20
LINE (j + x1, y1)-(j + x1, y! + y1), cc
NEXT
FOR j = 0 TO y! - 8 STEP 20 * coef1!
LINE (x1, j + y1)-(x1 + x2, j + y1), cc
NEXT
'- 8 pour annuler la dernière ligne
RETURN

lettrea:
PUT (x, y), a, XOR
RETURN

lettreb:
PUT (x, y), B, XOR
RETURN

lettrec:
PUT (x, y), c, XOR
RETURN

lettred:
PUT (x, y), d, XOR
RETURN

END SUB

DEFINT A-Z
SUB convexe (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
'3/12/96 souris
CONST pi = 3.141592653589#, x = 210, y = 170

DIM z(10), an$(2), x1(7), y1(7), x2(7), y2(7), x3(7), y3(7), x4(7), y4(7), dessin$(7), sol(7)
re = 0

an$(1) = "Forme convexe"
an$(2) = "Forme concave"

x1(1) = 80: y1(1) = 70: x2(1) = 220: y2(1) = 110
x3(1) = 380: y3(1) = 70: x4(1) = 230: y4(1) = 80
dessin$(1) = "b m80,70 c15 m220,110 m380,70 m380,240 m80,240 m80,70"
sol(1) = 2
x1(2) = 260: y1(2) = 90: x2(2) = 300: y2(2) = 170
x3(2) = 380: y3(2) = 210: x4(2) = 310: y4(2) = 150
dessin$(2) = "b m260,90 c15 m300,170 m380,210 m200,240 m70,220 m60,130 m120,70 m260,90"
sol(2) = 2
dessin$(3) = "b m70,150 c15 m200,70 m330,150 m200,230 m70,150"
sol(3) = 1
dessin$(4) = "b m260,90 c15 m350,160 m320,200 m200,230 m90,220 m60,130 m120,70 m260,90"
sol(4) = 1
x1(5) = 260: y1(5) = 170: x2(5) = 297: y2(5) = 134
x3(5) = 260: y3(5) = 235: x4(5) = 270: y4(5) = 170
'cercle
sol(5) = 2
x1(6) = 60: y1(6) = 240: x2(6) = 90: y2(6) = 170
x3(6) = 60: y3(6) = 70: x4(6) = 80: y4(6) = 170
dessin$(6) = "b m60,240 c15 m90,170 m60,70 m340,70 m380,170 m340,240 m60,240"
sol(6) = 2
dessin$(7) = "b m140,90 c15 m240,90 m360,240 m80,240 m140,90"
sol(7) = 1

'présentation
w$ = "Des formes vont s'afficher à l'écran."
z$ = "Tu devras choisir entre convexe ou concave."
CALL consigne(2, w$, z$, xx$)

SCREEN 9, , 0, 1
CALL titre2(titr$)
LINE (310, 30)-(310, 280), blancbrill
LOCATE 22, 15: PRINT an$(1)
LOCATE 22, 55: PRINT an$(2)
DRAW "b m50,130 c15 m110,60 m240,90 m270,180 m180,250 m80,230 m50,130"
PAINT (140, 170), rouge, blancbrill
DRAW "b m350,190 c15 m390,80 m510,70 m600,110 m580,230 m530,210 m440,250 m350,190"
PAINT (440, 170), rouge, blancbrill
SCREEN 9, , 0, 0
CALL attendre(1.5)
CIRCLE (530, 210), 20, jaune, , , coef2!
CALL entree
CLS
CALL titre3(titr$)

FOR jj = 1 TO 5
erreurs = 0
'tirage
DO
f = 0
z(jj) = INT(RND * 7) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj)

conv10:
'SCREEN 9, , 1, 0 '===
CALL titre3(titr$)
LINE (0, 28)-(426, 270), bleu, BF
LINE (440, 70)-(620, 220), noir, BF
IF choix <> 5 THEN
DRAW dessin$(choix)
ELSE
CIRCLE (x, y), 100, blancbrill, 30 * (pi / 180), 300 * (pi / 180)'sans coef2!
LINE (297, 134)-(260, 170), blancbrill
LINE -(260, 235)
END IF
PAINT (x, y), rouge, blancbrill

'SCREEN 9, , 1, 1 '===
MouseInit
MouseShow
conv11:
LOCATE 23: PRINT SPACE$(80)
LOCATE 22, 77: COLOR vertclair: PRINT 6 - jj
COLOR blanc: LOCATE 18, 62: PRINT gg$

CALL flechesbis(11, 62, an$(), 2, r)

IF r = 0 THEN CALL quitter: GOTO conv11
IF r = sol(choix) THEN
CALL exact(.7)
IF erreurs = 0 THEN re = re + 2
ELSE
erreurs = erreurs + 1
CALL erreur(.5)
LOCATE 23: PRINT SPACE$(80)
IF sol(choix) = 2 THEN
CALL centre(23, rougeclair, "Regarde")
LINE (x1(choix), y1(choix))-(x2(choix), y2(choix)), rougeclair
LINE -(x3(choix), y3(choix)), rougeclair
LINE -(x1(choix), y1(choix)), rougeclair
IF couleur = 1 THEN cc = vert: cc2 = rougeclair ELSE cc = 7: cc2 = 0
PAINT (x4(choix), y4(choix)), cc, cc2
CALL attendre(4)
END IF
IF sol(choix) = 2 THEN GOTO conv10 ELSE GOTO conv11
END IF
LOCATE 23: PRINT SPACE$(80)
NEXT jj

'++++++++++

'résultats
CALL resultats(re, ni)

END SUB

DEFINT A-Z
SUB droitegauche (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
'1/12/96
DIM tortue1(1 TO 140) AS INTEGER
DIM tortue2(1 TO 200) AS INTEGER
DIM tortue3(1 TO 140) AS INTEGER
DIM tortue4(1 TO 200) AS INTEGER
z = 15
DIM pa(20), pa$(20), dessin$(z), parcours$(z), z(3), x(z), y(z)
titr$ = "droite - gauche"
'dessin de la tortue
tortue$ = "c15 m-10,+0 m+10,-20 m+10,+20 m-10,+0 b m+2,-1 p12,15 c0 m-4,+0 m+0,+1 m+4,0 m-2,0"

'tracés niveau 1 (idem à math CE niv 1)
dessin$(1) = "u40 r80 u40 r80 u40 l40 u40 r120 u40 r40"
parcours$(1) = "adagadagagadadagada"
x(1) = 200: y(1) = 260
dessin$(2) = "u40 l80 u40 r40 u40 l80 u40 r120 u40 r80"
parcours$(2) = "agadadagagadadagada"
x(2) = 320: y(2) = 260
dessin$(3) = "u40 l80 u40 l40 u40 l80 u40 r120 u40 l40"
parcours$(3) = "agadagadagadadagaga"
x(3) = 440: y(3) = 260
dessin$(4) = "u40 r200 u40 l200 u40 r200 u40 l160 u40 r80"
parcours$(4) = "adagagadadagagadada"
x(4) = 200: y(4) = 260
dessin$(5) = "u40 r40 u40 l120 u40 l80 u40 r40 u40 l120"
parcours$(5) = "adagagadagadadagaga"
x(5) = 440: y(5) = 260

'tracés niveau 2
dessin$(6) = "u120 r130 u50 r120 d90 r80 d80"
parcours$(6) = "adagadadagada"
x(6) = 170: y(6) = 240
dessin$(7) = "u150 r70 d50 r60 u50 r80 d150 r100"
parcours$(7) = "adadagagadadaga"
x(7) = 170: y(7) = 230
dessin$(8) = "u90 l60 u70 r140 d70 r90 d90 l90"
parcours$(8) = "agadadadagadada"
x(8) = 250: y(8) = 240
dessin$(9) = "u70 r120 d70 r130 d100 l130 u50 l120"
parcours$(9) = "adadagadadadaga"
x(9) = 200: y(9) = 140
dessin$(10) = "u120 l100 u50 l110 d100 l80 d70"
parcours$(10) = "agadagagadaga"
x(10) = 450: y(10) = 240

'tracés difficiles NIV 3
dessin$(11) = "u90 l80 d160 r190 u160 r80 d90 r80 d70"
parcours$(11) = "agagagagadadagada"
x(11) = 220: y(11) = 170
dessin$(12) = "u60 r130 d60 r60 u160 l60 d60 l190 d100 l70"
parcours$(12) = "adadagagagagadagada"
x(12) = 290: y(12) = 230
dessin$(13) = "u60 l60 d120 r120 u180 l180 d180 l60 u60 l60 d60"
parcours$(13) = "agagagagagagadadagaga"
x(13) = 390: y(13) = 180
dessin$(14) = "u60 l60 u60 l60 u60 l60 d60 l60 d60 l60 d60 r180"
parcours$(14) = "agadagadagagadagadagaga"
x(14) = 470: y(14) = 240
dessin$(15) = "u120 r60 d60 r60 d60 r60 u60 r60 u60 r60 d120"
parcours$(15) = "adadagadagagadagadada"
x(15) = 170: y(15) = 240

'choix de la difficulté
CALL niveau(ni, 3, titr$)

SELECT CASE ni
CASE 1
nombre = 0
CASE 2
nombre = 5
CASE 3
nombre = 10
END SELECT

'présentation
CALL titre(titr$)
CALL cadre(5, 5, 70, 14, marron)
COLOR , marron
IF pre$ <> "" THEN
CALL centre(7, blancbrill, pre$ + ",")
LOCATE 9, 7
PRINT "à l'aide des touches ";
ELSE
LOCATE 9, 7
PRINT "A l'aide des touches ";
END IF
COLOR vertclair: PRINT "A D G"; : COLOR blancbrill
PRINT ", tu vas faire "; : COLOR vertclair: PRINT "A"; : COLOR blancbrill: PRINT "vancer, tourner à "; : COLOR vertclair: PRINT "D"; : COLOR blancbrill: PRINT "roite ou"
PRINT
LOCATE 11, 10: PRINT "tourner à "; : COLOR vertclair: PRINT "G": COLOR blancbrill
LOCATE 11, 21: PRINT "auche un petit triangle sur un itinéraire tracé."
LOCATE 14, 13
COLOR noir: PRINT "Attention"; : COLOR blancbrill: PRINT " : c'est la droite ou la gauche du triangle."
CALL centre(17, jaune, "Un conseil : imagine que le triangle, c'est ton nez vu de dessus !")
CALL entree

GOSUB drga2 'mémorise les tortues

SCREEN 9, , 0, 0

'programme

FOR jj = 1 TO 3 ' 3 essais
flag = 1: points = 0
CALL titre2(titr$)
LOCATE 22: PRINT SPACE$(79): COLOR vertclair: LOCATE 22, 1: PRINT "Niveau"; ni
LOCATE 22, 77: PRINT 4 - jj

'tirage
DO
f = 0
z(jj) = INT(RND * 5) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj) + nombre

GOSUB drga1

'affichage parcours
x = x(choix): y = y(choix) 'points de départ
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(jaune) + dessin$(choix)
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
GOSUB drga11


'tests et affichages
boucle = 1: boucle2 = 1
DO
dg1:
LOCATE 23, 27
COLOR blanc: PRINT "<"; : COLOR vertclair: PRINT "A"; : COLOR blanc: PRINT ">vance <";
COLOR vertclair: PRINT "D"; : COLOR blanc: PRINT ">roite <"; : COLOR vertclair: PRINT "G";
COLOR blanc: PRINT ">auche"

MouseBorder 308, 10, 320, 630
MouseShow
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
souris = 0
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'LOCATE 22, 1: PRINT v_mouse, h_mouse '===
'réso EGA
IF lButton THEN
IF v_mouse >= 308 AND v_mouse <= 320 THEN
IF h_mouse >= 208 AND h_mouse <= 270 THEN
'lettre A
rr = 65
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 288 AND h_mouse <= 350 THEN
'lettre D
rr = 68
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 368 AND h_mouse <= 430 THEN
'lettre G
rr = 71
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

IF souris = 0 THEN
IF LEN(r$) < 2 THEN rr = ASC(r$) ELSE rr = ASC(RIGHT$(r$, 1))
END IF

IF rr = 27 THEN CALL quitter: GOTO dg1

MouseHide

ON flag GOSUB drga11, drga12, drga13, drga14
SELECT CASE rr

CASE 65, 97 'avance
IF MID$(parcours$(choix), boucle, 1) = "a" THEN

dire$ = LEFT$(pa$(boucle2), 1)
CALL exact(0)
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y) + "c=" + VARPTR$(cyanclair) + pa$(boucle2)
IF dire$ = "u" THEN
GOSUB drgaup
ELSEIF dire$ = "d" THEN
GOSUB drgadown
ELSEIF dire$ = "r" THEN
GOSUB drgaright
ELSEIF dire$ = "l" THEN
GOSUB drgaleft
END IF
boucle = boucle + 1: boucle2 = boucle2 + 1
ELSE
CALL erreur(.5): points = points + 1
ON flag GOSUB drga11, drga12, drga13, drga14
END IF

CASE 68, 100 'droite
IF MID$(parcours$(choix), boucle, 1) = "d" THEN
ON flag GOSUB drga12, drga13, drga14, drga11
flag = flag + 1: IF flag > 4 THEN flag = 1
CALL exact(.3)
boucle = boucle + 1
ELSE
ON flag GOSUB drga12, drga13, drga14, drga11
CALL erreur(.6): points = points + 1
ON flag GOSUB drga12, drga13, drga14, drga11
ON flag GOSUB drga11, drga12, drga13, drga14
END IF

CASE 71, 103 'gauche
IF MID$(parcours$(choix), boucle, 1) = "g" THEN
ON flag GOSUB drga14, drga11, drga12, drga13
flag = flag - 1: IF flag < 1 THEN flag = 4
CALL exact(.3)
boucle = boucle + 1
ELSE
ON flag GOSUB drga14, drga11, drga12, drga13
CALL erreur(.6): points = points + 1
ON flag GOSUB drga14, drga11, drga12, drga13
ON flag GOSUB drga11, drga12, drga13, drga14
END IF

CASE ELSE
BEEP
ON flag GOSUB drga11, drga12, drga13, drga14

END SELECT

LOOP WHILE boucle < LEN(parcours$(choix)) + 1
LOCATE 23: PRINT SPACE$(80)
IF points > 1 THEN
s$ = "Tu as fait" + STR$(points) + " erreurs."
ELSEIF points = 0 THEN
s$ = "Aucune erreur !"
ELSE
s$ = "Tu as fait une erreur."
END IF
CALL centre(23, jaune, s$)
CALL attendre(3)
LOCATE 23: PRINT SPACE$(80)
fautes = fautes + points
NEXT jj

'fin programme

'résultats
re = 10 - fautes: IF re < 0 THEN re = 0
CALL resultats(re, ni)
EXIT SUB

drga1:
'les distances
nbe = 1: x = 1
dessin$(choix) = LCASE$(dessin$(choix))
dessin$(choix) = LTRIM$(dessin$(choix)): dessin$(choix) = RTRIM$(dessin$(choix)): dessin$(choix) = dessin$(choix) + " "
DO
espace = INSTR(x, dessin$(choix), " ")
IF espace <> 0 THEN
pa$(nbe) = MID$(dessin$(choix), x, espace - x)
pa(nbe) = VAL(MID$(dessin$(choix), x + 1, espace - x))
nbe = nbe + 1: x = espace + 1
END IF
LOOP WHILE espace
nbe = nbe - 1
RETURN

drga2:
SCREEN 9, , 1, 0
x = 320: y = 175
CLS 1
DRAW "m320,175 " + tortue$
GET (x - 10, y)-(x + 10, y - 20), tortue1
CLS 1
DRAW "m320,175 ta270" + tortue$
GET (x, y - 10)-(x + 27, y + 10), tortue2
CLS 1
DRAW "m320,175 ta180" + tortue$
GET (x - 10, y)-(x + 10, y + 20), tortue3
CLS 1
DRAW "m320,175 ta90" + tortue$
GET (x, y - 10)-(x - 27, y + 10), tortue4
RETURN

drga11:
PUT (x - 10, y - 20), tortue1, XOR
RETURN
drga12:
PUT (x, y - 10), tortue2, XOR
RETURN
drga13:
PUT (x - 10, y), tortue3, XOR
RETURN
drga14:
PUT (x - 27, y - 10), tortue4, XOR
RETURN

drgaup:
FOR i = 1 TO pa(boucle2) / 10
GOSUB drga11
CALL attendre(.05)
GOSUB drga11
y = y - 10
NEXT
GOSUB drga11
flag = 1
RETURN

drgadown:
FOR i = 1 TO pa(boucle2) / 10
GOSUB drga13
CALL attendre(.05)
GOSUB drga13
y = y + 10
NEXT
GOSUB drga13
flag = 3
RETURN

drgaright:
FOR i = 1 TO pa(boucle2) / 10
GOSUB drga12
CALL attendre(.05)
GOSUB drga12
x = x + 10
NEXT
GOSUB drga12
flag = 2
RETURN

drgaleft:
FOR i = 1 TO pa(boucle2) / 10
GOSUB drga14
CALL attendre(.05)
GOSUB drga14
x = x - 10
NEXT
GOSUB drga14
flag = 4
RETURN
END SUB

DEFINT A-Z
SUB intrus (re, ni, motintrus$(), rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
nbeliste = 10
nbeserie = nbeliste / 2

DIM mot$(10, 10), mot2$(10), z(10), sol(10), nbe(10)
DIM p4$(2)

p4$(1) = "Niveau 1": p4$(2) = "Niveau 2"
re = 0: q = 1

k = 0
FOR i = 1 TO nbeliste
j = 0
DO
j = j + 1: k = k + 1
mot$(i, j) = motintrus$(k)
IF RIGHT$(mot$(i, j), 1) = "*" THEN
mot$(i, j) = MID$(mot$(i, j), 1, LEN(mot$(i, j)) - 1)
sol(i) = j
END IF
LOOP WHILE mot$(i, j) <> "="
nbe(i) = j - 1
NEXT i


'i = nbe de listes
'nbe(i) = nbe de mots dans la liste i
'mot$(i,j) = mots j dans la liste i
'* repère pour l'intrus
'= repère pour la fin de la liste
'la solution est avant l'=
'sol(i) indique le numéro de l'intrus

CALL niveau(ni, 2, titr$)

IF ni = 1 THEN niv2 = 1 ELSE niv2 = nbeserie + 1

'présentation
w$ = "Tu vas devoir trouver le mot 'pirate'"
z$ = "dans une liste de propositions."
CALL consigne(2, w$, z$, xx$)

'affectation
bb = 1
FOR boucle = 1 TO nbeserie

'tirage aléatoire des séries
DO
f = 0
z(boucle) = INT(RND * nbeserie) + niv2
FOR j = 1 TO boucle - 1
IF z(boucle) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
numeroboucle = z(boucle)

FOR i = 1 TO nbe(numeroboucle)
mot2$(i) = mot$(numeroboucle, i)
NEXT
nbemot = nbe(numeroboucle) - 1


'demande réponse
CALL titre(titr$)
CALL cadre(4, 20, 40, 2, marron)
COLOR , marron
CALL centre(5, blancbrill, "Sélectionne l'intrus")
COLOR , bleu

erreurs = 0
DO
intrus5:

COLOR vertclair, noir
LOCATE 22, 1: PRINT p4$(ni)
LOCATE 22, 78: PRINT (nbeserie + 1) - boucle

'détermine v
SELECT CASE nbemot
CASE 1 TO 3
v = 11
CASE 4 TO 6
v = 10
CASE 7 TO 9
v = 8
CASE 10 TO 12
v = 6
CASE 13 TO 15
v = 5
END SELECT
'trouver longueur mot max
l2 = 0
FOR i = 1 TO nbemot
l1 = LEN(mot2$(i)): IF l2 < l1 THEN l2 = l1
NEXT
h = INT(41 - (l2 / 2))
'CALL cadre(v - 2, h - 3, l2 + 4, nbemot + 3, rouge)

CALL fleches(v, h, mot2$(), nbemot, r, rouge, 1, 23, 35)

COLOR , noir

LOCATE 22, 1: PRINT SPACE$(80): PRINT SPACE$(80)
IF r = 0 THEN
CALL quitter: GOTO intrus5
ELSEIF r <> sol(numeroboucle) THEN
erreurs = erreurs + 1
IF erreurs < 3 THEN
CALL erreur(.6)
ELSE
CALL centre(23, rougeclair, "Solution : " + mot2$(sol(numeroboucle)))
CALL attendre(2)
LOCATE 23, 1: PRINT SPACE$(80)
COLOR , bleu

END IF
END IF
LOOP WHILE r <> sol(numeroboucle)
CALL exact(.5): IF erreurs = 0 THEN re = re + 2
LOCATE 22: PRINT SPACE$(80)
CALL centre(23, vertclair, mot2$(nbemot + 1))
CALL attendre(3)
bb = bb + 1: IF bb > 3 THEN bb = 1
NEXT boucle

CALL resultats(re, ni)
END SUB

DEFINT A-Z
SUB orth (prog, re, ni, mo$(), rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
DIM p2$(4), z(10)
'12/4/96
nbmots = 39: re = 0
p2$(1) = "lente": p2$(2) = "moyenne"
p2$(3) = "rapide": p2$(4) = "très rapide"
lp$ = STRING$(22, ".")
'debut
c = 0

CALL niveau(ni, 3, titr$)

vit = 2
IF ni = 1 THEN
nombre = 1
ELSEIF ni = 2 THEN
nombre = 14
ELSE
nombre = 27
END IF


CALL titre(titr$)

'affichage des mots
CALL cadre(4, 30, 20, 14, marron)
COLOR blancbrill, marron

LOCATE 5
FOR i = 0 TO 12
LOCATE , 35
PRINT mo$(i + nombre)
NEXT
COLOR , noir
CALL centre(23, blanc, "Mémorise l'orthographe des mots")
CALL getinvimouse(r)

'prg principal_

FOR ii = 1 TO 10
CALL titre(titr$)
LOCATE 22, 3: COLOR vertclair, noir: PRINT "Niveau"; ni;
LOCATE , 77: PRINT STR$(11 - ii); " "
CALL cadre(10, 28, 24, 4, blanc)
MouseHide

DO
f = 0
z(ii) = INT(RND * 13) + nombre
FOR j = 1 TO ii - 1
IF z(ii) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
nn = z(ii)

s$ = mo$(nn)

DO

CALL cadre(6, 28, 24, 2, vert)
COLOR , vert
CALL centre(7, blancbrill, "Vitesse " + p2$(vit))
COLOR , blanc
TR = 0
p$ = MID$(lp$, 1, LEN(s$))
FOR x = 2 TO LEN(s$)
IF ASC(MID$(s$, x, 1)) = 32 THEN TR = x
NEXT
IF TR <> 0 THEN p$ = MID$(p$, 1, TR - 1) + " " + MID$(p$, TR + 1)

CALL attendre(.5)
IF ct = 0 THEN
SELECT CASE ii
CASE 1, 4, 7, 10, 13, 16, 19
CALL centre(12, noir, s$)
CALL attendre(.4 * (2 / vit))

CASE 2, 5, 8, 11, 14, 17, 20
'lettre par lettre
CALL centre(12, noir, p$): COLOR noir, blanc
h = INT(41 - LEN(s$) / 2)
FOR x = 1 TO LEN(s$)
LOCATE 12, h
PRINT MID$(s$, x, 1)
CALL attendre(.4 * (2 / vit))
LOCATE 12, h
PRINT "."
h = h + 1
NEXT

CASE 3, 6, 9, 12, 15, 18
'flash
FOR x = 1 TO 3
CALL centre(12, noir, s$)
CALL attendre(.09)
CALL centre(12, noir, SPACE$(LEN(s$)))
CALL attendre(.15)
NEXT
END SELECT

ELSE
CALL centre(12, noir, s$)
CALL attendre(.4 * (2 / vit))

END IF

COLOR , blanc: CALL centre(12, noir, p$)
COLOR , noir
CALL centre(23, blanc, "Tape le mot")
COLOR blancbrill

DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &HBF)'minus
DEF SEG

nl = LEN(s$): LOCATE 12, INT(41 - (LEN(s$) / 2))
COLOR noir, blanc
CALL inputgen(nl, r$, 32, 165)

LOCATE 13, 32: COLOR , blanc: PRINT SPACE$(18)
COLOR , noir
IF r$ = s$ THEN
cc = cc + 1
CALL exact(.7)
IF ct = 0 THEN re = re + 1
ct = 0
EXIT DO
ELSE
cc = 0: ct = 1
vit = vit - 1: IF vit < 1 THEN vit = 1
CALL erreur(.7)
'mettre en rouge là où c'est faux
COLOR , blanc
LOCATE 12, INT(41 - (LEN(s$) / 2))
FOR i = 1 TO LEN(r$)
IF MID$(s$, i, 1) = MID$(r$, i, 1) THEN
COLOR noir
ELSE
COLOR rouge
END IF
PRINT MID$(r$, i, 1);
NEXT
PRINT
LOCATE 13, INT(41 - (LEN(s$) / 2))
'on compte les erreurs
flag = 0
FOR i = 1 TO LEN(r$)
IF MID$(s$, i, 1) <> MID$(r$, i, 1) THEN
flag = flag + 1
END IF
NEXT

IF flag < 3 THEN
FOR i = 1 TO LEN(r$)
IF MID$(s$, i, 1) = MID$(r$, i, 1) THEN
PRINT " ";
ELSE
COLOR rouge
PRINT CHR$(24);
END IF
NEXT
ELSE
CALL centre(13, noir, SPACE$(LEN(s$)))
END IF
CALL attendre(1)
END IF
LOOP
COLOR , noir
LOCATE 23, 1: PRINT SPACE$(80)
IF vit = 1 AND cc = 2 THEN vit = 2: cc = 0
IF vit = 2 AND cc = 3 THEN vit = 3: cc = 0
IF vit = 3 AND cc = 4 THEN vit = 4: cc = 0
NEXT ii

CALL resultats(re, ni)

END SUB

DEFINT A-Z
SUB trouve (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
'4/12/96 souris
CONST gauche = 75, droite = 77, haut = 72, bas = 80
DIM cas(4, 2), z(10), zz(15), dessin$(15), des$(15)
DIM envers(1 TO 330) AS INTEGER

dessin$(1) = "r10 d10 r10 u10 r10 d30 r10 u10 r10 d20 r10 d10 l10 d10 l10 u10 l10 u10 l10 d20 l10 u30 l10 u30"
dessin$(2) = "b d10 r30 u 10 r20 d10 l10 d20 r10 u10 r10 d30 l20 d10 l10 u30 l10 d20 l20 u20 r10 u10 l10 u10"
dessin$(3) = "r10 d30 r10 u10 r10 u10 r10 u10 r20 d10 l10 d10 r10 d10 l20 d10 r10 d10 l20 u10 l10 d20 l10 u20 l10 u40"
dessin$(4) = "b r20 r10 d20 r10 u20 r20 d10 l10 d30 r10 d20 l10 u10 l10 u20 l10 d20 l10 d10 l10 u20 r10 u10 l20 u10 r10 u10 r10 u10"
dessin$(5) = "r30 d10 l20 d10 r30 u20 r20 d10 l10 d20 r10 d10 l20 d10 r10 d10 l20 u30 l10 d20 l10 d10 l10 u20 r10 u10 l10 u30"
dessin$(6) = "b r30 r30 d10 l10 d10 r10 d10 l20 d10 r10 d10 r10 d10 l20 u10 l10 u20 l10 d10 l10 d20 l10 u30 r10 u10 r10 u10 r10 u10"
dessin$(7) = "r10 d10 r10 u10 r10 d10 r10 u10 r20 d10 l10 d10 l20 d10 r20 d10 r10 d20 l10 u10 l10 u10 l10 d10 l10 d10 l10 u20 l10 u10 r10 u10 l10 u20"
dessin$(8) = "b r10 r10 d20 r10 u20 r10 d10 r10 u10 r10 d40 l10 u10 l10 d20 r20 d10 l30 u30 l10 d10 l10 d20 l10 u40 r10 u20"
dessin$(9) = "r10 d10 r10 d10 r10 u10 r10 d10 r10 d10 r10 d10 l10 d10 l10 u10 l10 d20 l30 u10 r20 u10 l10 u20 l10 u20"
dessin$(10) = "r10 d30 r20 u10 l10 u20 r10 d10 r10 u10 r20 d10 l10 d10 l10 d10 r20 d30 l10 u10 l10 u10 l10 d10 l10 d10 l20 u10 r10 u10 l10 u40"
dessin$(11) = "b r10 r30 d10 l10 d10 r20 d30 r10 d10 l20 u20 l10 d20 l10 u10 l10 d10 l10 u20 r10 u10 l10 u10 r20 u10 l10 u10"
dessin$(12) = "r20 d10 l10 d10 r40 u10 l20 u10 r30 d30 l20 d10 r20 d10 l20 d10 l10 u20 l10 d20 l20 u20 r10 u10 l10 u30"
dessin$(13) = "b r30 r10 d10 r10 d10 r10 d10 l20 d10 r20 d20 l10 u10 l10 d10 l10 u10 l20 d10 l10 u30 r10 u10 r10 u10 r10 u10"
dessin$(14) = "r20 d20 r10 u10 r20 u10 r10 d20 l10 d10 l10 d10 r10 d10 r10 d10 l20 u10 l10 u10 l20 d20 l10 u30 r10 u20 l10 u10"
dessin$(15) = "r10 d20 r10 u20 r20 d10 r10 u10 r10 d20 l30 d10 r10 d10 r10 d10 r10 d10 l20 u10 l20 d10 l10 u30 l10 u30"
re = 0
g$ = CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + " "

x = 1
FOR ligne = 0 TO 2
FOR colo = 0 TO 4
cas(colo, ligne) = x
x = x + 1
NEXT colo, ligne
DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG
CALL niveau(ni, 3, titr$)

GOSUB trouve40 'présentation

SCREEN 9, , 0, 1
'mémorisation des lettres : matrice 8 x 14
x = 0: y = 0
PRINT "A l'envers"
GET (x, y)-(x + 8 * 10, y + 13), envers
LOCATE 1: PRINT SPACE$(11)
SCREEN 9, , 0, 0

CALL titre2(titr$)
LINE (15, 40)-(225, 270), blancbrill, B

'on mélange
FOR i = 1 TO 15
DO
f = 0
zz(i) = INT(RND * 15) + 1
FOR j = 1 TO i - 1
IF zz(i) = zz(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
des$(i) = dessin$(zz(i))
NEXT i
d = 1
FOR y = 45 TO 205 STEP 80
FOR x = 240 TO 560 STEP 80
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + " c=" + VARPTR$(jaune) + des$(d) + "bm+2,+2 p=" + VARPTR$(cyanclair) + ",=" + VARPTR$(jaune)
d = d + 1
NEXT x, y
IF ni = 3 THEN PUT (80, 47), envers, XOR

'+++++++++++++++++
FOR jj = 1 TO 10
LINE (25, 59)-(215, 255), bleu, BF
erreurs = 0
COLOR vertclair: LOCATE 22, 31: PRINT "Niveau"; ni
LOCATE 22, 77: PRINT 11 - jj
GOSUB trouve14

'tirage
DO
f = 0
z(jj) = INT(RND * 15) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj)

IF ni = 1 THEN
cc2 = vertclair
x = 95: y = 125
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + " c=" + VARPTR$(blancbrill) + des$(choix) + "bm+2,+2 p=" + VARPTR$(cc2) + ",=" + VARPTR$(blancbrill)

ELSEIF ni = 2 THEN
cc2 = rougeclair
'agrandissement
scale = INT(RND * 2) + 1
IF scale = 1 THEN
x = 30: y = 65: s = 12
ELSE
x = 60: y = 95: s = 8
END IF
COLOR blancbrill
LOCATE 22, 10: PRINT "Echelle : x" + STR$(s / 4)
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + " c=" + VARPTR$(blancbrill) + "s=" + VARPTR$(s) + des$(choix) + "bm+9,+9 p=" + VARPTR$(cc2) + ",=" + VARPTR$(blancbrill) + "ta0"

ELSE
'rotation et agrandissement
cc2 = vertclair
scale = INT(RND * 3) + 1
IF scale = 1 THEN
x = 95 + 60: y = 125 + 60: s = 4
ELSEIF scale = 2 THEN
x = 60 + 120: y = 95 + 120: s = 8
ELSE
x = 30 + 180: y = 65 + 180: s = 12
END IF
COLOR blancbrill
LOCATE 22, 10: PRINT "Echelle : x" + STR$(s / 4)
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + "a2 c=" + VARPTR$(blancbrill) + "s=" + VARPTR$(s) + des$(choix) + "bm+9,+9 p=" + VARPTR$(cc2) + ",=" + VARPTR$(blancbrill) + "ta0"
END IF

VIEW (235, 40)-(635, 270)
colo = 0: ligne = 0
LINE (80 * colo, 80 * ligne)-(70 + 80 * colo, 70 + 80 * ligne), vertclair, B, &H7777
flag = 1

DO
col2 = colo: ligne2 = ligne

trouve11:
MouseBorder 45, 240, 320, 620
MouseShow
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
souris = 0
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'LOCATE 22, 1: PRINT v_mouse, h_mouse '===
'réso EGA
IF lButton THEN
IF v_mouse >= 45 AND v_mouse <= 105 THEN
IF h_mouse >= 240 AND h_mouse <= 300 THEN
'1° carre
colo = 0: ligne = 0: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 320 AND h_mouse <= 380 THEN
'2° carre
colo = 1: ligne = 0: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 400 AND h_mouse <= 460 THEN
'3°
colo = 2: ligne = 0: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 480 AND h_mouse <= 560 THEN
'4°
colo = 3: ligne = 0: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 560 AND h_mouse <= 620 THEN
'5°
colo = 4: ligne = 0: souris = 2
CALL attendre(.2)
EXIT DO
ELSE
BEEP
END IF
ELSEIF v_mouse >= 125 AND v_mouse <= 185 THEN
IF h_mouse >= 240 AND h_mouse <= 300 THEN
'1° carre
colo = 0: ligne = 1: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 320 AND h_mouse <= 380 THEN
'2° carre
colo = 1: ligne = 1: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 400 AND h_mouse <= 460 THEN
'3°
colo = 2: ligne = 1: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 480 AND h_mouse <= 560 THEN
'4°
colo = 3: ligne = 1: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 560 AND h_mouse <= 620 THEN
'5°
colo = 4: ligne = 1: souris = 2
CALL attendre(.2)
EXIT DO
ELSE
BEEP
END IF
ELSEIF v_mouse >= 205 AND v_mouse <= 265 THEN
IF h_mouse >= 240 AND h_mouse <= 300 THEN
'1° carre
colo = 0: ligne = 2: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 320 AND h_mouse <= 380 THEN
'2° carre
colo = 1: ligne = 2: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 400 AND h_mouse <= 460 THEN
'3°
colo = 2: ligne = 2: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 480 AND h_mouse <= 560 THEN
'4°
colo = 3: ligne = 2: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 560 AND h_mouse <= 620 THEN
'5°
colo = 4: ligne = 2: souris = 2
CALL attendre(.2)
EXIT DO
ELSE
BEEP
END IF

ELSEIF v_mouse >= 308 AND v_mouse <= 320 THEN
'fleches
IF h_mouse >= 370 AND h_mouse <= 385 THEN
'gauche
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 387 AND h_mouse <= 402 THEN
'droite
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 405 AND h_mouse <= 415 THEN
'haut
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 420 AND h_mouse <= 435 THEN
'bas
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 490 AND h_mouse <= 520 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

MouseHide

IF souris = 2 THEN
LINE (80 * col2, 80 * ligne2)-(70 + 80 * col2, 70 + 80 * ligne2), bleu, B
LINE (80 * colo, 80 * ligne)-(70 + 80 * colo, 70 + 80 * ligne), vertclair, B, &H7777
col2 = colo: ligne2 = ligne
EXIT DO
END IF

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

IF valtouche = 50 THEN valtouche = bas
IF valtouche = 52 THEN valtouche = gauche
IF valtouche = 54 THEN valtouche = droite
IF valtouche = 56 THEN valtouche = haut

SELECT CASE valtouche
CASE gauche
colo = colo - 1
IF colo = -1 THEN colo = 4: ligne = ligne - 1
IF ligne = -1 THEN ligne = 2: colo = 4

CASE droite
colo = colo + 1
IF colo = 5 THEN colo = 0: ligne = ligne + 1
IF ligne = 3 THEN ligne = 0: colo = 0

CASE haut
ligne = ligne - 1
IF ligne = -1 THEN ligne = 2

CASE bas
ligne = ligne + 1
IF ligne = 3 THEN ligne = 0

CASE 27
CALL quitter: GOSUB trouve14: GOTO trouve11

CASE 13
EXIT DO

CASE ELSE
BEEP

END SELECT

LINE (80 * col2, 80 * ligne2)-(70 + 80 * col2, 70 + 80 * ligne2), bleu, B
LINE (80 * colo, 80 * ligne)-(70 + 80 * colo, 70 + 80 * ligne), vertclair, B, &H7777

LOOP

LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)

reponse = cas(colo, ligne)

'tester la reponse
IF reponse = choix THEN
CALL exact(1.5)
IF erreurs = 0 THEN re = re + 1
ELSE
erreurs = erreurs + 1
IF erreurs > 1 THEN
BEEP: CALL centre(23, rougeclair, "Regarde"): CALL attendre(1)
IF choix < 6 THEN
c = choix
ELSEIF choix < 11 THEN
c = choix - 5
ELSE
c = choix - 10
END IF
x = 240 + 80 * (c - 1)

IF choix < 6 THEN
l = 0
ELSEIF choix < 11 THEN
l = 1
ELSE
l = 2
END IF
y = 45 + 80 * l
IF couleur = 1 THEN cc = rougeclair: cc2 = rouge ELSE cc2 = 0: cc = 7
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + " c=" + VARPTR$(cc) + des$(choix) + "bm+2,+2 p=" + VARPTR$(cc2) + ",=" + VARPTR$(cc)
CALL entree
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + " c=" + VARPTR$(jaune) + des$(choix) + "bm+2,+2 p=" + VARPTR$(cyanclair) + ",=" + VARPTR$(jaune)
ELSE
CALL erreur(.7)
END IF
GOSUB trouve14: GOTO trouve11
END IF

LINE (80 * colo, 80 * ligne)-(70 + 80 * colo, 70 + 80 * ligne), bleu, B
VIEW

NEXT jj

'résultats
CALL resultats(re, ni)

EXIT SUB
'++++++++++++++++++++++++

trouve14:
LOCATE 23: PRINT SPACE$(80)
COLOR blanc: LOCATE 23, 48: PRINT g$ + " puis " + rt$
RETURN

trouve40:
w$ = "Avec les flèches " + g$ + ", tu vas devoir retrouver une forme."
z$ = "La forme présentée va être agrandie 2 ou 3 fois."
xx$ = "La forme présentée sera à l'envers."

SELECT CASE ni
CASE 1
CALL consigne(1, w$, z$, xx$)
CASE 2
CALL consigne(2, w$, z$, xx$)
CASE 3
CALL consigne(3, w$, z$, xx$)
END SELECT
RETURN

END SUB
 

 

DECLARE SUB MouseBorder (row1%, col1%, row2%, col2%)
DECLARE SUB MouseHide ()
DECLARE SUB MouseShow ()
DECLARE SUB MousePoll (row%, col%, lButton%, rButton%)
DECLARE SUB getinvimouse (rr%)
DECLARE SUB consigne (nl%, w$, z$, xx$)
DECLARE SUB cadre (v%, h%, l%, nli%, c%)
DECLARE SUB centre (v%, coul%, ph$)
DECLARE SUB quitter ()
DECLARE SUB getinvi (rr%)
DECLARE SUB niveau (r%, np%, titr$)
DECLARE SUB titre (titr$)
DECLARE SUB attendre (tx!)
DECLARE SUB cadre3 (v%, h%, nb%, coul%)
DECLARE SUB entree ()
DECLARE SUB erreur (tx!)
DECLARE SUB exact (tx!)
DECLARE SUB resultats (re%, ni%)
DECLARE SUB titre2 (titr$)
DECLARE SUB titre3 (titr$)
DECLARE SUB flechesbis (v%, h%, p$(), np%, r%)
'exo 4 géométrie
'Daniel Clerc 7/4/96
'version 1.5


DEFINT A-Z
SUB angle1 (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
CONST pi = 3.141592653589#
DIM z(10), an$(5)
re = 0
an$(1) = "nul"
an$(2) = "aigu"
an$(3) = "droit"
an$(4) = "obtus"
an$(5) = "plat"
y = 200

SCREEN 9
'présentation
CALL titre2(titr$)
rayon = 20
x = 30: h = 4
FOR choix = 1 TO 5
GOSUB angl2: GOSUB angl4
LOCATE 8, h: PRINT " "; an$(choix); " "
x = x + 133: h = h + 16
NEXT
IF pre$ <> "" THEN
CALL centre(23, vertclair, pre$ + ", mémorise...")
ELSE
CALL centre(23, vertclair, "Mémorise...")
END IF
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
CLS
'tirage
z$ = ""
FOR k = 1 TO 2

FOR jj = 1 TO 5
DO
f = 0
z(jj) = INT(RND * 5) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
z$ = z$ + LTRIM$(STR$(z(jj)))
NEXT jj

NEXT k

CALL titre3(titr$)

x = 213: y = 200: rayon = 90

'++++++++++++++++++
FOR jj = 1 TO 10
erreurs = 0
'tirage
choix = VAL(MID$(z$, jj, 1))
GOSUB angl2

LOCATE 22, 77: COLOR vertclair: PRINT 11 - jj

GOSUB angl4 'dessin de l'angle
angl10:
COLOR blanc: LOCATE 18, 62: PRINT gg$
CALL flechesbis(9, 65, an$(), 5, r)
IF r = 0 THEN CALL quitter: GOTO angl10
IF r = choix THEN
CALL exact(.7)
IF erreurs = 0 THEN re = re + 1
ELSE
erreurs = erreurs + 1
IF erreurs > 2 THEN
CALL centre(23, rougeclair, "Solution : " + an$(choix))
ELSE
CALL erreur(.7)
LOCATE 23: PRINT SPACE$(80)
END IF
GOTO angl10
END IF
LINE (0, 28)-(426, 270), bleu, BF
LINE (500, 100)-(580, 200), noir, BF
LOCATE 23: PRINT SPACE$(80)
NEXT

'++++++++++
'résultats
CALL resultats(re, ni)
EXIT SUB


angl1:
angle = INT(RND * anglemaxi) + 1
IF angle < anglemini THEN GOTO angl1
RETURN

angl2:
SELECT CASE choix
CASE 1 'nul
angle = 0

CASE 2 'aigu
anglemini = 10: anglemaxi = 80
GOSUB angl1

CASE 3 'droit
angle = 90

CASE 4 'obtus
anglemini = 100: anglemaxi = 170
GOSUB angl1

CASE 5 'plat
angle = 180

END SELECT

anglefin! = angle * (pi / 180)
RETURN

angl4:
longu = rayon + 30
CIRCLE (x, y), 3, vertclair, , , coef2!
LINE (x, y)-(x + longu, y), rougeclair
CIRCLE (x, y), rayon, jaune, 0, anglefin! 'sans coef2!
angl = angle - 90
DRAW "ta0 c=" + VARPTR$(rougeclair) + "ta=" + VARPTR$(angl) + "u=" + VARPTR$(longu)
RETURN

END SUB

DEFINT A-Z
SUB angle2 (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
CONST pi = 3.141592653589#, x = 320, y = 170
re = 0

rayon = 30
anglefin! = 90 * (pi / 180)
DIM ang(12), z(5), rep(12), an(12)
'choix de la difficulté
CALL niveau(ni, 2, titr$)

'présentation
GOSUB ang3

IF ni = 1 THEN
GOSUB ang4
ELSE
GOSUB ang5
END IF

'début programme

FOR jj = 1 TO 5
erreurs = 0: flag = 0: flag2 = 0
'tirage
DO
f = 0
z(jj) = INT(RND * max) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj)
reponse = rep(choix)
CALL titre2(titr$)
LOCATE 22: PRINT SPACE$(80)
DO
GOSUB ang6

LOCATE 22, 77: COLOR vertclair: PRINT 6 - jj

angleorigine! = ang(flag2) * (pi / 180)
IF flag2 = 0 THEN
'rien
ELSEIF flag2 = max THEN
IF couleur = 1 THEN PAINT (x + 2, y - 5), bleu, blancbrill
CIRCLE (x, y), rayon, bleu
ELSE
IF couleur = 1 THEN PAINT (x + 2, y - 5), bleu, blancbrill
CIRCLE (x, y), rayon, bleu, -angleorigine!, -anglefin!
END IF
angle = an(flag2)
DRAW "b m320,170 ta=" + VARPTR$(angle) + "c=" + VARPTR$(bleu) + " u100"

LINE (x, y)-(x, y - 100), blancbrill

angleorigine! = ang(flag) * (pi / 180)
IF flag = 0 THEN
'rien
ELSEIF flag = max THEN
CIRCLE (x, y), rayon, blancbrill
IF couleur = 1 THEN PAINT (x + 2, y - 5), vert, blancbrill
ELSE
CIRCLE (x, y), rayon, blancbrill, -angleorigine!, -anglefin!
IF couleur = 1 THEN PAINT (x + 2, y - 5), vert, blancbrill
END IF
angle = an(flag)
DRAW "b m320,170 ta=" + VARPTR$(angle) + "c=" + VARPTR$(blancbrill) + "u100"
LINE (x, y)-(x, y - 100), blancbrill
GOSUB ang6

flag2 = flag

ang2:
MouseBorder 308, 10, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'matrice 14 x 8 = transforme en coord écran
v_mouse = INT(v_mouse / 14) + 1
h_mouse = INT(h_mouse / 8) + 1
'LOCATE 21, 1: PRINT v_mouse, h_mouse'===

IF lButton THEN
IF v_mouse = 23 THEN
IF h_mouse >= 19 AND h_mouse <= 31 THEN
valtouche = 72 'fleche haut
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 33 AND h_mouse <= 46 THEN
valtouche = 80 'fleche bas
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 49 AND h_mouse <= 61 THEN
valtouche = 13
souris = 1
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
END IF
LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

SELECT CASE valtouche
CASE 27
CALL quitter

CASE 72 'haut
flag = flag - 1: IF flag < 0 THEN flag = 0: BEEP: GOTO ang2

CASE 80 'bas
flag = flag + 1: IF flag > max THEN flag = max: BEEP: GOTO ang2

CASE 73, 71 'home & pghaut
flag = 0

CASE 81, 79 'end & pgbas
flag = max

CASE 13
LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)

IF flag = choix THEN
CALL exact(.7): LOCATE 23: PRINT SPACE$(80)
IF erreurs = 0 THEN re = re + 2
ELSE
erreurs = erreurs + 1
IF erreurs > 2 THEN
SCREEN 9, , 0, 1
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
SCREEN 9, , 0, 0
ELSE
CALL erreur(.5)
CALL centre(23, rougeclair, "Ton angle est égal à" + STR$(rep(flag)) + " degrés.")
CALL getinvimouse(r): IF r = 0 THEN CALL quitter
END IF
LOCATE 23: PRINT SPACE$(80)
GOSUB ang6
GOTO ang2
END IF
EXIT DO

CASE ELSE
BEEP: GOTO ang2

END SELECT

LOOP

NEXT jj

'fin programme

'résultats
CALL resultats(re, ni)
EXIT SUB

ang3:
SCREEN 9
IF pre$ <> "" THEN
CALL centre(11, jaune, pre$ + ",")
CALL centre(13, jaune, "tu vas observer la valeur des angles.")
ELSE
CALL centre(13, jaune, "Tu vas observer la valeur des angles.")
END IF
CALL centre(16, blancbrill, "Un instant...")
SCREEN 9, , 1, 0
CALL centre(1, jaune, UCASE$(titr$))
LOCATE 2: COLOR rouge: PRINT STRING$(80, 196)
LOCATE 21: COLOR rouge: PRINT STRING$(80, 196)
GOSUB ang4
CIRCLE (160, 160), 73, jaune, , , coef2!
PAINT (160, 160), bleu, jaune
FOR i = 1 TO max - 1
CIRCLE (160, 160), 73, jaune, -ang(i) * (pi / 180), -90 * (pi / 180), coef2!
NEXT
GOSUB ang5
CIRCLE (480, 160), 73, jaune, , , coef2!
PAINT (480, 160), bleu, jaune
FOR i = 1 TO max - 1
CIRCLE (480, 160), 73, jaune, -ang(i) * (pi / 180), -90 * (pi / 180), coef2!
NEXT

FOR i = 1 TO 2
IF i = 1 THEN h = 17 ELSE h = 57
COLOR jaune: LOCATE 4, h: PRINT "Niveau"; i
COLOR blancbrill
LOCATE 6, h + 2: PRINT "0-360"
LOCATE 12, h - 9: PRINT "270"
LOCATE 12, h + 14: PRINT "90"
LOCATE 18, h + 3: PRINT "180"
NEXT
h = 21: COLOR vert
LOCATE 8, h + 7: PRINT "45"
LOCATE 8, h - 10: PRINT "315"
LOCATE 16, h + 7: PRINT "135"
LOCATE 16, h - 10: PRINT "225"
h = 63: COLOR vert
LOCATE 7, h + 3: PRINT "30"
LOCATE 7, h - 10: PRINT "330"
LOCATE 9, h + 7: PRINT "60"
LOCATE 9, h - 14: PRINT "300"
LOCATE 15, h + 7: PRINT "120"
LOCATE 15, h - 14: PRINT "240"
LOCATE 17, h + 3: PRINT "150"
LOCATE 17, h - 10: PRINT "210"
CALL centre(23, blanc, rt$)
SCREEN 9, , 0, 1
CLS
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
SCREEN 9, , 0, 0

RETURN

ang4:
max = 8
ang(1) = 45: ang(2) = 360: ang(3) = 315: ang(4) = 270
ang(5) = 225: ang(6) = 180: ang(7) = 135

rep(1) = 45: rep(2) = 90: rep(3) = 135: rep(4) = 180
rep(5) = 225: rep(6) = 270: rep(7) = 315: rep(8) = 360

an(1) = 315: an(2) = 270: an(3) = 225: an(4) = 180
an(5) = 135: an(6) = 90: an(7) = 45: an(8) = 0

RETURN

ang5:
max = 12
ang(1) = 60: ang(2) = 30: ang(3) = 360: ang(4) = 330
ang(5) = 300: ang(6) = 270: ang(7) = 240: ang(8) = 210
ang(9) = 180: ang(10) = 150: ang(11) = 120

rep(1) = 30: rep(2) = 60: rep(3) = 90: rep(4) = 120
rep(5) = 150: rep(6) = 180: rep(7) = 210: rep(8) = 240
rep(9) = 270: rep(10) = 300: rep(11) = 330: rep(12) = 360

an(1) = 330: an(2) = 300: an(3) = 270: an(4) = 240
an(5) = 210: an(6) = 180: an(7) = 150: an(8) = 120
an(9) = 90: an(10) = 60: an(11) = 30: an(12) = 0
RETURN

ang6:
CALL centre(22, jaune, "Angle à trouver :" + STR$(reponse) + " degrés")
CALL centre(23, blanc, CHR$(24) + " = diminuer " + CHR$(25) + " = augmenter " + rt$ + " = valider")
RETURN

END SUB

DEFINT A-Z
SUB paraperpen (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
'3/12/96
CONST haut = 72, bas = 80

DIM a(1 TO 30) AS INTEGER
DIM B(1 TO 30) AS INTEGER
DIM c(1 TO 30) AS INTEGER
DIM d(1 TO 30) AS INTEGER
DIM e(1 TO 30) AS INTEGER
DIM f(1 TO 30) AS INTEGER

DIM z(10), an$(2)
titr$ = "Parallele - perpendiculaire"

an$(1) = "parallèle"
an$(2) = "perpendiculaire"

CALL niveau(ni, 2, titr$)

SELECT CASE ni
CASE 1
GOSUB paraniveau1
CASE 2
GOSUB paraniveau2
END SELECT

'résultats
CALL resultats(re, ni)

EXIT SUB


paraniveau1:
re = 0
'présentation
w$ = "Avec les flèches, tu vas devoir orienter une ligne parallèlement"
z$ = "ou perpendiculairement par rapport à une droite."
CALL consigne(2, w$, z$, xx$)

COLOR , bleu: CLS
LOCATE 4, 4: COLOR jaune: PRINT "Rappel"
CALL cadre(5, 4, 72, 14, rouge)
COLOR blancbrill, rouge
CALL centre(8, blancbrill, "Les droites perpendiculaires se croisent en formant un angle droit.")
h = 38: LOCATE 10
LOCATE , h: PRINT " │"
LOCATE , h - 3: PRINT "─────┼─────"
LOCATE , h: PRINT " │"
CALL centre(14, blancbrill, "Les droites parallèles ne se croisent pas.")
CALL centre(16, blancbrill, STRING$(14, 196))
CALL centre(17, blancbrill, STRING$(14, 196))
COLOR , bleu
LOCATE 23, 38: PRINT rt$
CALL getinvimouse(w)

SCREEN 9, , 0, 0

FOR jj = 1 TO 10 '+++++++++
erreurs = 0
IF jj / 2 = INT(jj / 2) THEN choix = 1 ELSE choix = 2

IF choix = 2 THEN
tit$ = "parallele"
l$ = "parallèlement"
x = 240: y = 135: xfixe = 360: yfixe = 150
IF jj = 1 THEN anglefixe = 35 ELSE anglefixe = 125
ELSE
tit$ = "perpendiculaire"
l$ = tit$ + "ment"
x = 360: y = 165: xfixe = 260: yfixe = 135
IF jj = 2 THEN anglefixe = 0 ELSE anglefixe = 90
END IF

LOCATE 1: PRINT SPACE$(80)
CALL titre2(tit$)
LOCATE 22, 77: COLOR vertclair: PRINT 11 - jj

GOSUB para100

DO
angle = (INT(RND * 16) + 2) * 10
LOOP WHILE angle = anglefixe

para110:
DO

ancienangle = angle
DRAW "b m=" + VARPTR$(xfixe) + ",=" + VARPTR$(yfixe) + "ta=" + VARPTR$(anglefixe) + "c=" + VARPTR$(jaune) + "u100 d200"
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + "ta=" + VARPTR$(angle) + "c=" + VARPTR$(vertclair) + "u100 d200"

MouseBorder 308, 10, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
v2 = 23: h3 = 13
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 1: PRINT v_mouse, h_mouse'===
'matrice 14 x 8 = transforme en coord écran
v_mouse = INT(v_mouse / 14) + 1
h_mouse = INT(h_mouse / 8) + 1
IF lButton THEN
IF v_mouse = v2 AND h_mouse = h3 THEN
valtouche = haut ' 72 'fleche haut
souris = 1
CALL attendre(.1)
EXIT DO
ELSEIF v_mouse = v2 AND h_mouse = h3 + 2 THEN
valtouche = bas '80 'fleche bas
souris = 1
CALL attendre(.1)
EXIT DO
ELSEIF v_mouse = v2 AND (h_mouse >= 60 AND h_mouse <= 72) THEN
valtouche = 13
souris = 1
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF

LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

SELECT CASE valtouche
CASE haut
angle = angle - 5: IF angle < 0 THEN angle = 355
CASE bas
angle = angle + 5: IF angle > 360 THEN angle = 5
CASE 27
CALL quitter: GOSUB para100
CASE 13
EXIT DO
CASE ELSE
BEEP

END SELECT
IF angle = 360 THEN angle = 0

DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + "ta=" + VARPTR$(ancienangle) + "c=" + VARPTR$(bleu) + "u100 d200"
LOOP
LOCATE 23: PRINT SPACE$(80)

IF choix = 2 THEN 'para
IF angle = anglefixe OR angle = anglefixe + 180 THEN rep = 1 ELSE rep = 0
reponse = anglefixe
ELSE 'perpen
IF angle = anglefixe - 90 OR angle = anglefixe + 90 OR angle = anglefixe + 270 THEN rep = 1 ELSE rep = 0
reponse = anglefixe + 90
END IF

IF rep = 1 THEN
CALL exact(.7)
IF erreurs = 0 THEN re = re + 1
ELSE
erreurs = erreurs + 1
IF erreurs > 2 THEN
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + "ta=" + VARPTR$(reponse) + "c=" + VARPTR$(rougeclair) + "u100 d200"
CALL centre(23, rougeclair, "Regarde")
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + "ta=" + VARPTR$(reponse) + "c=" + VARPTR$(bleu) + "u100 d200"
ELSE
CALL erreur(.7)
END IF
GOSUB para100
GOTO para110
END IF

NEXT jj

RETURN '+++++++++++++++++++++++++++++++

paraniveau2:
'présentation
w$ = "Des figures vont s'afficher à l'écran."
z$ = "Des droites vont être sélectionnées."
xx$ = "Tu devras choisir entre parallèle ou perpendiculaire."
CALL consigne(3, w$, z$, xx$)

SCREEN 9, , 0, 1
'mémorisation des lettres : matrice 8 x 14
x = 0: y = 0
PRINT "A B C D E F"
GET (x, y)-(x + 7, y + 13), a
x = x + 16
GET (x, y)-(x + 7, y + 13), B
x = x + 16
GET (x, y)-(x + 7, y + 13), c
x = x + 16
GET (x, y)-(x + 7, y + 13), d
x = x + 16
GET (x, y)-(x + 7, y + 13), e
x = x + 16
GET (x, y)-(x + 7, y + 13), f
LOCATE 1: PRINT SPACE$(11)
SCREEN 9, , 0, 0

CALL titre3(titr$)
DRAW "ta0"

FOR jj = 1 TO 10
erreurs = 0
'tirage
DO
f = 0
z(jj) = INT(RND * 10) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj)

ON choix GOSUB par1, par2, par3, par4, par1, par2, par5, par6, par7, par8

LOCATE 22, 77: COLOR vertclair: PRINT 11 - jj
para10:
COLOR blanc: LOCATE 18, 60: PRINT gg$
CALL flechesbis(11, 60, an$(), 2, r)
IF r = 0 THEN CALL quitter: GOTO para10
IF r = sol THEN
CALL exact(.7)
IF erreurs = 0 THEN re = re + 1
ELSE
erreurs = erreurs + 1
CALL erreur(.7)
LOCATE 23: PRINT SPACE$(80)
GOTO para10
END IF
LINE (0, 28)-(426, 270), bleu, BF
LINE (440, 70)-(620, 220), noir, BF
LOCATE 23: PRINT SPACE$(80)

NEXT jj

RETURN
'++++++++++

par1:
'carré
x! = coef1! * 100
DRAW "b m160,100"
DRAW "c=" + VARPTR$(blancbrill)
DRAW "d=" + VARPTR$(x!)
DRAW "r100"
DRAW "u=" + VARPTR$(x!)
DRAW "l100"
x = 160 - 17: y = 90: GOSUB a
x = 260 + 10: y = 90: GOSUB B
x = 260 + 10: y = 100 + x!: GOSUB c
x = 160 - 17: y = 100 + x!: GOSUB d
IF choix = 1 THEN
COLOR vertclair: LOCATE 9, 58: PRINT "Le côté AB est"
LOCATE 14, 58: PRINT "au côté BC"
sol = 2
ELSE
COLOR vertclair: LOCATE 9, 58: PRINT "Le côté BC est"
LOCATE 14, 58: PRINT "au côté AD"
sol = 1
END IF
RETURN

par2:
'rect
LINE (70, 95)-(360, 195), blancbrill, B
x = 70 - 17: y = 95 - 10: GOSUB a
x = 360 + 10: y = 95 - 10: GOSUB B
x = 360 + 10: y = 195 - 2: GOSUB c
x = 70 - 17: y = 195 - 2: GOSUB d
IF choix = 6 THEN
COLOR vertclair: LOCATE 9, 58: PRINT "La longueur AB est"
LOCATE 14, 58: PRINT "à la largeur BC"
sol = 2
ELSE
COLOR vertclair: LOCATE 9, 58: PRINT "La largeur BC est"
LOCATE 14, 58: PRINT "à la largeur AD"
sol = 1
END IF
RETURN

par3: 'hauteur
'triang
LINE (80, 220)-(200, 90), blancbrill
LINE -(380, 220)
LINE -(80, 220)
LINE (200, 90)-(200, 220)
x = 80 - 17: y = 220 - 2: GOSUB a
x = 200 - 3: y = 90 - 18: GOSUB B
x = 380 + 10: y = 220 - 2: GOSUB c
x = 200 - 3: y = 220 + 8: GOSUB f
COLOR vertclair: LOCATE 9, 58: PRINT "La base AC est"
LOCATE 14, 58: PRINT "à la hauteur BF"
sol = 2

RETURN

par4: 'diagonale
x! = coef1! * 100
DRAW "b m160,100"
DRAW "c=" + VARPTR$(blancbrill)
DRAW "d=" + VARPTR$(x!)
DRAW "r100"
DRAW "u=" + VARPTR$(x!)
DRAW "l100"
DRAW "d=" + VARPTR$(x!)
DRAW "m260,100"
DRAW "d=" + VARPTR$(x!)
DRAW "m160,100"
x = 160 - 17: y = 90: GOSUB a
x = 260 + 10: y = 90: GOSUB B
x = 260 + 10: y = 100 + x!: GOSUB c
x = 160 - 17: y = 100 + x!: GOSUB d
COLOR vertclair: LOCATE 9, 58: PRINT "La diagonale AC est"
LOCATE 14, 58: PRINT "à la diagonale DB"
sol = 2
RETURN

par5:
'losange
LINE (50, 150)-(200, 80), blancbrill
LINE -(350, 150)
LINE -(200, 220)
LINE -(50, 150)
LINE (200, 80)-(200, 220)
LINE (50, 150)-(350, 150)
x = 50 - 17: y = 150 - 6: GOSUB a
x = 200 - 3: y = 80 - 18: GOSUB B
x = 350 + 10: y = 150 - 6: GOSUB c
x = 200 - 3: y = 220 + 8: GOSUB d
COLOR vertclair: LOCATE 9, 58: PRINT "La diagonale AC est"
LOCATE 14, 58: PRINT "à la diagonale BD"
sol = 2
RETURN


par6: 'médiatrice
'triang
LINE (80, 220)-(200, 90), blancbrill
LINE -(380, 220)
LINE -(80, 220)
LINE (160, 215)-(150, 225)
LINE (310, 215)-(300, 225)
LINE (230, 70)-(230, 240)
x = 80 - 17: y = 220 - 2: GOSUB a
x = 200 - 3: y = 90 - 18: GOSUB B
x = 380 + 10: y = 220 - 2: GOSUB c
x = 230 - 3: y = 70 - 18: GOSUB e
x = 230 - 3: y = 240 + 8: GOSUB f
COLOR vertclair: LOCATE 9, 58: PRINT "La médiatrice EF est"
LOCATE 14, 58: PRINT "à la base AC"
sol = 2
RETURN

par7: 'triangle rectangle
LINE (80, 210)-(80, 100)
LINE -(380, 210)
LINE -(80, 210)
x = 80 - 17: y = 220 - 2: GOSUB a
x = 80 - 17: y = 100 - 18: GOSUB B
x = 380 + 10: y = 220 - 2: GOSUB c
COLOR vertclair: LOCATE 9, 58: PRINT "Le côté AB est"
LOCATE 14, 58: PRINT "au côté AC"
sol = 2
RETURN

par8: 'parallèlogramme
LINE (60, 200)-(160, 120)
LINE -(380, 120)
LINE -(280, 200)
LINE -(60, 200)
x = 160 - 17: y = 120 - 10: GOSUB a
x = 380 + 10: y = 120 - 10: GOSUB B
x = 280 + 10: y = 200 - 2: GOSUB c
x = 60 - 17: y = 200 - 2: GOSUB d
COLOR vertclair: LOCATE 9, 58: PRINT "La droite AD est"
LOCATE 14, 58: PRINT "à la droite BC"
sol = 1
RETURN

a:
PUT (x, y), a, XOR
RETURN

B:
PUT (x, y), B, XOR
RETURN

c:
PUT (x, y), c, XOR
RETURN

d:
PUT (x, y), d, XOR
RETURN

e:
PUT (x, y), e, XOR
RETURN

f:
PUT (x, y), f, XOR
RETURN

para100:
LOCATE 23, 13: COLOR blanc
PRINT CHR$(24) + " " + CHR$(25); " = orienter la ligne "; : COLOR jaune: PRINT l$
LOCATE 23, 60: COLOR blanc: PRINT rt$; " = valider"
RETURN

END SUB

DEFINT A-Z
SUB recoformes (re, ni, s, n$(), rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!, programme1$)
'2/12/96
DIM v(21), a$(16)
CONST pi = 3.141592653589#

a$(1) = "FIGURES SIMPLES"
a$(6) = "TRIANGLES"
a$(11) = "QUADRILATERES"
a$(16) = "SOLIDES"
re = 0: q = 0

GOSUB presentation
IF s = 6 THEN
GOSUB triangleaide
ELSEIF s = 11 THEN
GOSUB quadriaide
END IF
jj = 0
FOR boucle = s TO s + 4
erreurs = 0: jj = jj + 1
geo1:
v(boucle) = INT(RND * (s + 4)) + 1
IF v(boucle) < s THEN GOTO geo1
sol = v(boucle)
IF boucle <> s THEN
FOR k = 1 TO boucle - 1
IF v(k) = sol THEN f = 1
NEXT k
END IF
IF f = 1 THEN f = 0: GOTO geo1

SCREEN 9

geo2:
LOCATE 23: PRINT SPACE$(80)
r = s - 1
CALL titre2(a$(s))
LOCATE 22, 77: COLOR vertclair: PRINT 6 - jj
GOSUB reco15

GOSUB attente
LOCATE 23: PRINT SPACE$(80)
CALL cadre3(23, INT(41 - l / 2), l, noir)
IF g = 1 THEN
g = 0
CALL titre2(a$(s))
BEEP
CALL centre(23, rougeclair, "Tu n'as pas appuyé sur la barre [Espace] !")
CALL attendre(1.5): GOTO geo2
END IF
IF sol = r THEN
CALL exact(.5)
IF erreurs = 0 THEN re = re + 2
ELSE
erreurs = 1 + erreurs:
IF erreurs > 2 THEN
CALL titre2(a$(s))
ON sol GOSUB rect, carre, cercle, losa, triq, triq, trir, trii, trie, triir, rect, carre, losa, trap, para, cube, paral, pyra, cone, cylindre
CALL centre(23, rougeclair, "Regarde la forme : " + n$(sol))
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
GOTO geo2
ELSE
CALL erreur(.5)
IF n$(r) = "pyramide" THEN
CALL centre(23, rougeclair, "Tu as montré une " + n$(r) + ".")
ELSE
CALL centre(23, rougeclair, "Tu as montré un " + n$(r) + ".")
END IF
CALL attendre(2)
GOTO geo2
END IF
END IF
NEXT boucle

'résultats
CALL resultats(re, ni)
EXIT SUB

attente:
CALL attendre(.4)
r = r + 1
coul = blancbrill
ON r GOSUB rect, carre, cercle, losa, triq, triq, trir, trii, trie, triir, rect, carre, losa, trap, para, cube, paral, pyra, cone, cylindre
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
w$ = ""
tx! = 2
debut! = TIMER
DO
w$ = INKEY$
MousePoll v_mouse, h_mouse, lButton, rButton
IF lButton THEN
w$ = CHR$(32)
CALL attendre(.1)
END IF
IF w$ = CHR$(32) THEN EXIT DO
IF w$ = CHR$(27) THEN CALL cadre3(23, INT(41 - l / 2), l, noir): CALL quitter: GOSUB reco15
fin! = TIMER
LOOP WHILE fin! - debut! < tx!

IF w$ <> CHR$(32) THEN
IF r < s + 4 THEN
coul = bleu: ON r GOSUB rect, carre, cercle, losa, triq, triq, trir, trii, trie, triir, rect, carre, losa, trap, para, cube, paral, pyra, cone, cylindre
GOTO attente
END IF
g = 1
RETURN
END IF
RETURN


'DESSINS : rapport avec screen 9 : 0,73 (rapport écran 4/3)
rect: 'rectangle
LINE (160, 100)-(480, 210), coul, B
RETURN

carre:
x! = coef1! * 160
DRAW "b m240,230 c=" + VARPTR$(coul) + "u=" + VARPTR$(x!) + "r160 d=" + VARPTR$(x!) + "l160"
RETURN

cercle:
CIRCLE (320, 155), 90, coul, , , coef2!
RETURN

losa: 'losange
COLOR coul
LINE (160, 155)-(320, 100)
LINE -(480, 155)
LINE -(320, 210)
LINE -(160, 155)
RETURN

triq: 'triangle quelconque
COLOR coul
LINE (160, 210)-(245, 100)
LINE -(480, 165)
LINE -(160, 210)
RETURN

trir: 'triangle rectangle
COLOR coul
LINE (180, 210)-(180, 100)
LINE -(480, 210)
LINE -(180, 210)
RETURN

trii: 'triangle isocele
COLOR coul
LINE (265, 210)-(320, 90)
LINE -(380, 210)
LINE -(265, 210)
RETURN

trie: 'triangle équilatéral
x! = 210 - (coef1! * 138)'hauteur du tri équi avec des longueurs de 160
DRAW "b m240,210 c=" + VARPTR$(coul) + " m320,=" + VARPTR$(x!)
DRAW "m400,210 m240,210"
RETURN

triir: 'tri isocèle rectangle
x! = 210 - (coef1! * 160)
DRAW "b m240,210 c=" + VARPTR$(coul) + "m240,=" + VARPTR$(x!)
DRAW "m400,210 m240,210"
RETURN

trap: 'trapèze
COLOR coul
LINE (160, 210)-(260, 100)
LINE -(380, 100)
LINE -(460, 210)
LINE -(160, 210)
RETURN

para: 'parallèlogramme
COLOR coul
LINE (160, 200)-(260, 120)
LINE -(480, 120)
LINE -(380, 200)
LINE -(160, 200)
RETURN

cube:
x! = coef1! * 120
DRAW "b m220,230 c=" + VARPTR$(coul) + "u=" + VARPTR$(x!)
DRAW "r120 d=" + VARPTR$(x!) + "l120"
DRAW "u=" + VARPTR$(x!)
DRAW "ta40 r80 ta0 r120 d=" + VARPTR$(x!) + "ta40 l80 ta0"
DRAW "u=" + VARPTR$(x!) + "ta40 r80 ta0"
RETURN

paral:
x! = coef1! * 80
DRAW "b m140,210 c=" + VARPTR$(coul) + "u=" + VARPTR$(x!)
DRAW "r320 d=" + VARPTR$(x!) + "l320"
DRAW "u=" + VARPTR$(x!)
DRAW "ta40 r80 ta0 r320 d=" + VARPTR$(x!) + "ta40 l80 ta0"
DRAW "u=" + VARPTR$(x!) + "ta40 r80 ta0"
RETURN

pyra:
DRAW "b m220,210 c=" + VARPTR$(coul) + "ta330 r120"
DRAW "ta30 r100 ta0 m310,80 b m220,210 m310,80"
DRAW "b m220,210 ta330 r120 m310,80 ta0"
RETURN

cone:
CIRCLE (320, 220), 90, coul, pi, pi * 2, 3 / 10
LINE (320 - 90, 220)-(320, 90), coul
LINE -(320 + 90, 220), coul
RETURN

cylindre:
CIRCLE (320, 90), 90, coul, , , 3 / 10
CIRCLE (320, 220), 90, coul, pi, pi * 2, 3 / 10
LINE (320 - 90, 90)-(320 - 90, 220), coul
LINE (320 + 90, 90)-(320 + 90, 220), coul
RETURN

presentation:
CALL titre(a$(s))
CALL cadre(4, 10, 60, 15, marron)
COLOR , marron
IF pre$ <> "" THEN
CALL centre(5, blancbrill, pre$ + ",")
CALL centre(7, blancbrill, "l'ordinateur va afficher, en bas de l'écran,")
ELSE
CALL centre(7, blancbrill, "L'ordinateur va afficher, en bas de l'écran,")
END IF
CALL centre(9, blancbrill, "des noms de " + a$(s) + ".")
CALL centre(12, blancbrill, "Puis il va dessiner des formes.")
CALL centre(15, blancbrill, "A chaque fois que le nom correspondra à la forme,")
CALL centre(17, blancbrill, "tu devras appuyer [Espace]")
COLOR , noir
CALL centre(23, jaune, "Appuie sur la barre [Espace]")
DO
w$ = INKEY$
MousePoll v_mouse, h_mouse, lButton, rButton
IF lButton THEN
w$ = CHR$(32)
CALL attendre(.2)
END IF
IF w$ = CHR$(27) THEN CLS : RUN programme1$
LOOP WHILE w$ <> CHR$(32)
RETURN

quadriaide:
'CALL titre(a$(s))
COLOR , bleu: CLS
LOCATE 3, 4: COLOR jaune: PRINT "Rappel"
CALL cadre(4, 4, 70, 16, rouge)
COLOR , rouge
h = 7
LOCATE 6
COLOR jaune: LOCATE , h: PRINT " Les quadrilatères sont des polygones à 4 côtés."
LOCATE 8
COLOR rougeclair: LOCATE , h: PRINT " Caractéristiques :"
h3 = 24
LOCATE 10
COLOR vertclair: LOCATE , h: PRINT " Trapèze"; : COLOR blancbrill: LOCATE , h3: PRINT ": 2 côtés parallèles"
PRINT
COLOR vertclair: LOCATE , h: PRINT " Parallélogramme"; : COLOR blancbrill: LOCATE , h3: PRINT ": côtés parallèles et égaux 2 à 2"
PRINT
COLOR vertclair: LOCATE , h: PRINT " Rectangle"; : COLOR blancbrill: LOCATE , h3: PRINT ": côtés parallèles et égaux 2 à 2, angles droits"
PRINT
COLOR vertclair: LOCATE , h: PRINT " Losange"; : COLOR blancbrill: LOCATE , h3: PRINT ": 4 côtés égaux et parallèles 2 à 2"
PRINT
COLOR vertclair: LOCATE , h: PRINT " Carré"; : COLOR blancbrill: LOCATE , h3: PRINT ": 4 côtés égaux et parallèles 2 à 2, angles droits"
CALL getinvimouse(w)
RETURN

triangleaide:
'CALL titre(a$(s))
COLOR , bleu: CLS
LOCATE 3, 4: COLOR jaune: PRINT "Rappel"
CALL cadre(4, 4, 70, 16, rouge)
COLOR , rouge
h = 8
LOCATE 6
COLOR jaune: LOCATE , h: PRINT " Les triangles sont des polygones à 3 côtés."
LOCATE 9
COLOR rougeclair: LOCATE , h: PRINT " Caractéristiques :"
LOCATE 11
h3 = 36
COLOR vertclair: LOCATE , h: PRINT " Triangle isocèle"; : COLOR blancbrill: LOCATE , h3: PRINT ": 2 côtés et 2 angles égaux"
PRINT
COLOR vertclair: LOCATE , h: PRINT " Triangle équilatéral"; : COLOR blancbrill: LOCATE , h3: PRINT ": 3 côtés et 3 angles égaux"
PRINT
COLOR vertclair: LOCATE , h: PRINT " Triangle rectangle"; : COLOR blancbrill: LOCATE , h3: PRINT ": 1 angle droit"
PRINT
COLOR vertclair: LOCATE , h: PRINT " Triangle rectangle isocèle"; : COLOR blancbrill: LOCATE , h3: PRINT ": 2 côtés égaux et 1 angle droit"
CALL getinvimouse(w)
RETURN

reco15:
CALL centre(23, jaune, n$(sol))
l = LEN(n$(sol)) + 2
CALL cadre3(23, INT(41 - l / 2), l, blancbrill)
RETURN

END SUB

DEFINT A-Z
SUB solide2 (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
'4/12/96 souris
CONST pi = 3.141592653589#
CONST gauche = 75, droite = 77, haut = 72, bas = 80
DIM cas(1, 1), z(4)
re = 2 'car 4 essais
coul2 = noir

x = 1
FOR ligne = 0 TO 1
FOR col = 0 TO 1
cas(col, ligne) = x
x = x + 1
NEXT col, ligne
DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG

'présentation
w$ = "Un solide va être présenté en vue 'dépliée'."
z$ = "Avec les flèches, tu vas devoir le retrouver."
CALL consigne(2, w$, z$, xx$)

SCREEN 9

FOR jj = 1 TO 4
erreurs = 0
CALL titre2(titr$)
LINE (20, 45)-(300, 265), rouge, BF
'
LINE (320, 45)-(470, 145), vert, BF
LINE (490, 45)-(630, 145), vert, BF
LINE (320, 165)-(470, 265), vert, BF
LINE (490, 165)-(630, 265), vert, BF
'
LINE (320, 45)-(470, 145), jaune, B, &H8888
LINE (490, 45)-(630, 145), jaune, B, &H8888
LINE (320, 165)-(470, 265), jaune, B, &H8888
LINE (490, 165)-(630, 265), jaune, B, &H8888

coul = blancbrill
GOSUB volcube
GOSUB volparal
GOSUB volpyra
GOSUB volcylindre

COLOR vertclair: LOCATE 22, 1: PRINT "Niveau"; ni
LOCATE 22, 77: PRINT 5 - jj
GOSUB vol14

sol:
'tirage
DO
f = 0
z(jj) = INT(RND * 4) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
IF z(jj) = 1 AND jj = 1 THEN GOTO sol
choix = z(jj)

ON choix GOSUB solcube, solpara, solpyra, solcyl

VIEW (320, 45)-(635, 270)
col = 0: ligne = 0
LINE (0, 0)-(150, 100), coul2, B
flag = 1

DO
col2 = col: ligne2 = ligne
vol11:
MouseBorder 45, 320, 265, 630
MouseShow
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
souris = 0
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 22, 1: PRINT v_mouse, h_mouse '===
'réso EGA
IF lButton THEN
IF v_mouse >= 45 AND v_mouse <= 145 THEN
IF h_mouse >= 320 AND h_mouse <= 470 THEN
'1° carre
col = 0: ligne = 0: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 490 AND h_mouse <= 630 THEN
'2° carre
col = 1: ligne = 0: souris = 2
CALL attendre(.2)
EXIT DO
END IF
ELSEIF v_mouse >= 165 AND v_mouse <= 265 THEN
IF h_mouse >= 320 AND h_mouse <= 470 THEN
'3° carre
col = 0: ligne = 1: souris = 2
CALL attendre(.2)
EXIT DO
ELSEIF h_mouse >= 490 AND h_mouse <= 630 THEN
'4° carre
col = 1: ligne = 1: souris = 2
CALL attendre(.2)
EXIT DO
ELSE
BEEP
END IF
END IF
END IF
LOOP WHILE r$ = ""

MouseHide

IF souris = 2 THEN
LINE (170 * col2, 120 * ligne2)-(150 + 160 * col2, 100 + 120 * ligne2), bleu, B
LINE (170 * col2, 120 * ligne2)-(150 + 160 * col2, 100 + 120 * ligne2), jaune, B, &H8888
LINE (170 * col, 120 * ligne)-(150 + 160 * col, 100 + 120 * ligne), coul2, B
col2 = col: ligne2 = ligne
EXIT DO
END IF

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

IF valtouche = 50 THEN valtouche = bas
IF valtouche = 52 THEN valtouche = gauche
IF valtouche = 54 THEN valtouche = droite
IF valtouche = 56 THEN valtouche = haut

SELECT CASE valtouche
CASE gauche
col = col - 1
IF col = -1 THEN col = 1: ligne = ligne - 1
IF ligne = -1 THEN ligne = 1: col = 1

CASE droite
col = col + 1
IF col = 2 THEN col = 0: ligne = ligne + 1
IF ligne = 2 THEN ligne = 0: col = 0

CASE haut
ligne = ligne - 1
IF ligne = -1 THEN ligne = 1

CASE bas
ligne = ligne + 1
IF ligne = 2 THEN ligne = 0

CASE 27
CALL quitter: GOSUB vol14: GOTO vol11

CASE 13
EXIT DO

CASE ELSE
BEEP

END SELECT
LINE (170 * col2, 120 * ligne2)-(150 + 160 * col2, 100 + 120 * ligne2), bleu, B
LINE (170 * col2, 120 * ligne2)-(150 + 160 * col2, 100 + 120 * ligne2), jaune, B, &H8888
LINE (170 * col, 120 * ligne)-(150 + 160 * col, 100 + 120 * ligne), coul2, B

LOOP

LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)
reponse = cas(col, ligne)

'tester la reponse
IF reponse = choix THEN
CALL exact(1.3)
IF erreurs = 0 THEN re = re + 2
ELSE
erreurs = erreurs + 1
CALL erreur(1.2)
GOSUB vol14: GOTO vol11
END IF

VIEW
NEXT

'résultats
CALL resultats(re, ni)
EXIT SUB

volcube:
x! = coef1! * 52
DRAW "b m360,130 c=" + VARPTR$(coul) + "u=" + VARPTR$(x!)
DRAW "r52 d=" + VARPTR$(x!) + "l52"
DRAW "u=" + VARPTR$(x!)
DRAW "ta40 r35 ta0 r52 d=" + VARPTR$(x!) + "ta40 l35 ta0"
DRAW "u=" + VARPTR$(x!) + "ta40 r35 ta0"
RETURN

volparal:
x! = coef1! * 30
DRAW "b m515,120 c=" + VARPTR$(coul) + "u=" + VARPTR$(x!)
DRAW "r70 d=" + VARPTR$(x!) + "l70"
DRAW "u=" + VARPTR$(x!)
DRAW "ta40 r35 ta0 r70 d=" + VARPTR$(x!) + "ta40 l35 ta0"
DRAW "u=" + VARPTR$(x!) + "ta40 r35 ta0"
RETURN

volpyra:
DRAW "b m350,235 c=" + VARPTR$(coul) + "ta330 r60"
DRAW "ta30 r50 ta0 m395,175 b m350,235 m395,175"
DRAW "b m350,235 ta330 r60 m395,175 ta0"
RETURN

volcylindre:
CIRCLE (560, 190), 30, coul, , , 3 / 10
CIRCLE (560, 240), 30, coul, pi, pi * 2, 3 / 10
LINE (560 - 30, 190)-(560 - 30, 240), coul
LINE (560 + 30, 190)-(560 + 30, 240), coul
RETURN

solcube:
x! = coef1! * 52
DRAW "b m50,180 c=" + VARPTR$(vertclair) + "u=" + VARPTR$(x!)
DRAW "r208 d=" + VARPTR$(x!) + "l208"
DRAW "r52 u=" + VARPTR$(x!) + "u=" + VARPTR$(x!) + "r52"
FOR i = 1 TO 3: DRAW "d=" + VARPTR$(x!): NEXT
DRAW "l52" + "u=" + VARPTR$(x!)
DRAW "r104 u=" + VARPTR$(x!)
RETURN

solpara:
x! = coef1! * 30: x2! = coef1! * 52
DRAW "b m50,180 c=" + VARPTR$(vertclair) + "u=" + VARPTR$(x2!)
DRAW "r200 d=" + VARPTR$(x2!) + "l200"
DRAW "r30 u=" + VARPTR$(x2!) + "u=" + VARPTR$(x!) + "r70"
DRAW "d=" + VARPTR$(x!) + "d=" + VARPTR$(x2!) + "d=" + VARPTR$(x!) + "l70"
DRAW "u=" + VARPTR$(x!)
DRAW "r100 u=" + VARPTR$(x2!)
RETURN

solpyra:
x! = coef1! * 52: y! = 180 - (x! / 2)
DRAW "b m150,180 c=" + VARPTR$(vertclair) + "u=" + VARPTR$(x!)
DRAW "r52 d=" + VARPTR$(x!) + "l52"
DRAW "u=" + VARPTR$(x!) + "m70,=" + VARPTR$(y!) + "m150,180"
DRAW "r52 u=" + VARPTR$(x!) + "m282,=" + VARPTR$(y!) + "m202,180"
z! = (80 * coef1!) + 180
DRAW "m176,=" + VARPTR$(z!) + "m150,180"
z! = 180 - (x! + (80 * coef1!)): y! = 180 - x!
DRAW "u=" + VARPTR$(x!) + "m176,=" + VARPTR$(z!) + "m202,=" + VARPTR$(y!)
RETURN

solcyl:
DRAW "b m70,180 c=" + VARPTR$(vertclair) + "u50 r180 d50 l180"
CIRCLE (160, 100), 30, vertclair, , , coef2!
CIRCLE (160, 210), 30, vertclair, , , coef2!
RETURN


vol14:
LOCATE 23: PRINT SPACE$(80)
CALL centre(23, blanc, CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + " = sélectionner le solide " + rt$ + " = valider")
RETURN

END SUB

DEFINT A-Z
SUB verti (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
'3/12/96 souris
CONST gauche = 75, droite = 77
CONST haut = 72, bas = 80
DIM col(8), x(8), x1(8), t(8), z(5), y(5), y1(5), xx1(8), xx2(8), yy1(8), yy2(8)
DIM trian(1 TO 100) AS INTEGER
DIM trian2(1 TO 100) AS INTEGER
DIM cercle(1 TO 50) AS INTEGER
g$ = CHR$(27) + " " + CHR$(26) + " ou " + CHR$(24) + " " + CHR$(25)
titr$ = "Verticale - Horizontale"
x1(1) = 100: x1(2) = 180: x1(3) = 220: x1(4) = 300
x1(5) = 380: x1(6) = 420: x1(7) = 500: x1(8) = 540
y1(1) = 77: y1(2) = 119: y1(3) = 147: y1(4) = 189
y1(5) = 259


re = 0

CALL niveau(ni, 2, titr$)

GOSUB ver20 'présentation

'dessin des triangles + rond

SCREEN 9, , 1, 0
x = 320: y = 175
tria$ = "c15 m-5,+0 m+5,-10 m+5,+10 m-5,+0 b m+2,-1 p12,15 "
DRAW "m320,175 " + tria$
GET (x - 5, y)-(x + 5, y - 10), trian
CLS 1
tria$ = "c15 m+0,-5 m+10,+5 m-10,+5 m+0,-5 b m+2,+0 p12,15 "
DRAW "m320,175 " + tria$
GET (x, y - 5)-(x + 10, y + 10), trian2
CLS 1
CIRCLE (x, y), 4, jaune, , , coef2!
GET (x - 4, y - 4)-(x + 4, y + 4), cercle
SCREEN 9, , 0, 0

IF ni = 1 THEN GOSUB verniveau1 ELSE GOSUB verniveau2

'résultats
CALL resultats(re, ni)

EXIT SUB
'+++++++++++++++++++++++++++

verniveau1:
'verticale +++++++++++++++++++++++++++++++++++++++

FOR jj = 1 TO 3
erreurs = 0
tit$ = "Verticale"
CALL titre2(tit$)
LOCATE 22: COLOR vertclair: PRINT "Niveau"; ni
LOCATE 22, 77: PRINT 11 - jj
COLOR jaune
FOR i = 1 TO 8
LOCATE 19, INT(x1(i) / 8) + 1: PRINT CHR$(219) 'pavé blanc
NEXT

GOSUB ver21

flag = 1
FOR i = 1 TO 8
col(i) = vertclair
NEXT
col(1) = jaune

GOSUB ver3

DO
flag2 = flag
GOSUB ver1
ver12:
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
v2 = 23: h3 = 13
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'matrice 14 x 8 = transforme en coord écran
'v_graph = v_mouse: h_graph = h_mouse
v_mouse = INT(v_mouse / 14) + 1
h_mouse = INT(h_mouse / 8) + 1
'LOCATE 21, 1: PRINT v_graph, h_graph'===
' LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF v_mouse >= 5 AND v_mouse <= 20 THEN
f = 0
FOR i = 1 TO 8
'IF h_mouse = INT(x1(i) / 8) + 1 THEN
IF h_mouse >= INT(x1(i) / 8) AND h_mouse <= INT(x1(i) / 8) + 2 THEN
flag = i: f = 1
CALL attendre(.2)
souris = 2
EXIT FOR
END IF
NEXT
IF f = 1 THEN EXIT DO
END IF
IF v_mouse = v2 AND h_mouse = h3 THEN
valtouche = gauche
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND h_mouse = h3 + 2 THEN
valtouche = droite
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND (h_mouse >= 60 AND h_mouse <= 72) THEN
valtouche = 13
souris = 1
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF

LOOP WHILE r$ = ""

MouseHide

IF souris = 2 THEN
FOR i = 1 TO 8
col(i) = vertclair
NEXT
col(flag) = jaune
GOSUB ver2
flag2 = flag
GOSUB ver1

valtouche = 13
END IF

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

SELECT CASE valtouche
CASE gauche
flag = flag - 1: IF flag = 0 THEN flag = 8

CASE droite
flag = flag + 1: IF flag = 9 THEN flag = 1
CASE 27
CALL quitter: GOSUB ver21
CASE 13
EXIT DO
CASE ELSE
BEEP

END SELECT

FOR i = 1 TO 8
col(i) = vertclair
NEXT
col(flag) = jaune
GOSUB ver2

LOOP WHILE valtouche <> 13
LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)
IF reponse = flag THEN
CALL exact(.6)
IF erreurs = 0 THEN re = re + 1
ELSE
CALL erreur(.9)
erreurs = erreurs + 1: LOCATE 23: PRINT SPACE$(80): GOSUB ver21: GOTO ver12
END IF
LOCATE 23: PRINT SPACE$(80)

NEXT jj

'horizontale +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

FOR i = 1 TO 3: z(i) = 0: NEXT

FOR jj = 1 TO 3
erreurs = 0
tit$ = "Horizontale"
CALL titre2(tit$)
LOCATE 22, 77: COLOR vertclair: PRINT 8 - jj: LOCATE 22, 1: PRINT "Niveau"; ni
COLOR jaune
FOR i = 1 TO 5
LOCATE INT(y1(i) / 14) + 1, 6: PRINT CHR$(219)'pavé blanc
NEXT

GOSUB ver21

flag = 1
FOR i = 1 TO 5
col(i) = vertclair
NEXT
col(1) = jaune

GOSUB hor3

DO
flag2 = flag
GOSUB hor1
hor12:
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
v2 = 23: h3 = 13
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'matrice 14 x 8 = transforme en coord écran
v_mouse = INT(v_mouse / 14) + 1
h_mouse = INT(h_mouse / 8) + 1
'LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF (v_mouse >= 5 AND v_mouse <= 20) AND (h_mouse >= 6 AND h_mouse <= 73) THEN
f = 0
FOR i = 1 TO 5
IF v_mouse >= INT(y1(i) / 14) AND v_mouse <= INT(y1(i) / 14) + 2 THEN
flag = i: f = 1
CALL attendre(.2)
souris = 2
EXIT FOR
END IF
NEXT
IF f = 1 THEN EXIT DO
END IF

IF v_mouse = v2 AND h_mouse = h3 THEN
valtouche = haut
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND h_mouse = h3 + 2 THEN
valtouche = bas
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND (h_mouse >= 60 AND h_mouse <= 72) THEN
valtouche = 13
souris = 1
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF

LOOP WHILE r$ = ""

MouseHide

IF souris = 2 THEN
FOR i = 1 TO 5
col(i) = vertclair
NEXT
col(flag) = jaune
GOSUB hor2
flag2 = flag
GOSUB hor1

valtouche = 13
END IF

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

SELECT CASE valtouche
CASE haut
flag = flag - 1: IF flag = 0 THEN flag = 5

CASE bas
flag = flag + 1: IF flag = 6 THEN flag = 1
CASE 27
CALL quitter: GOSUB ver21
CASE 13
EXIT DO
CASE ELSE
BEEP

END SELECT
FOR i = 1 TO 5
col(i) = vertclair
NEXT
col(flag) = jaune
GOSUB hor2

LOOP WHILE valtouche <> 13
LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)

IF reponse = flag THEN
CALL exact(.6)
IF erreurs = 0 THEN re = re + 1
ELSE
CALL erreur(.9)
erreurs = erreurs + 1: LOCATE 23: PRINT SPACE$(80): GOSUB ver21: GOTO hor12
END IF
LOCATE 23: PRINT SPACE$(80)

NEXT jj

FOR jj = 1 TO 4
erreurs = 0
CALL titre2(titr$)
COLOR vertclair: LOCATE 22: PRINT "Niveau"; ni
LOCATE 22, 77: PRINT 5 - jj

GOSUB ver25 'init
GOSUB ver26 'tirage

GOSUB ver31

flag = 1
FOR i = 1 TO 8
col(i) = rougeclair
NEXT
col(1) = jaune

DO
flag2 = flag
GOSUB ver23 'affichage

ver22:
MouseBorder 308, 10, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
v2 = 23
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'matrice 14 x 8 = transforme en coord écran
v_mouse = INT(v_mouse / 14) + 1
h_mouse = INT(h_mouse / 8) + 1
'LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF v_mouse = v2 AND h_mouse = 10 THEN
valtouche = gauche
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND h_mouse = 12 THEN
valtouche = droite
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND h_mouse = 17 THEN
valtouche = haut
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND h_mouse = 19 THEN
valtouche = bas
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND (h_mouse >= 60 AND h_mouse <= 72) THEN
valtouche = 13
souris = 1
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF

LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

SELECT CASE valtouche
CASE gauche, haut
flag = flag - 1: IF flag = 0 THEN flag = 8

CASE droite, bas
flag = flag + 1: IF flag = 9 THEN flag = 1
CASE 27
CALL quitter: GOSUB ver31
CASE 13
EXIT DO
CASE ELSE
BEEP

END SELECT
FOR i = 1 TO 8
col(i) = rougeclair
NEXT
col(flag) = jaune
GOSUB ver23

LOOP WHILE valtouche <> 13
LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)
IF reponse = flag THEN
CALL exact(.6)
IF erreurs = 0 THEN re = re + 1
ELSE
CALL erreur(.9)
erreurs = erreurs + 1: LOCATE 23: PRINT SPACE$(80): GOSUB ver31: GOTO ver22
END IF
LOCATE 23: PRINT SPACE$(80)

NEXT jj

RETURN
'++++++++++++++++++++
verniveau2:
FOR jj = 1 TO 5
erreurs = 0
IF jj / 2 = INT(jj / 2) THEN choix = 1 ELSE choix = 2

IF choix = 1 THEN
tit$ = "verticale"
l$ = "verticalement"
reponse = 0
ELSE
tit$ = "horizontale"
l$ = "horizontalement"
reponse = 90
END IF
LOCATE 1: PRINT SPACE$(80)
CALL titre2(tit$)
LOCATE 22, 77: COLOR vertclair: PRINT 6 - jj: LOCATE 22, 1: PRINT "Niveau"; ni


GOSUB ver100
x = INT(RND * 200) + 220: y = 155
angle = (INT(RND * 6) + 2) * 10

'LINE (50, 50)-(590, 260), jaune, B
x2 = INT(RND * 160) + 60
y2 = INT(RND * 150) + 100
y3 = INT(RND * 40) + 60
y4 = INT(RND * 100) + 100
y5 = INT(RND * 40) + 60
x3 = INT(RND * 200) + 100
x5 = INT(RND * 60) + 300
x4 = INT(RND * 100) + 400
x6 = INT(RND * 60) + 100
x7 = INT(RND * 100) + 250
x8 = INT(RND * 100) + 400
y6 = INT(RND * 100) + 130
y7 = INT(RND * 100) + 100
y8 = INT(RND * 110) + 130

ver110:
DO
LINE (50, y2)-(590, y3), jaune, , &H8888
LINE (x2, 260)-(590, y4), jaune, , &H8888
LINE (50, y5)-(x3, 50), jaune, , &H8888
LINE (x5, 50)-(x4, 260), jaune, , &H8888
LINE (x6, 50)-(x7, 260), jaune, , &H8888
LINE (x8, 50)-(590, y6), jaune, , &H8888
LINE (50, y7)-(590, y8), jaune, , &H8888

ancienangle = angle
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + "ta=" + VARPTR$(angle) + "c=" + VARPTR$(vertclair) + "u100 d200"

MouseBorder 308, 10, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
v2 = 23: h3 = 13
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' v_graph = v_mouse: h_graph = h_mouse
v_mouse = INT(v_mouse / 14) + 1
h_mouse = INT(h_mouse / 8) + 1
' LOCATE 21, 1: PRINT v_graph, h_graph'===
' LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF v_mouse = v2 AND h_mouse = h3 THEN
valtouche = haut ' 72 'fleche haut
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND h_mouse = h3 + 2 THEN
valtouche = bas '80 'fleche bas
souris = 1
CALL attendre(.2)
EXIT DO
ELSEIF v_mouse = v2 AND (h_mouse >= 60 AND h_mouse <= 72) THEN
valtouche = 13
souris = 1
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF

LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

SELECT CASE valtouche
CASE haut
angle = angle - 5: IF angle < 0 THEN angle = 355
CASE bas
angle = angle + 5: IF angle > 360 THEN angle = 5
CASE 27
CALL quitter: GOSUB ver100
CASE 13
EXIT DO
CASE ELSE
BEEP

END SELECT
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + "ta=" + VARPTR$(ancienangle) + "c=" + VARPTR$(bleu) + "u100 d200"
IF angle = 360 THEN angle = 0
LOOP
LOCATE 23: PRINT SPACE$(80)

IF angle = reponse OR angle - 180 = reponse THEN
CALL exact(.7)
IF erreurs = 0 THEN re = re + 2
ELSE
erreurs = erreurs + 1
IF erreurs > 2 THEN
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + "ta=" + VARPTR$(reponse) + "c=" + VARPTR$(rougeclair) + "u100 d200"
CALL centre(23, rougeclair, "Regarde")
CALL attendre(2)
DRAW "b m=" + VARPTR$(x) + ",=" + VARPTR$(y) + "ta=" + VARPTR$(reponse) + "c=" + VARPTR$(bleu) + "u100 d200"
ELSE
CALL erreur(.7)
END IF
GOSUB ver100
GOTO ver110
END IF

NEXT

RETURN
'+++++++++++++++++++++++++++

ver1:
y1 = 60: y2 = 240
FOR i = 1 TO 8
COLOR col(i): LINE (x1(i), y2)-(x(i), y1)
NEXT
GOSUB ver2
RETURN

ver2:
'dessiner tria
PUT (x1(flag2) - 5, y2 + 13), trian, XOR
RETURN

ver3:
'tirage
DO
f = 0
z(jj) = INT(RND * 6) + 2
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
reponse = z(jj)

FOR i = 1 TO 8
t(i) = INT(RND * 20) + 3
signe = INT(RND * 2)
IF signe = 0 THEN t(i) = -t(i)
x(i) = x1(i) + t(i)
NEXT
x(reponse) = x1(reponse)
RETURN


hor1:
x1 = 60: x2 = 580
FOR i = 1 TO 5
COLOR col(i): LINE (x1, y1(i))-(x2, y(i))
NEXT
GOSUB hor2
RETURN

hor2:
'dessiner tria
PUT (x1 - 20, y1(flag2) - 5), trian2, XOR
RETURN

hor3:
'tirage
DO
f = 0
z(jj) = INT(RND * 5) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
reponse = z(jj)

FOR i = 1 TO 5
t(i) = INT(RND * 20) + 3
signe = INT(RND * 2)
IF signe = 0 THEN t(i) = -t(i)
y(i) = y1(i) + t(i)
NEXT
y(reponse) = y1(reponse)
RETURN

ver23:
FOR i = 1 TO 8
COLOR col(i): LINE (xx1(i), yy1(i))-(xx2(i), yy2(i))
NEXT
GOSUB ver24
RETURN

ver24:
'dessiner ronds
PUT (xx1(flag2) - 4, yy1(flag2) - 4), cercle, XOR
PUT (xx2(flag2) - 4, yy2(flag2) - 4), cercle, XOR
RETURN

ver20:
IF ni = 1 THEN
w$ = "Avec les flèches " + g$ + ", tu vas devoir sélectionner"
z$ = "les verticales ou les horizontales."
CALL consigne(2, w$, z$, xx$)
ELSE
w$ = "Avec les flèches " + CHR$(24) + " " + CHR$(25) + ", tu vas devoir orienter une ligne"
z$ = "afin qu'elle soit horizontale ou verticale."
CALL consigne(2, w$, z$, xx$)
END IF

RETURN

ver25:
xx1(6) = 100: xx1(2) = 150: xx1(3) = 90: xx1(4) = 180
xx1(1) = 320: xx1(5) = 480: xx1(7) = 580: xx1(8) = 440
yy1(6) = 90: yy1(2) = 160: yy1(3) = 240: yy1(4) = 220
yy1(1) = 240: yy1(5) = 250: yy1(7) = 260: yy1(8) = 80
xx2(6) = 460: xx2(2) = 530: xx2(3) = 290: xx2(4) = 430
xx2(1) = 390: xx2(5) = 460: xx2(7) = 530: xx2(8) = 620
yy2(6) = 150: yy2(2) = 220: yy2(3) = 90: yy2(4) = 250
yy2(1) = 80: yy2(5) = 70: yy2(7) = 110: yy2(8) = 170
RETURN

ver26:
'tirage pour xx2,yy2
'2,4,6,8 = hori 1,3,5,7 = verti
DO
f = 0
z(jj) = INT(RND * 8) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
reponse = z(jj)

SELECT CASE reponse
CASE 2, 4, 6, 8
yy2(reponse) = yy1(reponse)
xx2(reponse - 1) = xx1(reponse - 1)
l$ = "horizontale"
CASE 1, 3, 5, 7
xx2(reponse) = xx1(reponse)
yy2(reponse + 1) = yy1(reponse + 1)
l$ = "verticale"
END SELECT
RETURN

ver21:
IF tit$ = "Verticale" THEN
f$ = CHR$(27) + " " + CHR$(26)
ELSE
f$ = CHR$(24) + " " + CHR$(25)
END IF
LOCATE 23, 13
COLOR blanc: PRINT f$; " = sélectionner la ligne "; : COLOR jaune: PRINT LCASE$(tit$)
COLOR blanc
LOCATE 23, 60: PRINT rt$ + " = valider"
RETURN

ver31:
LOCATE 23, 10: COLOR blanc
PRINT g$; " = sélectionner la ligne "; : COLOR jaune: PRINT l$
LOCATE 23, 60: COLOR blanc: PRINT rt$; " = valider"
RETURN

ver100:
LOCATE 23, 13: COLOR blanc
PRINT CHR$(24) + " " + CHR$(25); " = orienter la ligne "; : COLOR jaune: PRINT l$
LOCATE 23, 60: COLOR blanc: PRINT rt$; " = valider"
RETURN

END SUB

DEFINT A-Z
SUB vocabu (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
CONST pi = 3.141592653589#
DIM z(10), an$(10)
DIM trian(1 TO 100) AS INTEGER
DIM trian2(1 TO 100) AS INTEGER

re = 0

an$(1) = "largeur"
an$(2) = "longueur"
an$(3) = "hauteur"
an$(4) = "diagonale"
an$(5) = "diamètre"
an$(6) = "rayon"
an$(7) = "arc de cercle"
an$(8) = "médiatrice"
an$(9) = "médiane"
an$(10) = "bissectrice"

CALL niveau(ni, 2, titr$)

SELECT CASE ni
CASE 1
max = 5
CASE 2
max = 10
END SELECT

'présentation
w$ = "Des figures vont s'afficher à l'écran."
z$ = "Une ligne va être sélectionnée."
xx$ = "Tu devras choisir le nom de cette ligne dans une liste de mots."
CALL consigne(3, w$, z$, xx$)

SCREEN 9, , 1, 0
x = 320: y = 175
tria$ = "c15 m-5,+0 m+5,-10 m+5,+10 m-5,+0 b m+2,-1 p12,15 "
DRAW "m320,175 " + tria$
GET (x - 5, y)-(x + 5, y - 10), trian
CLS 1
tria$ = "c15 m+0,-5 m+10,+5 m-10,+5 m+0,-5 b m+2,+0 p12,15 "
DRAW "m320,175 " + tria$
GET (x, y - 5)-(x + 10, y + 10), trian2

SCREEN 9, , 0, 0

CALL titre3(titr$)

FOR jj = 1 TO max
erreurs = 0
'tirage
DO
f = 0
z(jj) = INT(RND * max) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj)

ON choix GOSUB vo1, vo2, vo3, vo4, vo5, vo6, vo7, vo8, vo9, vo10
LOCATE 22: COLOR vertclair: PRINT "Niveau"; ni
LOCATE 22, 77: PRINT (max + 1) - jj
voca10:
LINE (440, 70)-(620, 220), noir, BF
COLOR blanc: LOCATE 18, 62: PRINT gg$
IF ni = 1 THEN v = 9: h = 63 ELSE v = 7: h = 62
CALL flechesbis(v, h, an$(), max, r)
IF r = 0 THEN CALL quitter: GOTO voca10
IF r = choix THEN
CALL exact(.7)
IF erreurs = 0 THEN
IF ni = 1 THEN re = re + 2 ELSE re = re + 1
END IF
ELSE
erreurs = erreurs + 1
IF erreurs > 2 THEN
CALL centre(23, rougeclair, "Solution : " + an$(choix))
ELSE
CALL erreur(.7)
LOCATE 23: PRINT SPACE$(80)
END IF
GOTO voca10
END IF
LINE (0, 28)-(426, 270), bleu, BF
LINE (440, 70)-(620, 220), noir, BF
LOCATE 23: PRINT SPACE$(80)

NEXT jj

'++++++++++

'résultats
CALL resultats(re, ni)

EXIT SUB

vocacercle:
coul = jaune
CIRCLE (x, y), 3, coul, , , coef2!
CIRCLE (x, y), 4, coul, , , coef2!
CIRCLE (x2, y2), 3, coul, , , coef2!
CIRCLE (x2, y2), 4, coul, , , coef2!
RETURN

vo1: 'largeur
ch = INT(RND * 2) + 1
SELECT CASE ch
CASE 1
x = 360: y = 80: x2 = 360: y2 = 210
CASE 2
x = 70: y = 80: x2 = 70: y2 = 210
END SELECT
GOSUB vocacercle
'rect
LINE (70, 80)-(360, 210), blancbrill, B
LINE (x, y)-(x2, y2), vertclair
PUT (x - 20, y + 60), trian2, XOR
RETURN

vo2: 'longueur
ch = INT(RND * 2) + 1
SELECT CASE ch
CASE 1
x = 70: y = 95: x2 = 360: y2 = 95
CASE 2
x = 70: y = 195: x2 = 360: y2 = 195
END SELECT
GOSUB vocacercle
'rect
LINE (70, 95)-(360, 195), blancbrill, B
LINE (x, y)-(x2, y2), vertclair
PUT (x + 145, y + 10), trian, XOR
RETURN

vo3: 'hauteur
x = 200: y = 90: x2 = 200: y2 = 220
GOSUB vocacercle
'triang
LINE (80, 220)-(200, 90), blancbrill
LINE -(380, 220)
LINE -(80, 220)
LINE (x2, y2 - 10 * coef1!)-(x2 + 10, y2), , B
LINE (x, y)-(x2, y2), vertclair
PUT (x - 20, y + 65), trian2, XOR
RETURN

vo4: 'diagonale
ch = INT(RND * 2) + 1
IF ni = 1 THEN
SELECT CASE ch
CASE 1
x = 70: y = 95: x2 = 360: y2 = 195
CASE 2
x = 70: y = 195: x2 = 360: y2 = 95
END SELECT
GOSUB vocacercle
'rect
LINE (70, 95)-(360, 195), blancbrill, B
LINE (x, y)-(x2, y2), vertclair
PUT (210, 155), trian, XOR
ELSE
SELECT CASE ch
CASE 1
x = 200: y = 80: x2 = 200: y2 = 220
CASE 2
x = 50: y = 150: x2 = 350: y2 = 150
END SELECT
GOSUB vocacercle
'losange
LINE (50, 150)-(200, 80), blancbrill
LINE -(350, 150)
LINE -(200, 220)
LINE -(50, 150)
LINE (x, y)-(x2, y2), vertclair
IF ch = 1 THEN
PUT (x - 20, y + 65), trian2, XOR
ELSE
PUT (x + 145, y + 10), trian, XOR
END IF
END IF
RETURN

vo5: 'diamètre
x = 140: y = 170: x2 = 300: y2 = 170
GOSUB vocacercle
'cercle
CIRCLE (220, 170), 80, blancbrill, , , coef2!
LINE (x, y)-(x2, y2), vertclair
PUT (215, y + 10), trian, XOR
RETURN

vo6: 'rayon
ch = INT(RND * 2) + 1
SELECT CASE ch
CASE 1
x = 220: y = 170: x2 = 300: y2 = 170
CASE 2
x = 140: y = 170: x2 = 220: y2 = 170
END SELECT
GOSUB vocacercle
'cercle
CIRCLE (220, 170), 80, blancbrill, , , coef2!
LINE (x, y)-(x2, y2), vertclair
IF ch = 1 THEN x = 255 ELSE x = 175
PUT (x, y + 10), trian, XOR
RETURN

vo7: 'arc de cercle
x = 220: y = 170 - (80 * coef2!): x2 = 300: y2 = 170
GOSUB vocacercle
'cercle
CIRCLE (220, 170), 80, blancbrill, , , coef2!
CIRCLE (220, 170), 80, vertclair, 0, pi / 2, coef2!
PUT (260, 130), trian2, XOR
RETURN

vo8: 'médiatrice
'triang
LINE (80, 220)-(200, 90), blancbrill
LINE -(380, 220)
LINE -(80, 220)
LINE (160, 215)-(150, 225)
LINE (310, 215)-(300, 225)
LINE (230, 220 - (10 * coef1!))-(240, 220), , B
LINE (230, 70)-(230, 240), vertclair
PUT (210, 155), trian2, XOR
RETURN

vo9: 'médiane
x = 200: y = 90: x2 = 230: y2 = 220
GOSUB vocacercle
'triang
LINE (80, 220)-(200, 90), blancbrill
LINE -(380, 220)
LINE -(80, 220)
LINE (160, 215)-(150, 225)
LINE (310, 215)-(300, 225)
LINE (200, 90)-(230, 220), vertclair
PUT (x, y + 65), trian2, XOR
RETURN

vo10: 'bissectrice
DRAW "b m80,220 ta60 c15 r170 m380,220 m80,220 ta30 c10 r188"
CIRCLE STEP(0, 0), 3, jaune, , , coef2!
CIRCLE STEP(0, 0), 4, jaune, , , coef2!
CIRCLE (80, 220), 3, jaune, , , coef2!
CIRCLE (80, 220), 4, jaune, , , coef2!
CIRCLE (80, 220), 35, jaune, 0, 30 * (pi / 180)
CIRCLE (80, 220), 30, jaune, 30 * (pi / 180), 60 * (pi / 180)
RETURN

END SUB
 

 

DECLARE SUB MouseBorder (row1%, col1%, row2%, col2%)
DECLARE SUB MouseHide ()
DECLARE SUB MousePoll (row%, col%, lButton%, rButton%)
DECLARE SUB MouseShow ()
DECLARE SUB getinvimouse (rr%)
DECLARE SUB claviernumerique (z$)
DECLARE SUB consigne (nl%, w$, z$, xx$)
DECLARE SUB centre (v%, coul%, ph$)
DECLARE SUB quitter ()
DECLARE SUB getinvi (rr%)
DECLARE SUB niveau (r%, np%, titr$)
DECLARE SUB titre (titr$)
DECLARE SUB attendre (tx!)
DECLARE SUB entree ()
DECLARE SUB erreur (tx!)
DECLARE SUB exact (tx!)
DECLARE SUB inputgen (nl%, r$, deb%, fin%)
DECLARE SUB resultats (re%, ni%)
DECLARE SUB titre2 (titr$)
'EXO 5 GEOMETRIE
'Daniel CLERC 7/4/96
'version 1.5


DEFINT A-Z
SUB coord (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
DIM z(5), z2(5), y(11, 5), x(11, 5), xx(11), yy(11)
DIM cercle(1 TO 100) AS INTEGER
titr$ = "coordonnees"
CONST gauche = 75, droite = 77
CONST haut = 72, bas = 80
er = 0: re = 0

x(0, 1) = 15: y(0, 1) = 6
x(1, 1) = 23: y(1, 1) = 0
x(2, 1) = 27: y(2, 1) = 1
x(3, 1) = 19: y(3, 1) = 6
x(4, 1) = 15: y(4, 1) = 12
x(5, 1) = 14: y(5, 1) = 12
x(6, 1) = 10: y(6, 1) = 6
x(7, 1) = 2: y(7, 1) = 1
x(8, 1) = 6: y(8, 1) = 0
x(9, 1) = 14: y(9, 1) = 6
x(10, 1) = 15: y(10, 1) = 6
x(11, 1) = 10

x(0, 2) = 2: y(0, 2) = 7
x(1, 2) = 8: y(1, 2) = 3
x(2, 2) = 12: y(2, 2) = 7
x(3, 2) = 26: y(3, 2) = 1
x(4, 2) = 28: y(4, 2) = 7
x(5, 2) = 26: y(5, 2) = 13
x(6, 2) = 12: y(6, 2) = 7
x(7, 2) = 8: y(7, 2) = 11
x(8, 2) = 2: y(8, 2) = 7
x(11, 2) = 8

x(0, 3) = 15: y(0, 3) = 7
x(1, 3) = 4: y(1, 3) = 1
x(2, 3) = 15: y(2, 3) = 3
x(3, 3) = 26: y(3, 3) = 1
x(4, 3) = 15: y(4, 3) = 7
x(5, 3) = 29: y(5, 3) = 13
x(6, 3) = 15: y(6, 3) = 10
x(7, 3) = 1: y(7, 3) = 13
x(8, 3) = 15: y(8, 3) = 7
x(11, 3) = 8

x(0, 4) = 28: y(0, 4) = 2
x(1, 4) = 19: y(1, 4) = 12
x(2, 4) = 15: y(2, 4) = 0
x(3, 4) = 11: y(3, 4) = 12
x(4, 4) = 2: y(4, 4) = 2
x(5, 4) = 1: y(5, 4) = 9
x(6, 4) = 29: y(6, 4) = 9
x(7, 4) = 28: y(7, 4) = 2
x(11, 4) = 7

x(0, 5) = 3: y(0, 5) = 2
x(1, 5) = 12: y(1, 5) = 4
x(2, 5) = 12: y(2, 5) = 7
x(3, 5) = 18: y(3, 5) = 7
x(4, 5) = 18: y(4, 5) = 4
x(5, 5) = 27: y(5, 5) = 2
x(6, 5) = 24: y(6, 5) = 13
x(7, 5) = 15: y(7, 5) = 10
x(8, 5) = 6: y(8, 5) = 13
x(9, 5) = 3: y(9, 5) = 2
x(11, 5) = 9
DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG
CALL niveau(ni, 3, titr$)

SELECT CASE ni
CASE 1
GOSUB cooniveau1
CASE 2
GOSUB cooniveau2
CASE 3
GOSUB cooniveau3
END SELECT
VIEW

'résultats

CALL resultats(re, ni)

EXIT SUB

cooniveau1:
GOSUB coo40 'présentation

FOR jj = 1 TO 5
GOSUB coo50 'quadrillage
erreurs = 0
GOSUB coo6 'tirage

COLOR vertclair: LOCATE 22, 77: PRINT 6 - jj
x = 0: y = 0
GOSUB coo2
coo13:
GOSUB coo14
CALL centre(22, jaune, "Trouve les coordonnées correspondant au couple (" + LTRIM$(STR$(colonne)) + "," + CHR$(ligne + 65) + ")")
GOSUB coo0

LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)

IF (colonne = x / 16) AND (ligne = y / 14) THEN
CALL exact(1.2): IF souris <> 2 THEN GOSUB coo2
IF erreurs = 0 THEN re = re + 2
ELSE
erreurs = erreurs + 1
IF erreurs > 2 THEN
GOSUB coo2
x2 = x: y2 = y
x = colonne * 16: y = ligne * 14
CALL centre(23, rougeclair, "Regarde la bonne réponse : (" + LTRIM$(STR$(colonne)) + "," + CHR$(ligne + 65) + ")")
GOSUB coo2
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
GOSUB coo2
x = x2: y = y2: GOSUB coo2: GOTO coo13
ELSE
CALL erreur(.8)
CALL centre(23, rougeclair, "Tu as choisi le couple (" + LTRIM$(STR$(x / 16)) + "," + CHR$(y / 14 + 65) + ")")
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
GOTO coo13
END IF
END IF

NEXT jj
RETURN '+++++++++++++++

cooniveau2:
GOSUB coo40
GOSUB coo50
FOR jj = 1 TO 5
erreurs = 0
GOSUB coo6 'tirage
x = colonne * 16: y = ligne * 14
GOSUB coo2
DEF SEG = 0
POKE &H417, (PEEK(&H417) OR &h30)'numérique
POKE &H417, (PEEK(&H417) OR &H40) 'MAJ
DEF SEG
coo20:
LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)
COLOR vertclair: LOCATE 22, 77: PRINT 6 - jj: COLOR blancbrill
CALL centre(23, blanc, "Tape la réponse")
LOCATE 22, 20
COLOR jaune
PRINT "Colonne : "; : COLOR blancbrill
CALL inputgen(2, r$, 48, 57)
xx = VAL(r$)
IF xx = colonne THEN
CALL exact(.7)
IF erreurs = 0 THEN re = re + 1
ELSE
erreurs = erreurs + 1
IF erreurs > 2 THEN
LOCATE 23, 1: PRINT SPACE$(80)
CALL centre(23, rougeclair, "Solution :" + STR$(colonne))
CALL attendre(2)
GOTO coo20
ELSE
CALL erreur(.7): GOTO coo20
END IF
END IF
erreurs = 0
coo21:
LOCATE 23: PRINT SPACE$(80)
COLOR vertclair: LOCATE 22, 77: PRINT 6 - jj: COLOR blancbrill
CALL centre(23, blanc, "Tape la réponse")
LOCATE 22, 58: PRINT " "; : LOCATE , 50
COLOR jaune: PRINT "Ligne : "; : COLOR blancbrill
CALL inputgen(1, r$, 65, 122)
r$ = UCASE$(r$)
IF r$ = CHR$(ligne + 65) THEN
CALL exact(.7): GOSUB coo2
IF erreurs = 0 THEN re = re + 1
ELSE
erreurs = erreurs + 1
IF erreurs > 2 THEN
LOCATE 23, 1: PRINT SPACE$(80)
CALL centre(23, rougeclair, "Solution : " + CHR$(ligne + 65))
CALL attendre(2)
GOTO coo21
ELSE
CALL erreur(.7)
GOTO coo21
END IF
END IF
NEXT jj
VIEW
RETURN '++++++++++++++++++++++++

cooniveau3:
GOSUB coo40 'présentation

FOR boucle = 1 TO 3
GOSUB coo50 'quadrillage

DO
f = 0
z(boucle) = INT(RND * 5) + 1
FOR j = 1 TO boucle - 1
IF z(boucle) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
tabl = z(boucle)
colonne = x(0, tabl): ligne = y(0, tabl)
x = colonne * 16: y = ligne * 14
xx(0) = colonne * 16: yy(0) = ligne * 14
GOSUB coo2: GOSUB coo31

erreurs = 0
h = 14
FOR jj = 1 TO x(11, tabl)
COLOR vertclair: LOCATE 22, 77: PRINT (x(11, tabl) + 1) - jj
colonne = x(jj, tabl): ligne = y(jj, tabl)

GOSUB coo14
LOCATE 22: COLOR blancbrill
PRINT "Coordonnées :"
cc = jaune: f = 0: GOSUB coo22: f = 1

coo51:
GOSUB coo0
IF xx(jj - 1) = x AND yy(jj - 1) = y THEN BEEP: GOTO coo51

xx(jj) = x: yy(jj) = y
IF (colonne = x / 16) AND (ligne = y / 14) THEN
cc = vertclair: GOSUB coo22
ELSE
erreurs = erreurs + 1
cc = rougeclair: GOSUB coo22
END IF
GOSUB coo2
LINE (xx(jj), yy(jj))-(xx(jj - 1), yy(jj - 1)), blancbrill
GOSUB coo31: GOSUB coo2
IF tabl = 1 THEN h = h + 6 ELSE h = h + 7
NEXT jj
GOSUB coo2

IF erreurs <> 0 THEN
LOCATE 23: PRINT SPACE$(80)
PSET (x(0, tabl) * 16, y(0, tabl) * 14)
FOR i = 1 TO x(11, tabl)
x = x(i, tabl) * 16: y = y(i, tabl) * 14
LINE -(x, y), rougeclair
IF couleur = 0 THEN GOSUB coo31
NEXT
er$ = " erreur": IF erreurs > 1 THEN er$ = er$ + "s"
CALL centre(23, rougeclair, "Tu as fait" + STR$(erreurs) + er$)
CALL attendre(2)
ELSE
CALL exact(1)
END IF
CALL entree
IF erreurs > 3 THEN erreurs = 3
er = er + erreurs
NEXT boucle
re = 10 - er: IF re < 0 THEN re = 0
RETURN '++++++++++

coo2:
PUT (x - 6, y - 6), cercle, XOR
RETURN

coo31:
CIRCLE (x, y), 3, jaune, , , coef2!
RETURN

coo6: 'tirage
DO
f = 0
z(jj) = INT(RND * 30) + 1 'tirage colonne
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
colonne = z(jj)

DO
f = 0
z2(jj) = INT(RND * 14) 'tirage ligne
FOR j = 1 TO jj - 1
IF z2(jj) = z2(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
ligne = z2(jj)
RETURN

coo14:
CALL centre(23, blanc, CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + " = déplacer " + rt$ + " = valider")
RETURN

coo0:
DO
coo11:
MouseBorder 50, 55, 320, 575
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'matrice 14 x 8 = transforme en coord écran
v_mouse = INT(v_mouse / 14) + 1
h_mouse = INT(h_mouse / 8) + 1
'LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF (v_mouse >= 6 AND v_mouse <= 19) AND (h_mouse >= 11 AND h_mouse <= 71) THEN
hh = 11: f1 = 0
FOR i = 1 TO 31
IF h_mouse = hh THEN
h_coord = hh: f1 = 1: EXIT FOR
END IF
hh = hh + 2
NEXT
IF f1 = 1 THEN
vv = 6: f2 = 0
FOR i = 1 TO 14
IF v_mouse = vv THEN
v_coord = vv: f2 = 1: EXIT FOR
END IF
vv = vv + 1
NEXT
END IF
IF f1 = 1 AND f2 = 1 THEN
CALL attendre(.3)
souris = 2
EXIT DO
ELSE
BEEP
END IF
END IF

IF v_mouse = 23 THEN
'fleches
IF h_mouse = 23 THEN
'gauche
valtouche = gauche
CALL attendre(.1)
souris = 1
EXIT DO
ELSEIF h_mouse = 25 THEN
'droite
valtouche = droite
CALL attendre(.1)
souris = 1
EXIT DO
ELSEIF h_mouse = 27 THEN
'haut
valtouche = haut
CALL attendre(.1)
souris = 1
EXIT DO
ELSEIF h_mouse = 29 THEN
'bas
valtouche = bas
CALL attendre(.1)
souris = 1
EXIT DO
ELSEIF h_mouse >= 46 AND h_mouse <= 58 THEN
'return
valtouche = 13
CALL attendre(.3)
souris = 1
EXIT DO
ELSE
BEEP
END IF
ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

MouseHide

IF souris = 2 THEN
GOSUB coo2
y = v_coord * 14: x = h_coord * 8
VIEW
PUT (x - 11, y - 12), cercle, XOR
VIEW (83, 77)-(563 + 6, 259 + 6)
y = v_coord - 6: x = (h_coord - 11) / 2
x = x * 16: y = y * 14 '===
valtouche = 13
END IF

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

IF valtouche = 50 THEN valtouche = bas
IF valtouche = 52 THEN valtouche = gauche
IF valtouche = 54 THEN valtouche = droite
IF valtouche = 56 THEN valtouche = haut

SELECT CASE valtouche
CASE gauche
xx = x - 16: yy = y
GOSUB coo2
IF xx < 0 THEN xx = 480

CASE droite
xx = x + 16: yy = y
GOSUB coo2
IF xx > 480 THEN xx = 0

CASE haut
xx = x: yy = y - 14
GOSUB coo2
IF yy < 0 THEN yy = 182

CASE bas
xx = x: yy = y + 14
GOSUB coo2
IF yy > 182 THEN yy = 0

CASE 27
CALL quitter: GOSUB coo14: GOTO coo11

CASE 13
EXIT DO

CASE ELSE
BEEP

END SELECT

IF valtouche = gauche OR valtouche = droite OR valtouche = haut OR valtouche = bas THEN
x = xx: y = yy
GOSUB coo2
END IF

LOOP

RETURN

coo40:
IF ni = 1 THEN
w$ = "Un couple de coordonnées (colonne,ligne) va être affiché."
z$ = "Avec les flèches " + CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + ", tu vas devoir placer correctement"
xx$ = "un repère sur le quadrillage."
CALL consigne(3, w$, z$, xx$)
ELSEIF ni = 2 THEN
w$ = "Un repère s'affichera à l'intersection d'une colonne et d'une ligne."
z$ = "Tu taperas le nombre et la lettre correspondant à ces coordonnées."
CALL consigne(2, w$, z$, xx$)
ELSE
w$ = "Une suite de coordonnées (colonne,ligne) va être affichée."
z$ = "Avec les flèches " + CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + ", tu placereras correctement un repère"
xx$ = "sur le quadrillage. L'ordinateur tracera alors la ligne."
CALL consigne(3, w$, z$, xx$)
END IF
RETURN

coo50:
SCREEN 9 ', , 1, 0 ===
VIEW: CLS
x = 320: y = 170
CIRCLE (x, y), 6, cyanclair, , , coef2!
CIRCLE (x, y), 5, cyanclair, , , coef2!
GET (x - 6, y - 6)-(x + 6, y + 6), cercle

CALL titre2(titr$)
LINE (56, 38)-(575, 266), noir, BF
COLOR blancbrill
LOCATE 4, 8: PRINT SPACE$(23);
FOR i = 1 TO 10: PRINT "1 "; : NEXT
FOR i = 1 TO 10: PRINT "2 "; : NEXT
PRINT "3 "
LOCATE 5, 8: PRINT " "
LOCATE 5, 10: FOR i = 1 TO 3
FOR j = 0 TO 9: PRINT RTRIM$(STR$(j)); : NEXT j
NEXT i
PRINT " 0"
LOCATE 6
FOR i = 0 TO 13
LOCATE , 8: PRINT " "; CHR$(65 + i); " "
NEXT
COLOR vertclair
'LINE (83, 77)-(563, 259), , B
VIEW (78, 77)-(563, 259)
FOR y = 0 TO 182 STEP 14
LINE (0, y)-(484, y), vertclair, , &H8888
NEXT
VIEW (83, 72)-(563, 259)
FOR x = 0 TO 480 STEP 16
LINE (x, 0)-(x, 187), vertclair, , &H8888
NEXT
VIEW (83, 77)-(563 + 6, 259 + 6)
'SCREEN 9, , 1, 1
RETURN

coo22:
IF f = 0 THEN COLOR blancbrill ELSE COLOR noir
LOCATE 22, h: PRINT "(";
COLOR cc
PRINT LTRIM$(STR$(colonne)); ","; CHR$(ligne + 65);
IF f = 0 THEN COLOR blancbrill ELSE COLOR noir
PRINT ")"
RETURN

END SUB

DEFINT A-Z
SUB frise1 (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
'pour niveau 1 et 2
'3/12/96 souris

DIM dessin$(10), solution$(10), x(10), y(10), x2(10), z(5), lo(10)
DIM cercle(1 TO 50) AS INTEGER

CONST gauche = 75, droite = 77
CONST haut = 72, bas = 80, hautgauche = 71, hautdroite = 73, basgauche = 79, basdroite = 81

DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG

dessin$(1) = "r25 u25 l25 u25 r25 u75 r25 u25 r25 d50 l25 d25 r25 d25 l25 d25 r25 d25 r25"
solution$(1) = "dhghdhhhdhdbbgbdbgbdbd"
x(1) = 50: y(1) = 175: x2(1) = 250: lo(1) = 100
dessin$(2) = "r25 d75 l25 d25 r50 u50 r25 u25 l25 u50 l25 u50 r25 d25 r25 d50 r25"
solution$(2) = "dbbbgbddhhdhghhghhdbdbbd"
x(2) = 50: y(2) = 75: x2(2) = 250: lo(2) = 100
dessin$(3) = "r25 d50 l25 d50 r25 d50 l25 d25 r25 d25 r25 u25 r25 u25 l25 u25 r25 u75 l25 u25 r25 u25 r25"
solution$(3) = "dbbgbbdbbgbdbdhdhghdhhhghdhd"
x(3) = 50: y(3) = 0: x2(3) = 250: lo(3) = 100
dessin$(4) = "r25 d75 r50 u50 l25 u50 l50 u50 r25 u25 r25 u25 r25 d50 l25 d25 r25 d50 r25"
solution$(4) = "dbbbddhhghhgghhdhdhdbbgbdbbd"
x(4) = 50: y(4) = 125: x2(4) = 250: lo(4) = 100
dessin$(5) = "r25 u25 r25 d50 l25 d50 l25 d25 r25 d75 r25 u50 r25 u25 l25 u50 r25 u50 r25"
solution$(5) = "dhdbbgbbgbdbbbdhhdhghhdhhd"
x(5) = 50: y(5) = 25: x2(5) = 250: lo(5) = 100

'niveau 2
dessin$(6) = "r50 d25 m-25,+25 d50 r25 u25 m+25,-25 r25 u50"
solution$(6) = "ddbmbbdhkdhh"
x(6) = 50: y(6) = 75: x2(6) = 250: lo(6) = 100
dessin$(7) = "d50 m+25,+25 d25 r25 u50 m+25,-25 u25 r25"
solution$(7) = "bblbdhhkhd"
x(7) = 50: y(7) = 50: x2(7) = 250: lo(7) = 100
dessin$(8) = "m+25,-25 m-25,-25 u25 r25 m+25,-25 d50 r25 d75 m+25,-25"
solution$(8) = "kjhdkbbdbbbk"
x(8) = 50: y(8) = 150: x2(8) = 250: lo(8) = 100
dessin$(9) = "m+25,+25 d25 m+25,+25 u50 m-25,-25 m+25,-25 u25 m+50,+50"
solution$(9) = "lblhhjkhll"
x(9) = 50: y(9) = 100: x2(9) = 250: lo(9) = 100
dessin$(10) = "m+25,-25 m-25,-25 u25 m+50,-50 r25 d25 m-25,+25 m+25,+25 d25 m+25,+25"
solution$(10) = "kjhkkdbmlbl"
x(10) = 50: y(10) = 175: x2(10) = 250: lo(10) = 100

IF ni = 1 THEN nombre = 0 ELSE nombre = 5
re = 0

GOSUB fris40 'présentation

SCREEN 9
x = 635: y = 35
CIRCLE (x, y), 4, jaune, , , coef2!
GET (x - 4, y - 4)-(x + 4, y + 4), cercle

FOR jj = 1 TO 3
erreurs = 0
GOSUB fris6 'tirage

fris13:
CALL titre2(titr$)
IF ni = 1 THEN COLOR vertclair: LOCATE 22: PRINT "Niveau"; ni: LOCATE 22, 77: PRINT 4 - jj
x = x(choix) + 20: y = y(choix) + 55
FOR i = 1 TO 5
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
IF i = 3 THEN cc = bleu ELSE cc = cyanclair
IF i = 3 AND erreurs > 2 AND couleur = 1 THEN cc = rougeclair
DRAW "c=" + VARPTR$(cc) + dessin$(choix)
x = x + lo(choix)
NEXT

'fenetre
VIEW (20, 55)-(630, 260)
GOSUB fris1

IF ni = 1 OR erreurs > 0 THEN
flag2 = 1
LINE (50, 0)-(550, 200), blancbrill, B, &H8888
LINE (150, 0)-(150, 200), blancbrill, , &H8888
LINE (250, 0)-(350, 200), blancbrill, B, &H8888
LINE (450, 0)-(450, 200), blancbrill, , &H8888
END IF

x = x2(choix): y = y(choix)
GOSUB fris2

GOSUB fris14
flag = 0: reponse$ = ""

GOSUB frisprog

VIEW

LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)

IF solution$(choix) = reponse$ THEN
CALL exact(1)
IF erreurs = 0 THEN re = re + 3
ELSE
erreurs = erreurs + 1
IF erreurs > 1 THEN
CALL centre(23, rougeclair, "Regarde...")
x = x(choix) + 20 + (2 * lo(choix)): y = y(choix) + 55
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(rougeclair) + dessin$(choix)
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
ELSE
CALL erreur(1)
END IF
LOCATE 23: PRINT SPACE$(80)
GOTO fris13
END IF

NEXT jj

'résultats
SCREEN 0
re = re + 1
CALL resultats(re, ni)

EXIT SUB

'++++++++++++++++++++++++

fris1:
FOR x = 50 TO 550 STEP 25
FOR y = 0 TO 200 STEP 25
PSET (x, y), rougeclair
NEXT y
NEXT x
RETURN

fris14:
IF ni = 1 THEN
CALL centre(23, blanc, CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + " = tracer <-- = corriger " + rt$ + " = valider")
ELSE
COLOR blanc
LOCATE 23, 23: PRINT "= tracer <-- = corriger " + rt$ + " = valider"
LOCATE 21, 10: PRINT "[7] [8] [9]"
LOCATE 22, 10: PRINT "[4] [6]"
LOCATE 23, 10: PRINT "[1] [2] [3]"
END IF
RETURN

fris2:
PUT (x - 4, y - 4), cercle, XOR
IF ni = 1 OR erreurs > 0 THEN PSET (x, y), rougeclair
RETURN

fris5:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB fris2
IF r$ = "g" THEN
xx = x + 25: yy = y
ELSEIF r$ = "d" THEN
xx = x - 25: yy = y
ELSEIF r$ = "h" THEN
xx = x: yy = yy + 25
ELSEIF r$ = "b" THEN
xx = x: yy = yy - 25
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

fris6:
'tirage
DO
f = 0
z(jj) = INT(RND * 5) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj) + nombre
RETURN

frisprog:
DO
fris31:
IF ni = 1 THEN
MouseBorder 308, 10, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF v_mouse >= 308 AND v_mouse <= 320 THEN
'fleches
IF h_mouse >= 100 AND h_mouse <= 112 THEN
'gauche
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 116 AND h_mouse <= 128 THEN
'droite
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 133 AND h_mouse <= 145 THEN
'haut
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 150 AND h_mouse <= 160 THEN
'bas
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 270 AND h_mouse <= 380 THEN
'del
valtouche = 8
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 420 AND h_mouse <= 528 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

ELSEIF ni = 2 THEN
MouseBorder 282, 75, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 40: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = hautgauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 106 AND h_mouse <= 126) THEN
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = hautdroite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 296 AND v_mouse <= 306) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 296 AND v_mouse <= 306) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = basgauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 106 AND h_mouse <= 126) THEN
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = basdroite
CALL attendre(.2)
souris = 1
EXIT DO
END IF
'ok
IF v_mouse >= 308 AND v_mouse <= 320 THEN
IF h_mouse >= 280 AND h_mouse <= 390 THEN
'del
valtouche = 8
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 440 AND h_mouse <= 540 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
END IF
END IF

LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

END IF

IF (valtouche = 8 OR valtouche = 83) AND flag = 0 THEN BEEP: GOTO fris31

SELECT CASE ni
CASE 1
IF valtouche = 50 THEN valtouche = bas
IF valtouche = 52 THEN valtouche = gauche
IF valtouche = 54 THEN valtouche = droite
IF valtouche = 56 THEN valtouche = haut
CASE 2
IF valtouche = 49 OR valtouche = 38 THEN valtouche = basgauche
IF valtouche = 50 OR valtouche = 130 THEN valtouche = bas
IF valtouche = 51 OR valtouche = 34 THEN valtouche = basdroite
IF valtouche = 52 OR valtouche = 39 THEN valtouche = gauche
IF valtouche = 54 OR valtouche = 45 THEN valtouche = droite
IF valtouche = 55 OR valtouche = 138 THEN valtouche = hautgauche
IF valtouche = 56 OR valtouche = 95 THEN valtouche = haut
IF valtouche = 57 OR valtouche = 135 THEN valtouche = hautdroite
END SELECT

SELECT CASE valtouche

CASE gauche
IF flag2 = 1 THEN LINE (250, 0)-(350, 200), blancbrill, B, &H8888
IF RIGHT$(reponse$, 1) = "d" THEN GOSUB fris5: GOTO fris32
xx = x - 25: yy = y
GOSUB fris2
IF xx < 250 THEN
xx = 250: BEEP
ELSE
reponse$ = reponse$ + "g"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE droite
IF flag2 = 1 THEN LINE (250, 0)-(350, 200), blancbrill, B, &H8888
IF RIGHT$(reponse$, 1) = "g" THEN GOSUB fris5: GOTO fris32
xx = x + 25: yy = y
GOSUB fris2
IF xx > 350 THEN
xx = 350: BEEP
ELSE
reponse$ = reponse$ + "d"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE haut
IF flag2 = 1 THEN LINE (250, 0)-(350, 200), blancbrill, B, &H8888
IF RIGHT$(reponse$, 1) = "b" THEN GOSUB fris5: GOTO fris32
xx = x: yy = y - 25
GOSUB fris2
IF yy < 0 THEN
yy = 0: BEEP
ELSE
reponse$ = reponse$ + "h"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE bas
IF flag2 = 1 THEN LINE (250, 0)-(350, 200), blancbrill, B, &H8888
IF RIGHT$(reponse$, 1) = "h" THEN GOSUB fris5: GOTO fris32
xx = x: yy = y + 25
GOSUB fris2
IF yy > 200 THEN
yy = 200: BEEP
ELSE
reponse$ = reponse$ + "b"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE hautgauche
IF RIGHT$(reponse$, 1) = "l" THEN GOSUB fris35: GOTO fris32
xx = x - 25: yy = y - 25
GOSUB fris2
IF yy < 0 OR xx < 250 THEN
IF yy < 0 THEN
yy = 0: xx = xx + 25: BEEP
ELSEIF xx < 250 THEN
xx = 250: yy = yy + 25: BEEP
END IF
ELSE
reponse$ = reponse$ + "j"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE hautdroite
IF RIGHT$(reponse$, 1) = "m" THEN GOSUB fris35: GOTO fris32
xx = x + 25: yy = y - 25
GOSUB fris2
IF yy < 0 OR xx > 350 THEN
IF yy < 0 THEN
yy = 0: xx = xx - 25: BEEP
ELSEIF xx > 350 THEN
xx = 350: yy = yy + 25: BEEP
END IF
ELSE
reponse$ = reponse$ + "k"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE basgauche
IF RIGHT$(reponse$, 1) = "k" THEN GOSUB fris35: GOTO fris32
xx = x - 25: yy = y + 25
GOSUB fris2
IF yy > 200 OR xx < 250 THEN
IF yy > 200 THEN
yy = 200: xx = xx + 25: BEEP
ELSEIF xx < 250 THEN
xx = 250: yy = yy - 25: BEEP
END IF
ELSE
reponse$ = reponse$ + "m"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE basdroite
IF RIGHT$(reponse$, 1) = "j" THEN GOSUB fris35: GOTO fris32
xx = x + 25: yy = y + 25
GOSUB fris2
IF yy > 200 OR xx > 350 THEN
IF yy > 200 THEN
yy = 200: xx = xx - 25: BEEP
ELSEIF xx > 350 THEN
xx = 350: yy = yy - 25: BEEP
END IF
ELSE
reponse$ = reponse$ + "l"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE 8, 83 'correction
r$ = RIGHT$(reponse$, 1)
IF r$ = "h" OR r$ = "b" OR r$ = "g" OR r$ = "d" THEN
GOSUB fris5
ELSE
GOSUB fris35
END IF
IF flag2 = 1 THEN LINE (250, 0)-(350, 200), blancbrill, B, &H8888

CASE 27
CALL quitter: GOSUB fris14: GOTO fris31
CASE 13
IF reponse$ = "" THEN GOTO fris31
EXIT DO
CASE ELSE
BEEP

END SELECT

fris32:
IF valtouche = 71 OR valtouche = 73 OR valtouche = 79 OR valtouche = 81 OR valtouche = 8 OR valtouche = 83 OR valtouche = gauche OR valtouche = droite OR valtouche = haut OR valtouche = bas THEN
IF ni = 1 OR erreurs > 0 THEN PSET (x, y), rougeclair
x = xx: y = yy
GOSUB fris2
END IF

LOOP

RETURN

fris35:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB fris2
IF r$ = "j" THEN
xx = x + 25: yy = y + 25
ELSEIF r$ = "k" THEN
xx = x - 25: yy = y + 25
ELSEIF r$ = "m" THEN
xx = x + 25: yy = yy - 25
ELSEIF r$ = "l" THEN
xx = x - 25: yy = yy - 25
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

fris40:
IF ni = 1 THEN
w$ = "Avec les flèches " + CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + ", tu vas compléter une frise."
z$ = "Tu peux corriger tes erreurs avec la touche " + CHR$(27) + "- ou la touche suppr."
CALL consigne(2, w$, z$, xx$)

ELSE
z$ = "compléter une frise."
CALL claviernumerique(z$)
END IF

RETURN


END SUB

DEFINT A-Z
SUB reproduction (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
DIM dessin$(15), solution$(15), x(15), y(15), x2(15), y2(15), z(5)
DIM cercle(1 TO 50) AS INTEGER
'3/12/96 souris
'pour niveau 2 à 4

CONST gauche = 75, droite = 77
CONST haut = 72, bas = 80, hautgauche = 71, hautdroite = 73, basgauche = 79, basdroite = 81

re = 0

'niveau 2
dessin$(1) = "u25 l50 u50 r125 d50 l25 d25 r75 d50 l50 d25 r25 d25 l150 u50 r25"
solution$(1) = "hgghhdddddbbgbdddbbggbdbgggggghhd"
x(1) = 100: y(1) = 100: x2(1) = 0: y2(1) = 0
dessin$(2) = "l50 u75 r75 u50 l100 u50 l75 d25 l25 d25 r25 d25 r25 d25 r25 d25"
solution$(2) = "gghhhdddhhgggghhgggbgbdbdbdb"
x(2) = 225: y(2) = 175: x2(2) = 0: y2(2) = 0
dessin$(3) = "r50 u50 l25 u25 l25 u75 r50 d25 r50 d50 r50 u25 r25 d100 r25"
solution$(3) = "ddhhghghhhddbddbbddhdbbbbd"
x(3) = 50: y(3) = 175: x2(3) = 0: y2(3) = 0
dessin$(4) = "u25 l25 d50 r50 d25 l75 d25 l25 u125 r25 u25 r125 d50 r25 d75"
solution$(4) = "hgbbddbgggbghhhhhdhdddddbbdbbb"
x(4) = 125: y(4) = 100: x2(4) = 0: y2(4) = 0
dessin$(5) = "u25 l50 u25 r25 u25 l75 u50 r50 u25 r25 u25 r50 d25 r25 u25 r25 d25 r25 d25 l25 d25 r25 d25 l25 d50 l25 d25"
solution$(5) = "hgghdhggghhddhdhddbdhdbdbgbdbgbbgb"
x(5) = 150: y(5) = 175: x2(5) = 0: y2(5) = 0

'niveau 3 = translation
dessin$(6) = "d25 r50 u25 l25 u25 l25 u75 r25 d25 r25 u50 r50 d75 r25 d50 r25 d25 l50"
solution$(6) = "bddhghghhhdbdhhddbbbdbbdbgg"
x(6) = 25: y(6) = 150: x2(6) = 50: y2(6) = -25
dessin$(7) = "u25 l25 u75 l25 d50 l25 u25 l50 d25 r25 d75 l25 u25 l25 d25 l25 d25 r125 u25"
solution$(7) = "hghhhgbbghggbdbbbghgbgbdddddh"
x(7) = 250: y(7) = 150: x2(7) = -75: y2(7) = -50
dessin$(8) = "d25 r25 d25 l50 d50 r25 u25 r25 d50 l50 d25 r100 u25 l25 u25 r25 u25 l25 u25 r50 d25 r25 u50"
solution$(8) = "bdbggbbdhdbbggbddddhghdhghddbdhh"
x(8) = 50: y(8) = 0: x2(8) = 50: y2(8) = 50
dessin$(9) = "l100 u50 r75 u25 r25 d25 r25 u25 r25 u25 l25 u25 l25 d25 l25 u25 l75 d50 l25 d75"
solution$(9) = "gggghhdddhdbdhdhghgbghgggbbgbbb"
x(9) = 150: y(9) = 150: x2(9) = 25: y2(9) = 25
dessin$(10) = "l25 d25 r25 d25 l50 u25 l25 u25 l25 d50 r25 d50 r25 u25 r25 d50 l25 d25 l25 u25 l50 u25 l50 u25 r25 u50"
solution$(10) = "gbdbgghghgbbdbbdhdbbgbghgghgghdhh"
x(10) = 250: y(10) = 25: x2(10) = -50: y2(10) = 25

'niveau 4 angle 45
dessin$(11) = "u25 m+25,-25 u50 m+25,-25 r25 m+25,+25 m+25,+25 d25 m-25,-25 d50 r25 d25 l50 d25 r75 m+25,-25 u50 m+25,-25"
solution$(11) = "hkhhkdllbjbbdbggbdddkhhk"
x(11) = 25: y(11) = 150: x2(11) = 0: y2(11) = 0
dessin$(12) = "m+25,+25 d50 m+25,-25 m+25,+25 m-25,+25 m+25,+25 m+50,-50 m-25,-25 r25 u25 m+25,+25 m+25,-25 d25 r25 m-25,+25 d25 l25 d25"
solution$(12) = "lbbklmlkkjdhlkbdmbgb"
x(12) = 25: y(12) = 25: x2(12) = 0: y2(12) = 0
dessin$(13) = "m-25,+25 m-25,-25 m-25,+25 m-25,-25 m-25,+25 d25 m+25,+25 m+25,-25 m+25,+25 m+25,-25 m+25,+25 d25 m-25,+25 l50 m-25,-25 l25 d25 l75 m+50,-50 m-50,-50"
solution$(13) = "mjmjmblklklbmggjgbgggkkjj"
x(13) = 250: y(13) = 25: x2(13) = -25: y2(13) = 25
dessin$(14) = "l25 u25 m+25,-25 m-50,-50 m-25,+25 m+25,+25 m-25,+25 m-50,-50 m-25,+25 m+25,+25 d25 m-50,-50 m+25,-25 m-25,-25 m-25,+25 d50 m-25,+25"
solution$(14) = "ghkjjmlmjjmlbjjkjmbbm"
x(14) = 250: y(14) = 150: x2(14) = 25: y2(14) = -50
dessin$(15) = "m-25,+25 d25 m+50,-50 m-25,-25 m-50,+50 m-25,-25 u25 l25 m+50,-50 d25 m+25,-25 d25 m+25,-25 d25 m+25,-25 d25 r25 m+25,+25 u25 m+25,-25 d25 m+25,-25 d25 m+25,+25 m-25,+25 d25 m-25,+25 u25 l25 d25"
solution$(15) = "mbkkjmmjhgkkbkbkbkbdlhkbkblmbmhgb"
x(15) = 125: y(15) = 100: x2(15) = 0: y2(15) = 0
DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG

SELECT CASE ni
CASE 2
nombre = 0
CASE 3
nombre = 5
CASE 4
nombre = 10
END SELECT
GOSUB repro40 'présentation

SCREEN 9
x = 635: y = 35
CIRCLE (x, y), 4, jaune, , , coef2!
GET (x - 4, y - 4)-(x + 4, y + 4), cercle

FOR jj = 1 TO 5
GOSUB repro6 'tirage
erreurs = 0
repro13:
x = x(choix) + 20: y = y(choix) + 55
IF x2(choix) = 0 AND y2(choix) = 0 THEN
titr$ = "Reproduction"
ELSE
titr$ = "Reproduction et translation"
END IF
LOCATE 1: PRINT SPACE$(80)
CALL titre2(titr$)
IF ni < 4 THEN COLOR vertclair: LOCATE 22: PRINT "Niveau"; ni: LOCATE 22, 77: PRINT 6 - jj
LINE (320, 35)-(320, 275), blancbrill
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(jaune) + dessin$(choix)

'fenetre gauche
VIEW (20, 55)-(295, 255)
coul = rougeclair: GOSUB repro1
x = x(choix): y = y(choix)
GOSUB repro2

'fenetre droite
VIEW (345, 55)-(620 + 4, 255 + 4)
coul = vertclair: IF erreurs <> 0 THEN GOSUB repro1
x = x(choix) + x2(choix): y = y(choix) + y2(choix): GOSUB repro2
IF erreurs > 1 AND couleur = 1 THEN
tempx = x(choix) + 20 + 325 + x2(choix): tempy = y(choix) + 55 + y2(choix)
DRAW "TA0 B m=" + VARPTR$(tempx) + ",=" + VARPTR$(tempy)
DRAW "c=" + VARPTR$(rougeclair) + dessin$(choix)
END IF
GOSUB repro14
flag = 0: reponse$ = ""

IF ni = 2 OR ni = 3 THEN
GOSUB reproniveau1
ELSE
GOSUB reproniveau3
END IF

VIEW

LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)

IF solution$(choix) = reponse$ THEN
CALL exact(.7)
IF erreurs = 0 THEN re = re + 2
ELSE
erreurs = erreurs + 1
CALL centre(23, rougeclair, "Les chemins ne sont pas identiques.")
CALL attendre(1.5)
LOCATE 23: PRINT SPACE$(80): CALL centre(23, rougeclair, "Regarde")
x = x(choix) + 20 + 325 + x2(choix): y = y(choix) + 55 + y2(choix)
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(rougeclair) + dessin$(choix)
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
LOCATE 23: PRINT SPACE$(80): GOTO repro13
END IF

NEXT jj

'résultats
CALL resultats(re, ni)

EXIT SUB
'++++++++++++++++++++++++


repro14:
IF ni = 2 OR ni = 3 THEN
CALL centre(23, blanc, CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + " = tracer <-- = corriger " + rt$ + " = valider")
ELSE
COLOR blanc
LOCATE 23, 23: PRINT "= tracer <-- = corriger " + rt$ + " = valider"
LOCATE 21, 10: PRINT "[7] [8] [9]"
LOCATE 22, 10: PRINT "[4] [6]"
LOCATE 23, 10: PRINT "[1] [2] [3]"
END IF

RETURN

repro1:
FOR x = 0 TO 295 STEP 25
FOR y = 0 TO 255 STEP 25
PSET (x, y), coul
NEXT y
NEXT x
RETURN

repro2:
PUT (x - 4, y - 4), cercle, XOR
PSET (x, y), rougeclair
RETURN

repro5:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB repro2
IF r$ = "g" THEN
xx = x + 25: yy = y
ELSEIF r$ = "d" THEN
xx = x - 25: yy = y
ELSEIF r$ = "h" THEN
xx = x: yy = yy + 25
ELSEIF r$ = "b" THEN
xx = x: yy = yy - 25
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

repro6:
'tirage
DO
f = 0
z(jj) = INT(RND * 5) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj) + nombre
RETURN

reproniveau1:
DO
repro11:
MouseBorder 308, 10, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF v_mouse >= 308 AND v_mouse <= 320 THEN
'fleches
IF h_mouse >= 100 AND h_mouse <= 112 THEN
'gauche
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 116 AND h_mouse <= 128 THEN
'droite
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 133 AND h_mouse <= 145 THEN
'haut
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 150 AND h_mouse <= 160 THEN
'bas
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 270 AND h_mouse <= 380 THEN
'del
valtouche = 8
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 420 AND h_mouse <= 528 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

IF (valtouche = 8 OR valtouche = 83) AND flag = 0 THEN BEEP: GOTO repro11
IF valtouche = 50 THEN valtouche = bas
IF valtouche = 52 THEN valtouche = gauche
IF valtouche = 54 THEN valtouche = droite
IF valtouche = 56 THEN valtouche = haut

SELECT CASE valtouche
CASE gauche
IF RIGHT$(reponse$, 1) = "d" THEN GOSUB repro5: GOTO repro12
xx = x - 25: yy = y
GOSUB repro2
IF xx < 0 THEN
xx = 0: BEEP
ELSE
reponse$ = reponse$ + "g"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE droite
IF RIGHT$(reponse$, 1) = "g" THEN GOSUB repro5: GOTO repro12
xx = x + 25: yy = y
GOSUB repro2
IF xx > 275 THEN
xx = 275: BEEP
ELSE
reponse$ = reponse$ + "d"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE haut
IF RIGHT$(reponse$, 1) = "b" THEN GOSUB repro5: GOTO repro12
xx = x: yy = y - 25
GOSUB repro2
IF yy < 0 THEN
yy = 0: BEEP
ELSE
reponse$ = reponse$ + "h"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE bas
IF RIGHT$(reponse$, 1) = "h" THEN GOSUB repro5: GOTO repro12
xx = x: yy = y + 25
GOSUB repro2
IF yy > 200 THEN
yy = 200: BEEP
ELSE
reponse$ = reponse$ + "b"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE 8, 83 'correction
GOSUB repro5

CASE 27
CALL quitter: GOSUB repro14: GOTO repro11
CASE 13
IF reponse$ = "" THEN GOTO repro11
EXIT DO
CASE ELSE
BEEP

END SELECT
repro12:
IF valtouche = 8 OR valtouche = 83 OR valtouche = gauche OR valtouche = droite OR valtouche = haut OR valtouche = bas THEN
PSET (x, y), rougeclair
x = xx: y = yy
GOSUB repro2
END IF

LOOP

RETURN

reproniveau3:
DO
repro31:
MouseBorder 282, 75, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'LOCATE 21, 40: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = hautgauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 106 AND h_mouse <= 126) THEN
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = hautdroite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 296 AND v_mouse <= 306) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 296 AND v_mouse <= 306) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = basgauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 106 AND h_mouse <= 126) THEN
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = basdroite
CALL attendre(.2)
souris = 1
EXIT DO
END IF
'ok
IF v_mouse >= 308 AND v_mouse <= 320 THEN
IF h_mouse >= 280 AND h_mouse <= 390 THEN
'del
valtouche = 8
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 440 AND h_mouse <= 540 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
END IF
END IF

LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

IF (valtouche = 8 OR valtouche = 83) AND flag = 0 THEN BEEP: GOTO repro31
IF valtouche = 49 OR valtouche = 38 THEN valtouche = basgauche
IF valtouche = 50 OR valtouche = 130 THEN valtouche = bas
IF valtouche = 51 OR valtouche = 34 THEN valtouche = basdroite
IF valtouche = 52 OR valtouche = 39 THEN valtouche = gauche
IF valtouche = 54 OR valtouche = 45 THEN valtouche = droite
IF valtouche = 55 OR valtouche = 138 THEN valtouche = hautgauche
IF valtouche = 56 OR valtouche = 95 THEN valtouche = haut
IF valtouche = 57 OR valtouche = 135 THEN valtouche = hautdroite

SELECT CASE valtouche

CASE gauche
IF RIGHT$(reponse$, 1) = "d" THEN GOSUB repro5: GOTO repro32
xx = x - 25: yy = y
GOSUB repro2
IF xx < 0 THEN
xx = 0: BEEP
ELSE
reponse$ = reponse$ + "g"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE droite
IF RIGHT$(reponse$, 1) = "g" THEN GOSUB repro5: GOTO repro32
xx = x + 25: yy = y
GOSUB repro2
IF xx > 275 THEN
xx = 275: BEEP
ELSE
reponse$ = reponse$ + "d"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE haut
IF RIGHT$(reponse$, 1) = "b" THEN GOSUB repro5: GOTO repro32
xx = x: yy = y - 25
GOSUB repro2
IF yy < 0 THEN
yy = 0: BEEP
ELSE
reponse$ = reponse$ + "h"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE bas
IF RIGHT$(reponse$, 1) = "h" THEN GOSUB repro5: GOTO repro32
xx = x: yy = y + 25
GOSUB repro2
IF yy > 200 THEN
yy = 200: BEEP
ELSE
reponse$ = reponse$ + "b"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE hautgauche
IF RIGHT$(reponse$, 1) = "l" THEN GOSUB repro35: GOTO repro32
xx = x - 25: yy = y - 25
GOSUB repro2
IF yy < 0 OR xx < 0 THEN
IF yy < 0 THEN
yy = 0: xx = xx + 25: BEEP
ELSEIF xx < 0 THEN
xx = 0: yy = yy + 25: BEEP
END IF
ELSE
reponse$ = reponse$ + "j"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE hautdroite
IF RIGHT$(reponse$, 1) = "m" THEN GOSUB repro35: GOTO repro32
xx = x + 25: yy = y - 25
GOSUB repro2
IF yy < 0 OR xx > 275 THEN
IF yy < 0 THEN
yy = 0: xx = xx - 25: BEEP
ELSEIF xx > 275 THEN
xx = 275: yy = yy + 25: BEEP
END IF
ELSE
reponse$ = reponse$ + "k"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE basgauche
IF RIGHT$(reponse$, 1) = "k" THEN GOSUB repro35: GOTO repro32
xx = x - 25: yy = y + 25
GOSUB repro2
IF yy > 200 OR xx < 0 THEN
IF yy > 200 THEN
yy = 200: xx = xx + 25: BEEP
ELSEIF xx < 0 THEN
xx = 0: yy = yy - 25: BEEP
END IF
ELSE
reponse$ = reponse$ + "m"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE basdroite
IF RIGHT$(reponse$, 1) = "j" THEN GOSUB repro35: GOTO repro32
xx = x + 25: yy = y + 25
GOSUB repro2
IF yy > 200 OR xx > 275 THEN
IF yy > 200 THEN
yy = 200: xx = xx - 25: BEEP
ELSEIF xx > 275 THEN
xx = 275: yy = yy - 25: BEEP
END IF
ELSE
reponse$ = reponse$ + "l"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE 8, 83 'correction
r$ = RIGHT$(reponse$, 1)
IF r$ = "h" OR r$ = "b" OR r$ = "g" OR r$ = "d" THEN
GOSUB repro5
ELSE
GOSUB repro35
END IF

CASE 27
CALL quitter: GOSUB repro14: GOTO repro31
CASE 13
IF reponse$ = "" THEN GOTO repro31
EXIT DO
CASE ELSE
BEEP

END SELECT

repro32:
IF valtouche = 71 OR valtouche = 73 OR valtouche = 79 OR valtouche = 81 OR valtouche = 8 OR valtouche = 83 OR valtouche = gauche OR valtouche = droite OR valtouche = haut OR valtouche = bas THEN
PSET (x, y), rougeclair
x = xx: y = yy
GOSUB repro2
END IF

LOOP

RETURN

repro35:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB repro2
IF r$ = "j" THEN
xx = x + 25: yy = y + 25
ELSEIF r$ = "k" THEN
xx = x - 25: yy = y + 25
ELSEIF r$ = "m" THEN
xx = x + 25: yy = yy - 25
ELSEIF r$ = "l" THEN
xx = x - 25: yy = yy - 25
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

repro40:

IF ni = 2 THEN
w$ = "Avec les flèches " + CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + ", tu vas devoir reproduire un chemin."
z$ = "Tu peux corriger tes erreurs avec la touche " + CHR$(27) + "- ou la touche suppr."
CALL consigne(2, w$, z$, xx$)
ELSEIF ni = 3 THEN
w$ = "Avec les flèches " + CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + ", tu vas devoir reproduire un chemin."
z$ = "Le point de départ va subir une translation (un glissement)."
xx$ = "Tu peux corriger tes erreurs avec la touche " + CHR$(27) + "- ou la touche suppr."
CALL consigne(3, w$, z$, xx$)

ELSE
z$ = "reproduire un chemin."
CALL claviernumerique(z$)
END IF

RETURN

END SUB

DEFINT A-Z
SUB reproduction1 (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
'3/12/96 pour niveau 1 _ souris
DIM dessin$(5), solut$(5), x(5), y(5), z(5)
DIM cercle(1 TO 50) AS INTEGER

CONST gauche = 75, droite = 77, haut = 72, bas = 80

re = 0

'niveau 1 6/3/94
dessin$(1) = "r100 u50 l50 u50 l100 d50 l50 u50 l50 d50 l50 d50 r50 d50 r50 d50 r150 u50 l50"
solut$(1) = "ddhghggbghgbgbdbdbdddhg"
x(1) = 200: y(1) = 100
dessin$(2) = "u50 r50 u50 r100 d100 r50 d100 l50 u50 l50 u50 l50 d50 l50 d50 l50 u50 l50 u150 r50 d100"
solut$(2) = "hdhddbbdbbghghgbgbghghhhdbb"
x(2) = 100: y(2) = 100
dessin$(3) = "l50 u150 r100 d50 l50 d50 r50 d100 r50 u100 r50 u100 r100 d50 l50 d150 r50 u100"
solut$(3) = "ghhhddbgbdbbdhhdhhddbgbbbdhh"
x(3) = 50: y(3) = 150
dessin$(4) = "r50 u100 l50 u50 l100 d50 r50 d50 l150 u50 l50 d150 r50 u50 r100 d50 r50"
solut$(4) = "dhhghggbdbggghgbbbdhddbd"
x(4) = 250: y(4) = 150
dessin$(5) = "u50 r50 d50 r50 u50 r50 d50 r100 u50 r50 d100 l50 d50 r50 d50 l150 u100 l50 d50 l50 u50 l50 d100 r50"
solut$(5) = "hdbdhdbddhdbbgbdbggghhgbghgbbd"
x(5) = 0: y(5) = 50

GOSUB reprodu40 'présentation

SCREEN 9
x = 635: y = 35
CIRCLE (x, y), 4, jaune, , , coef2!
GET (x - 4, y - 4)-(x + 4, y + 4), cercle

'++++++++++++++++++++++++++++++++++++++++++++++++
FOR jj = 1 TO 3

DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG

GOSUB reprodu6
erreurs = 0
reprodu13:
x = x(choix) + 10: y = y(choix) + 55

titr$ = "Reproduction"

LOCATE 1: PRINT SPACE$(80)
CALL titre2(titr$)
COLOR vertclair: LOCATE 22: PRINT "Niveau"; ni
LOCATE 22, 77: PRINT 4 - jj
LINE (320, 35)-(320, 275), blancbrill
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(jaune) + dessin$(choix)

'fenetre gauche
VIEW (10, 55)-(310, 255)
coul = rougeclair: GOSUB reprodu1
x = x(choix): y = y(choix)
GOSUB reprodu2

'fenetre droite
VIEW (330, 55)-(630 + 4, 255 + 4)
coul = vertclair: IF erreurs <> 0 THEN GOSUB reprodu1
x = x(choix): y = y(choix): GOSUB reprodu2
IF erreurs > 1 AND couleur = 1 THEN
tempx = x(choix) + 20 + 310: tempy = y(choix) + 55
DRAW "TA0 B m=" + VARPTR$(tempx) + ",=" + VARPTR$(tempy)
DRAW "c=" + VARPTR$(rougeclair) + dessin$(choix)
END IF

GOSUB reprodu14
flag = 0: reponse$ = ""

GOSUB reproduniveau1

VIEW

LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)

IF solut$(choix) = reponse$ THEN
CALL exact(1)
IF erreurs = 0 THEN re = re + 3
ELSE
erreurs = erreurs + 1
CALL centre(23, rougeclair, "Les chemins ne sont pas identiques.")
CALL attendre(1.5)
LOCATE 23: PRINT SPACE$(80): CALL centre(23, rougeclair, "Regarde")
x = x(choix) + 20 + 310: y = y(choix) + 55
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(rougeclair) + dessin$(choix)
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
LOCATE 23: PRINT SPACE$(80): GOTO reprodu13
END IF

NEXT jj
'++++++++++++++++++++++++++++++++++++++

'résultats
SCREEN 0
re = re + 1
CALL resultats(re, ni)

EXIT SUB
'++++++++++++++++++++++++


reprodu14:
CALL centre(23, blanc, CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + " = tracer <-- = corriger " + rt$ + " = valider")
RETURN

reprodu1:
FOR x = 0 TO 300 STEP 50
FOR y = 0 TO 200 STEP 50
PSET (x, y), coul
NEXT y
NEXT x
RETURN

reprodu2:
PUT (x - 4, y - 4), cercle, XOR
PSET (x, y), rougeclair
RETURN

reprodu5:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB reprodu2
IF r$ = "g" THEN
xx = x + 25: yy = y
ELSEIF r$ = "d" THEN
xx = x - 25: yy = y
ELSEIF r$ = "h" THEN
xx = x: yy = yy + 25
ELSEIF r$ = "b" THEN
xx = x: yy = yy - 25
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

reprodu5bis:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB reprodu2
IF r$ = "g" THEN
xx = x + 50: yy = y
ELSEIF r$ = "d" THEN
xx = x - 50: yy = y
ELSEIF r$ = "h" THEN
xx = x: yy = yy + 50
ELSEIF r$ = "b" THEN
xx = x: yy = yy - 50
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

reprodu6:
'tirage
DO
f = 0
z(jj) = INT(RND * 5) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj)

RETURN

reproduniveau1:
DO
reprodu11:
MouseBorder 308, 10, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF v_mouse >= 308 AND v_mouse <= 320 THEN
'fleches
IF h_mouse >= 100 AND h_mouse <= 112 THEN
'gauche
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 116 AND h_mouse <= 128 THEN
'droite
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 133 AND h_mouse <= 145 THEN
'haut
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 150 AND h_mouse <= 160 THEN
'bas
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 270 AND h_mouse <= 380 THEN
'del
valtouche = 8
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 420 AND h_mouse <= 528 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

IF (valtouche = 8 OR valtouche = 83) AND flag = 0 THEN BEEP: GOTO reprodu11
IF valtouche = 50 THEN valtouche = bas
IF valtouche = 52 THEN valtouche = gauche
IF valtouche = 54 THEN valtouche = droite
IF valtouche = 56 THEN valtouche = haut

SELECT CASE valtouche
CASE gauche
IF RIGHT$(reponse$, 1) = "d" THEN GOSUB reprodu5bis: GOTO reprodu12
xx = x - 50: yy = y
GOSUB reprodu2
IF xx < 0 THEN
xx = 0: BEEP
ELSE
reponse$ = reponse$ + "g"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE droite
IF RIGHT$(reponse$, 1) = "g" THEN GOSUB reprodu5bis: GOTO reprodu12
xx = x + 50: yy = y
GOSUB reprodu2
IF xx > 300 THEN
xx = 300: BEEP
ELSE
reponse$ = reponse$ + "d"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE haut
IF RIGHT$(reponse$, 1) = "b" THEN GOSUB reprodu5bis: GOTO reprodu12
xx = x: yy = y - 50
GOSUB reprodu2
IF yy < 0 THEN
yy = 0: BEEP
ELSE
reponse$ = reponse$ + "h"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE bas
IF RIGHT$(reponse$, 1) = "h" THEN GOSUB reprodu5bis: GOTO reprodu12
xx = x: yy = y + 50
GOSUB reprodu2
IF yy > 200 THEN
yy = 200: BEEP
ELSE
reponse$ = reponse$ + "b"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE 8, 83 'correction
GOSUB reprodu5bis

CASE 27
CALL quitter: GOSUB reprodu14: GOTO reprodu11

CASE 13
IF reponse$ = "" THEN GOTO reprodu11
EXIT DO
CASE ELSE
BEEP

END SELECT
reprodu12:
IF valtouche = 8 OR valtouche = 83 OR valtouche = gauche OR valtouche = droite OR valtouche = haut OR valtouche = bas THEN
PSET (x, y), rougeclair
x = xx: y = yy
GOSUB reprodu2
END IF

LOOP

RETURN


reprodu40:
w$ = "Avec les flèches " + CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + ", tu vas reproduire un chemin."
z$ = "Tu peux corriger tes erreurs avec la touche " + CHR$(27) + "- ou la touche suppr."
CALL consigne(2, w$, z$, xx$)

RETURN

END SUB
 

 

DECLARE SUB claviernumerique (z$)
DECLARE SUB MouseBorder (row1%, col1%, row2%, col2%)
DECLARE SUB MouseHide ()
DECLARE SUB MouseShow ()
DECLARE SUB MousePoll (row%, col%, lButton%, rButton%)
DECLARE SUB getinvimouse (rr%)
DECLARE SUB consigne (nl%, w$, z$, xx$)
DECLARE SUB titre (titr$)
DECLARE SUB entree ()
DECLARE SUB exact3 (tx!)
DECLARE SUB erreur3 (tx!)
DECLARE SUB erreur (tx!)
DECLARE SUB exact (tx!)
DECLARE SUB centre (v%, coul%, ph$)
DECLARE SUB quitter ()
DECLARE SUB getinvi (rr%)
DECLARE SUB attendre (tx!)
DECLARE SUB cadre3 (v%, h%, nb%, coul%)
DECLARE SUB inputgen (nl%, r$, deb%, fin%)
DECLARE SUB resultats (re%, ni%)
DECLARE SUB titre2 (titr$)
'exo 6 GEOMETRIE
'Daniel CLERC
'5/5/96
'version 3.0


DEFINT A-Z
SUB heure (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill)
'3/12/96
'niveau 1 et 2
DIM cercle(1 TO 50) AS INTEGER

CONST pi = 3.141592653589# ' , x = 320, y = 170
re = 0
rayon = 30
anglefin! = 90 * (pi / 180)
DIM z(5), rep(12), an(12), ang(60)

rep(1) = 30: rep(2) = 60: rep(3) = 90: rep(4) = 120
rep(5) = 150: rep(6) = 180: rep(7) = 210: rep(8) = 240
rep(9) = 270: rep(10) = 300: rep(11) = 330: rep(12) = 360

an(1) = 330: an(2) = 300: an(3) = 270: an(4) = 240
an(5) = 210: an(6) = 180: an(7) = 150: an(8) = 120
an(9) = 90: an(10) = 60: an(11) = 30: an(12) = 0

FOR i = 0 TO 60
ang(i) = 360 - (6 * i)
NEXT

'presentation
IF ni = 1 THEN
w$ = "Avec les flèches tu vas faire avancer ou reculer les aiguilles"
z$ = "d'une montre pour obtenir l'heure demandée."
CALL consigne(2, w$, z$, xx$)

ELSEIF ni = 2 THEN
w$ = "Avec les chiffres, tu vas taper"
z$ = "les heures et les minutes indiquées."
CALL consigne(2, w$, z$, xx$)

END IF
'début programme
SCREEN 9
x = 635: y = 35
CIRCLE (x, y), 4, jaune
GET (x - 4, y - 4)-(x + 4, y + 4), cercle
'++++++++++++++++++++++++++++++++ niveau 1
IF ni = 1 THEN

FOR jj = 1 TO 5

erreurs = 0
var! = 0
flag = 0: flag2 = 0
'tirage
DO
f = 0
z(jj) = INT(RND * 11) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj)
reponse = rep(choix)
CALL titre2(titr$)
GOSUB horloge

'les heures
LOCATE 22: PRINT SPACE$(80)
DO
GOSUB ang6

LOCATE 22, 77: COLOR vertclair: PRINT 6 - jj

angle = an(flag2)
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(bleu) + " u67"

angle = an(flag)
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(vertclair) + "u67"
PUT (320 - 4, 155 - 4), cercle, OR
GOSUB ang6

flag2 = flag

ang2:
DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG
MouseBorder 44, 160, 320, 470
MouseShow

DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
souris = 0
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
'LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF v_mouse >= 50 AND v_mouse <= 75 THEN
IF h_mouse >= 310 AND h_mouse <= 330 THEN
flag = 12
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
IF v_mouse >= 60 AND v_mouse <= 80 THEN
IF h_mouse >= 375 AND h_mouse <= 390 THEN
flag = 1
souris = 2
CALL attendre(.3)
EXIT DO
ELSEIF h_mouse >= 250 AND h_mouse <= 260 THEN
flag = 11
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
IF v_mouse >= 100 AND v_mouse <= 115 THEN
IF h_mouse >= 425 AND h_mouse <= 445 THEN
flag = 2
souris = 2
CALL attendre(.3)
EXIT DO
ELSEIF h_mouse >= 195 AND h_mouse <= 215 THEN
flag = 10
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
IF v_mouse >= 150 AND v_mouse <= 160 THEN
IF h_mouse >= 430 AND h_mouse <= 460 THEN
flag = 3
souris = 2
CALL attendre(.3)
EXIT DO
ELSEIF h_mouse >= 180 AND h_mouse <= 205 THEN
flag = 9
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
IF v_mouse >= 195 AND v_mouse <= 210 THEN
IF h_mouse >= 425 AND h_mouse <= 445 THEN
flag = 4
souris = 2
CALL attendre(.3)
EXIT DO
ELSEIF h_mouse >= 195 AND h_mouse <= 215 THEN
flag = 8
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
IF v_mouse >= 230 AND v_mouse <= 250 THEN
IF h_mouse >= 375 AND h_mouse <= 390 THEN
flag = 5
souris = 2
CALL attendre(.3)
EXIT DO
ELSEIF h_mouse >= 250 AND h_mouse <= 260 THEN
flag = 7
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
IF v_mouse >= 235 AND v_mouse <= 255 THEN
IF h_mouse >= 310 AND h_mouse <= 330 THEN
flag = 6
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF

IF v_mouse >= 308 AND v_mouse <= 320 THEN
'fleches
IF h_mouse >= 160 AND h_mouse <= 246 THEN
'haut
touche = 72
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 264 AND h_mouse <= 350 THEN
'bas
touche = 80
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 368 AND h_mouse <= 470 THEN
'return
touche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

MouseHide

IF souris = 2 THEN
angle = an(flag2)
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(bleu) + " u67"

angle = an(flag)
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(vertclair) + "u67"
PUT (320 - 4, 155 - 4), cercle, OR
flag2 = flag

touche = 13
END IF

IF souris = 0 THEN
IF LEN(r$) < 2 THEN touche = ASC(r$) ELSE touche = ASC(RIGHT$(r$, 1))
END IF

SELECT CASE touche
CASE 27
CALL quitter

CASE 72 'haut
flag = flag - 1: IF flag < 0 THEN flag = 0: BEEP: GOTO ang2

CASE 80 'bas
flag = flag + 1: IF flag > 12 THEN flag = 12: BEEP: GOTO ang2

CASE 13
LOCATE 22: PRINT SPACE$(80)
IF flag = choix THEN
CALL exact(.7): LOCATE 23: PRINT SPACE$(80): fixe! = angle
IF erreurs = 0 THEN re = re + 1
EXIT DO
ELSE
erreurs = erreurs + 1
CALL erreur(.5)
IF rep(flag) = 30 OR rep(flag) = 0 THEN z$ = " heure." ELSE z$ = " heures."
CALL centre(23, rougeclair, "Tu as indiqué" + STR$(rep(flag) / 30) + z$)
CALL attendre(2)
END IF
LOCATE 23: PRINT SPACE$(80)
GOSUB ang6
GOTO ang2
EXIT DO

CASE ELSE
BEEP: GOTO ang2

END SELECT

LOOP WHILE valtouche$ <> CHR$(13)

'les minutes
flag = 0: flag2 = 0: var = 0
'tirage
DO
f = 0
z(jj) = INT(RND * 11) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj)
reponse = rep(choix)
LOCATE 22: PRINT SPACE$(80)
GOSUB horloge2

DO
GOSUB ang10
GOSUB ang11 'dessin des heures
angle = an(flag2)
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(bleu) + " u80"

angle = an(flag)
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(jaune) + "u80"
GOSUB ang10
GOSUB ang11 'dessin des heures

flag2 = flag
ang7:
DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG
MouseBorder 44, 160, 320, 470
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF v_mouse >= 50 AND v_mouse <= 75 THEN
IF h_mouse >= 310 AND h_mouse <= 330 THEN
flag = 12
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
IF v_mouse >= 60 AND v_mouse <= 80 THEN
IF h_mouse >= 375 AND h_mouse <= 390 THEN
flag = 1
souris = 2
CALL attendre(.3)
EXIT DO
ELSEIF h_mouse >= 250 AND h_mouse <= 260 THEN
flag = 11
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
IF v_mouse >= 100 AND v_mouse <= 115 THEN
IF h_mouse >= 425 AND h_mouse <= 445 THEN
flag = 2
souris = 2
CALL attendre(.3)
EXIT DO
ELSEIF h_mouse >= 195 AND h_mouse <= 215 THEN
flag = 10
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
IF v_mouse >= 150 AND v_mouse <= 160 THEN
IF h_mouse >= 430 AND h_mouse <= 460 THEN
flag = 3
souris = 2
CALL attendre(.3)
EXIT DO
ELSEIF h_mouse >= 180 AND h_mouse <= 205 THEN
flag = 9
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
IF v_mouse >= 195 AND v_mouse <= 210 THEN
IF h_mouse >= 425 AND h_mouse <= 445 THEN
flag = 4
souris = 2
CALL attendre(.3)
EXIT DO
ELSEIF h_mouse >= 195 AND h_mouse <= 215 THEN
flag = 8
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
IF v_mouse >= 230 AND v_mouse <= 250 THEN
IF h_mouse >= 375 AND h_mouse <= 390 THEN
flag = 5
souris = 2
CALL attendre(.3)
EXIT DO
ELSEIF h_mouse >= 250 AND h_mouse <= 260 THEN
flag = 7
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF
IF v_mouse >= 235 AND v_mouse <= 255 THEN
IF h_mouse >= 310 AND h_mouse <= 330 THEN
flag = 6
souris = 2
CALL attendre(.3)
EXIT DO
ELSE
BEEP
END IF
END IF

IF v_mouse >= 308 AND v_mouse <= 320 THEN
'fleches
IF h_mouse >= 160 AND h_mouse <= 246 THEN
'haut
touche = 72
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 264 AND h_mouse <= 350 THEN
'bas
touche = 80
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 368 AND h_mouse <= 470 THEN
'return
touche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

MouseHide

IF souris = 2 THEN

'effacer l'aiguille des minutes
angle = an(flag2)
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(bleu) + " u80"
'dessin aiguille minutes
angle = an(flag)
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(jaune) + "u80"
'effacer aiguille heure
angle2! = fixe! + var!
DRAW "b m320,155 ta=" + VARPTR$(angle2!) + "c=" + VARPTR$(bleu) + "u67"
PUT (320 - 4, 155 - 4), cercle, OR
'dessin des heures
var! = 0
FOR i = 1 TO flag
var! = var! - 2.5
NEXT
GOSUB ang11 'dessin des heures

flag2 = flag
touche = 13
END IF

IF souris = 0 THEN
IF LEN(r$) < 2 THEN touche = ASC(r$) ELSE touche = ASC(RIGHT$(r$, 1))
END IF

SELECT CASE touche
CASE 27
CALL quitter

CASE 72 'haut
flag = flag - 1: IF flag < 0 THEN flag = 0: BEEP: GOTO ang7
GOSUB ang12: var! = var! + 2.5

CASE 80 'bas
flag = flag + 1: IF flag > 12 THEN flag = 12: BEEP: GOTO ang7
GOSUB ang12: var! = var! - 2.5

CASE 13
LOCATE 22: PRINT SPACE$(80)
IF flag = choix THEN
CALL exact(1): LOCATE 23: PRINT SPACE$(80)
IF erreurs = 0 THEN re = re + 1
EXIT DO
ELSE
erreurs = erreurs + 1
CALL erreur(.5)
IF rep(flag) = 0 THEN z$ = " minute." ELSE z$ = " minutes."
CALL centre(23, rougeclair, "Tu as indiqué" + STR$(rep(flag) / 6) + z$)
CALL attendre(2)
END IF
LOCATE 23: PRINT SPACE$(80)
GOSUB ang10
GOTO ang7
EXIT DO

CASE ELSE
BEEP: GOTO ang7

END SELECT

LOOP WHILE valtouche$ <> CHR$(13)

NEXT jj

'++++++++++++++++++++++++++++++++++ niveau 2
ELSE

FOR jj = 1 TO 5

erreurs = 0
'tirage
DO
f = 0
z(jj) = INT(RND * 11) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj)
CALL titre2(titr$)

GOSUB horloge
LOCATE 22, 1: PRINT SPACE$(80)
LOCATE 22, 77: COLOR vertclair: PRINT 6 - jj
'dessin des minutes
choix2 = INT(RND * 11) + 1
angle = an(choix2)
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(jaune) + " u80"
'dessin des heures
var! = 0
FOR i = 1 TO choix2
var! = var! - 2.5
NEXT
angle! = an(choix) + var!
DRAW "b m320,155 ta=" + VARPTR$(angle!) + "c=" + VARPTR$(vertclair) + " u67"

heure1:
COLOR blancbrill
IF choix > 1 THEN
LOCATE 22, 20: PRINT "Heures : "
ELSE
LOCATE 22, 21: PRINT "Heure : "
END IF
CALL cadre3(22, 29, 2, blancbrill)
COLOR blancbrill: LOCATE 22, 29

DEF SEG = 0
POKE &H417, (PEEK(&H417) OR &H40)'MAJ
POKE &H417, (PEEK(&H417) OR &h30)'numérique
DEF SEG

CALL inputgen(2, r$, 48, 57)
r = VAL(r$)
IF r = choix OR r = choix + 12 THEN
CALL exact3(1)
IF erreurs = 0 THEN re = re + 1
ELSE
erreurs = erreurs + 1
CALL erreur3(.5)
IF erreurs >= 2 THEN
CALL centre(23, rougeclair, "Solution :" + STR$(choix))
CALL attendre(1)
CALL centre(23, rougeclair, SPACE$(14))
END IF
GOTO heure1
END IF
CALL cadre3(22, 29, 2, blancbrill)
erreurs = 0
'les minutes
GOSUB horloge2
heure3:
COLOR blancbrill: LOCATE 22, 50: PRINT "Minutes : "
CALL cadre3(22, 60, 2, blancbrill)
LOCATE 22, 60
DEF SEG = 0
POKE &H417, (PEEK(&H417) OR &H40)'MAJ
POKE &H417, (PEEK(&H417) OR &h30)'numérique
DEF SEG

CALL inputgen(2, r$, 48, 57)

r = VAL(r$)
IF r = choix2 * 5 THEN
CALL exact3(1)
IF erreurs = 0 THEN re = re + 1
ELSE
erreurs = erreurs + 1
CALL erreur3(.5)
IF erreurs >= 2 THEN
CALL centre(23, rougeclair, "Solution :" + STR$(choix2 * 5))
CALL attendre(1)
CALL centre(23, rougeclair, SPACE$(14))
END IF

GOTO heure3
END IF
LOCATE 21: COLOR rouge: PRINT STRING$(80, 196): PRINT SPACE$(80): PRINT SPACE$(80)
NEXT jj

END IF
'++++++++++++++++++++++ fin programme

'résultats
SCREEN 0
CALL resultats(re, ni)
EXIT SUB


ang6:
IF reponse = 30 THEN z$ = " heure" ELSE z$ = " heures"
CALL centre(22, jaune, STR$(reponse / 30) + z$)
CALL centre(23, blanc, CHR$(24) + " = reculer " + CHR$(25) + " = avancer " + rt$ + " = valider")
RETURN

ang10:
IF reponse = 1 THEN z$ = " minute" ELSE z$ = " minutes"
CALL centre(22, jaune, STR$(reponse / 6) + z$)
CALL centre(23, blanc, CHR$(24) + " = reculer " + CHR$(25) + " = avancer " + rt$ + " = valider")
RETURN

horloge:
CIRCLE (320, 155), 150, vertclair
FOR a = 0 TO 360 STEP 90
DRAW "b m320,155 ta=" + VARPTR$(a) + "c=" + VARPTR$(blancbrill) + "b u85 u15"
NEXT
FOR a = 0 TO 360 STEP 30
DRAW "b m320,155 ta=" + VARPTR$(a) + "c=" + VARPTR$(blancbrill) + "b u90 u10"
NEXT
PUT (320 - 4, 155 - 4), cercle, OR
RETURN

horloge2:
CIRCLE (320, 155), 150, vertclair
FOR a = 0 TO 60
ang = ang(a)
DRAW "b m320,155 ta=" + VARPTR$(ang) + "c=" + VARPTR$(rougeclair) + "b u95 u4"
NEXT
FOR a = 0 TO 360 STEP 30
DRAW "b m320,155 ta=" + VARPTR$(a) + "c=" + VARPTR$(blancbrill) + "b u90 u10"
NEXT
PUT (320 - 4, 155 - 4), cercle, OR
RETURN

ang11:
angle2! = fixe! + var!
DRAW "b m320,155 ta=" + VARPTR$(angle2!) + "c=" + VARPTR$(vertclair) + "u67"
PUT (320 - 4, 155 - 4), cercle, OR
RETURN

ang12:
angle2! = fixe! + var!
DRAW "b m320,155 ta=" + VARPTR$(angle2!) + "c=" + VARPTR$(bleu) + "u67"
PUT (320 - 4, 155 - 4), cercle, OR
RETURN


END SUB

DEFINT A-Z
SUB mesureduree (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill)
'2/12/96

DIM cercle(1 TO 50) AS INTEGER
DIM zero(1 TO 30) AS INTEGER
DIM un(1 TO 30) AS INTEGER
DIM deux(1 TO 30) AS INTEGER
DIM trois(1 TO 30) AS INTEGER
DIM quatre(1 TO 30) AS INTEGER
DIM cinq(1 TO 30) AS INTEGER
DIM six(1 TO 30) AS INTEGER

DIM an(60)
titr$ = "secondes"
CONST pi = 3.141592653589# ' , x = 320, y = 170
re = 0

'présentation

IF ni = 3 THEN dur = 30 ELSE dur = 60
w$ = "Tu vas compter" + STR$(dur) + " secondes."
CALL consigne(1, w$, z$, xx$)

FOR i = 0 TO 60
an(i) = 360 - (6 * i)
NEXT

'début programme
SCREEN 9, , 0, 1

'mémorisation des lettres : matrice 8 x 14
x = 0: y = 0
PRINT "0 1 2 3 4 5 6"
GET (x, y)-(x + 7, y + 13), zero
x = x + 16
GET (x, y)-(x + 7, y + 13), un
x = x + 16
GET (x, y)-(x + 7, y + 13), deux
x = x + 16
GET (x, y)-(x + 7, y + 13), trois
x = x + 16
GET (x, y)-(x + 7, y + 13), quatre
x = x + 16
GET (x, y)-(x + 7, y + 13), cinq
x = x + 16
GET (x, y)-(x + 7, y + 13), six

LOCATE 1: PRINT SPACE$(15)

SCREEN 9, , 0, 0

'boucle principale ++++++++++++++++++
FOR ii = 1 TO 2
durees0:
CALL titre2(titr$)
CALL centre(22, blancbrill, "Entraînement :")
CALL centre(23, jaune, "Tu vas compter pendant 15 secondes.")

SCREEN 9, , 1, 0 'invisible
CALL titre2(titr$)

'dessin de l'horloge
FOR a = 0 TO 360 STEP 6
DRAW "b m320,155 ta=" + VARPTR$(a) + "c=" + VARPTR$(rougeclair) + "b u95 u4"
NEXT
FOR a = 0 TO 360 STEP 30
DRAW "b m320,155 ta=" + VARPTR$(a) + "c=" + VARPTR$(blancbrill) + "b u90 u10"
NEXT
x = 320: y = 155
CIRCLE (x, y), 4, jaune
GET (x - 4, y - 4)-(x + 4, y + 4), cercle
'PUT (320 - 4, 155 - 4), cercle, OR

'dessin des chiffres
PUT (390, 50), cinq, OR '

PUT (445, 95), un, OR '
PUT (453, 95), zero, OR
PUT (463, 147), un, OR '
PUT (471, 147), cinq, OR
PUT (445, 199), deux, OR '
PUT (453, 199), zero, OR
PUT (387, 247), deux, OR '
PUT (395, 247), cinq, OR

PUT (313, 259), trois, OR '
PUT (321, 259), zero, OR

PUT (241, 247), trois, OR '
PUT (249, 247), cinq, OR
PUT (181, 199), quatre, OR '
PUT (189, 199), zero, OR
PUT (163, 147), quatre, OR '
PUT (171, 147), cinq, OR

PUT (181, 95), cinq, OR '
PUT (189, 95), zero, OR
PUT (239, 50), cinq, OR '
PUT (247, 50), cinq, OR
'PUT (313, 38), six, OR '
PUT (317, 38), zero, OR

LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)
SCREEN 9, , 1, 1 'visible

LOCATE 22, 77: COLOR vertclair: PRINT 3 - ii
CALL centre(22, blancbrill, "Entraînement :")
CALL centre(23, jaune, "Tu vas compter pendant 15 secondes.")
CALL attendre(1)
LOCATE 23: PRINT SPACE$(80)
CALL centre(23, jaune, "Regarde et compte en même temps.")
CALL attendre(2)
BEEP: nombrefois = 15: GOSUB durees3

angle = an(15)
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(bleu) + " u85"
angle = an(0)
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(vertclair) + " u85"
'LOCATE 22: PRINT space$(80)
CALL centre(22, blancbrill, "Durée =" + STR$(dur) + " secondes.")
CALL centre(23, jaune, "Tape la touche [Espace] pour commencer.")

DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG

DO
w$ = INKEY$
MousePoll v_mouse, h_mouse, lButton, rButton
IF lButton THEN
w$ = CHR$(13)
END IF
IF w$ = CHR$(32) OR w$ = CHR$(13) THEN EXIT DO
IF w$ = CHR$(27) THEN CALL quitter: CALL centre(23, jaune, "Tape la touche [Espace] pour commencer.")
LOOP
LOCATE 23: PRINT SPACE$(80)
CALL centre(23, vertclair, "(Aiguille visible pendant 5 secondes)")

BEEP: nombrefois = 5: GOSUB durees3
CALL centre(23, jaune, "Tape la touche [Espace] pour terminer.")

duree = dur + 5: GOSUB durees2
te = temp + 6
IF te > 60 THEN te2 = te - 60 ELSE te2 = te
angle = an(te2)
'IF angle > 360 THEN angle = angle - 360
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(vertclair) + " u85"
LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)
IF flag = 0 THEN
BEEP: CALL centre(23, rougeclair, "Tu n'as pas appuyé sur la touche [Espace] !")
CALL attendre(3)
IF r = 27 THEN CALL quitter
GOTO durees0
END IF
CALL centre(22, jaune, "Durée trouvée :" + STR$(te) + " secondes.")

IF dur = te THEN
CALL exact(2): re = re + 5
ELSEIF dur > te THEN
IF dur - te < 3 THEN
z$ = "Tu as compté un tout petit peu trop vite."
re = re + 4
ELSEIF dur - te < 5 THEN
z$ = "Tu as compté un peu trop vite."
re = re + 3
ELSEIF dur - te < 10 THEN
z$ = "Tu as compté trop vite."
re = re + 2
ELSE
z$ = "Tu as compté beaucoup trop vite."
END IF
CALL centre(23, rougeclair, z$): CALL attendre(3)
IF r = 27 THEN CALL quitter
ELSEIF dur < te THEN
IF te - dur < 3 THEN
z$ = "Tu as compté un tout petit peu trop lentement."
re = re + 4
ELSEIF te - dur < 5 THEN
z$ = "Tu as compté un peu trop lentement."
re = re + 3
ELSEIF te - dur < 10 THEN
z$ = "Tu as compté trop lentement."
re = re + 2
ELSE
z$ = "Tu as compté beaucoup trop lentement."
END IF
CALL centre(23, rougeclair, z$): CALL attendre(3)
IF r = 27 THEN CALL quitter
END IF

NEXT ii
'résultats
SCREEN 0
CALL resultats(re, ni)

EXIT SUB

durees2:
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG

flag = 0
debut! = TIMER
DO
fin! = TIMER
temp = fin! - debut!
w$ = INKEY$
MousePoll v_mouse, h_mouse, lButton, rButton
IF lButton THEN
w$ = CHR$(13)
END IF
IF w$ = CHR$(13) OR w$ = CHR$(32) THEN flag = 1: EXIT DO
IF w$ = CHR$(27) THEN CALL quitter
LOOP WHILE temp < duree
RETURN

durees3:
'aiguille
FOR i = 0 TO nombrefois
angle = an(i)
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(vertclair) + " u85"
debut! = TIMER
DO
fin! = TIMER
LOOP WHILE fin! - debut! < .9
DRAW "b m320,155 ta=" + VARPTR$(angle) + "c=" + VARPTR$(bleu) + " u85"
PUT (320 - 4, 155 - 4), cercle, OR
NEXT
RETURN


END SUB

DEFINT A-Z
SUB symetrie1 (re, ni, rt$, gg$, pre$, titr$, noir, bleu, vert, rouge, marron, blanc, vertclair, cyanclair, rougeclair, jaune, blancbrill, couleur, coef1!, coef2!)
'3/12/96 niv 1 & 2 souris

DIM dessin$(15), dessin2$(15), solution$(15), x(15), y(15), x2(15), y2(15), z(5)
DIM cercle(1 TO 50) AS INTEGER

CONST gauche = 75, droite = 77
CONST haut = 72, bas = 80, hautgauche = 71, hautdroite = 73, basgauche = 79, basdroite = 81
titr$ = "symetrie"
re = 0

'niveau 1
dessin$(1) = "l50 u50 l50 d50 l100 d50 l50 d50 r100 u50 r50 d100 r50 u100 r50"
dessin2$(1) = "r50 u50 r50 d50 r100 d50 r50 d50 l100 u50 l50 d100 l50 u100 l50"
solution$(1) = "dhdbddbdbgghgbbghhg"
x(1) = 300: y(1) = 50: x2(1) = 0: y2(1) = 50

dessin$(2) = "l50 d50 l50 d50 l100 d50 l100 d50 r150 u50 r100 u50 r50"
dessin2$(2) = "r50 d50 r50 d50 r100 d50 r100 d50 l150 u50 l100 u50 l50"
solution$(2) = "dbdbddbddbggghgghg"
x(2) = 300: y(2) = 0: x2(2) = 0: y2(2) = 0

dessin$(3) = "l50 d50 l100 u50 l50 u50 l50 d50 l50 u150 r50 d50 r100 u50 r50 d100 r50 u50"
dessin2$(3) = "r50 d50 r100 u50 r50 u50 r50 d50 r50 u150 l50 d50 l100 u50 l50 d100 l50 u50"
solution$(3) = "dbddhdhdbdhhhgbgghgbbgh"
x(3) = 300: y(3) = 150: x2(3) = 0: y2(3) = 150

dessin$(4) = "l50 u100 l150 d50 l100 u150 r100 d50 r150 u50 r50"
dessin2$(4) = "r50 u100 r150 d50 r100 u150 l100 d50 l150 u50 l50"
solution$(4) = "dhhdddbddhhhggbggghg"
x(4) = 300: y(4) = 200: x2(4) = 0: y2(4) = 200

dessin$(5) = "l50 d50 l50 u100 l50 d100 l50 d100 r50 u50 r150 d50 r50 u100 r50"
dessin2$(5) = "r50 d50 r50 u100 r50 d100 r50 d100 l50 u50 l150 d50 l50 u100 l50"
solution$(5) = "dbdhhdbbdbbghgggbghhg"
x(5) = 200: y(5) = 50: x2(5) = 100: y2(5) = 50

'niveau 2 angle 45
dessin$(11) = "m-50,+50 m-100,-100 m-50,+50 d50 l50 m+50,+50 r50 d50 m+50,-50 r50 m+50,-50"
dessin2$(11) = "m+50,+50 m+100,-100 m+50,+50 d50 r50 m-50,+50 l50 d50 m-50,-50 l50 m-50,-50"
solution$(11) = "lkklbdmgbjgj"
x(11) = 300: y(11) = 50: x2(11) = 0: y2(11) = 50

dessin$(12) = "m-50,+50 m-50,-50 m-50,+50 l50 m-50,+50 m-50,-50 d100 r100 m+50,-50 m+50,+50 m+50,-50 m+50,+50"
dessin2$(12) = "m+50,+50 m+50,-50 m+50,+50 r50 m+50,+50 m+50,-50 d100 l100 m-50,-50 m-50,+50 m-50,-50 m-50,+50"
solution$(12) = "lkldlkbbggjmjm"
x(12) = 300: y(12) = 50: x2(12) = 0: y2(12) = 50

dessin$(13) = "m-100,+100 m-50,-50 l50 m-50,+50 m+50,+50 r50 m+50,+50 m+50,-50"
dessin2$(13) = "m+100,+100 m+50,-50 r50 m+50,+50 m-50,+50 l50 m-50,+50 m-50,-50"
solution$(13) = "llkdlmgmj"
x(13) = 300: y(13) = 0: x2(13) = 0: y2(13) = 0

dessin$(14) = "m-50,-50 u50 l50 m-50,+50 l50 m-50,-50 d50 m-50,+50 m+100,+100 r50 u50 r50 u50 m+100,+100"
dessin2$(14) = "m+50,-50 u50 r50 m+50,+50 r50 m+50,-50 d50 m+50,+50 m-100,+100 l50 u50 l50 u50 m-100,+100"
solution$(14) = "khdldkblmmghghmm"
x(14) = 300: y(14) = 100: x2(14) = 0: y2(14) = 100

dessin$(15) = "m-50,+50 l50 m-100,-100 u100 m+50,+50 m+50,-50 m+50,+50 m+50,-50 m+50,+50"
dessin2$(15) = "m+50,+50 r50 m+100,-100 u100 m-50,+50 m-50,-50 m-50,+50 m-50,-50 m-50,+50"
solution$(15) = "ldkkhhmjmjm"
x(15) = 250: y(15) = 150: x2(15) = 50: y2(15) = 150

SELECT CASE ni
CASE 1
nombre = 0
CASE 2
nombre = 10
END SELECT

GOSUB syme40 'présentation

CLS
x = 635: y = 35
CIRCLE (x, y), 4, jaune, , , coef2!
GET (x - 4, y - 4)-(x + 4, y + 4), cercle

FOR jj = 1 TO 3

DEF SEG = 0
POKE &H417, (PEEK(&H417) AND &H9F)'non numérique
DEF SEG

GOSUB syme6 'tirage
erreurs = 0
syme13:
x = x(choix) + 20: y = y(choix) + 55

LOCATE 1: PRINT SPACE$(80)
CALL titre2(titr$)
IF ni = 1 THEN COLOR vertclair: LOCATE 22: PRINT "Niveau"; ni: LOCATE 22, 77: PRINT 4 - jj
LINE (320, 32)-(320, 278), blancbrill, , &HF0F0
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(jaune) + dessin$(choix)

'fenetre gauche
VIEW (20, 55)-(320 + 4, 255 + 4)'300 de large et 200 de haut
coul = rougeclair: GOSUB syme1
x = x(choix): y = y(choix)
IF x2(choix) <> 0 THEN GOSUB syme2

'fenetre droite
VIEW (320, 55)-(620 + 4, 255 + 4) '300 de large et 200 de haut (+ 4 pour le rond)
coul = vertclair: IF erreurs <> 0 THEN GOSUB syme1
x = x2(choix): y = y2(choix): GOSUB syme2
IF erreurs > 1 AND couleur = 1 THEN
tempx = x2(choix) + 320: tempy = y2(choix) + 55
DRAW "TA0 B m=" + VARPTR$(tempx) + ",=" + VARPTR$(tempy)
DRAW "c=" + VARPTR$(rougeclair) + dessin2$(choix)
END IF
GOSUB syme14
flag = 0: reponse$ = ""

IF ni = 1 THEN
GOSUB symeniveau1
ELSE
GOSUB symeniveau2
END IF

VIEW

LOCATE 22: PRINT SPACE$(80): PRINT SPACE$(80)

IF solution$(choix) = reponse$ THEN
CALL exact(2)
IF erreurs = 0 THEN re = re + 3
ELSE
erreurs = erreurs + 1
CALL centre(23, rougeclair, "Les chemins ne sont pas symétriques.")
CALL attendre(1.5)
LOCATE 23: PRINT SPACE$(80): CALL centre(23, rougeclair, "Regarde")
x = x2(choix) + 320: y = y2(choix) + 55
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(rougeclair) + dessin2$(choix)
CALL getinvimouse(r): IF r = 27 THEN CALL quitter
LOCATE 23: PRINT SPACE$(80): GOTO syme13
END IF

NEXT jj

'résultats
SCREEN 0
re = re + 1
CALL resultats(re, ni)

EXIT SUB
'++++++++++++++++++++++++


syme14:
IF ni = 1 THEN
CALL centre(23, blanc, CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + " = tracer <-- = corriger " + rt$ + " = valider")
ELSE
COLOR blanc
LOCATE 23, 23: PRINT "= tracer <-- = corriger " + rt$ + " = valider"
LOCATE 21, 10: PRINT "[7] [8] [9]"
LOCATE 22, 10: PRINT "[4] [6]"
LOCATE 23, 10: PRINT "[1] [2] [3]"
END IF
RETURN

syme1:
FOR x = 0 TO 300 STEP 50
FOR y = 0 TO 200 STEP 50
PSET (x, y), coul
NEXT y
NEXT x
RETURN

syme2:
PUT (x - 4, y - 4), cercle, XOR
PSET (x, y), rougeclair
RETURN

syme5:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB syme2
IF r$ = "g" THEN
xx = x + 50: yy = y
ELSEIF r$ = "d" THEN
xx = x - 50: yy = y
ELSEIF r$ = "h" THEN
xx = x: yy = yy + 50
ELSEIF r$ = "b" THEN
xx = x: yy = yy - 50
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

syme6:
'tirage
DO
f = 0
z(jj) = INT(RND * 5) + 1
FOR j = 1 TO jj - 1
IF z(jj) = z(j) THEN f = 1: EXIT FOR
NEXT
LOOP WHILE f = 1
choix = z(jj) + nombre

RETURN

symeniveau1:
DO
syme11:
LINE (0, 0)-(0, 300), blancbrill, , &HF0F0

MouseBorder 308, 10, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 1: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF v_mouse >= 308 AND v_mouse <= 320 THEN
'fleches
IF h_mouse >= 100 AND h_mouse <= 112 THEN
'gauche
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 116 AND h_mouse <= 128 THEN
'droite
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 133 AND h_mouse <= 145 THEN
'haut
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 150 AND h_mouse <= 160 THEN
'bas
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 270 AND h_mouse <= 380 THEN
'del
valtouche = 8
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 420 AND h_mouse <= 528 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
ELSE
BEEP
END IF
END IF
LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

IF (valtouche = 8 OR valtouche = 83) AND flag = 0 THEN BEEP: GOTO syme11
IF valtouche = 50 THEN valtouche = bas
IF valtouche = 52 THEN valtouche = gauche
IF valtouche = 54 THEN valtouche = droite
IF valtouche = 56 THEN valtouche = haut

SELECT CASE valtouche
CASE gauche
IF RIGHT$(reponse$, 1) = "d" THEN GOSUB syme5: GOTO syme12
xx = x - 50: yy = y
GOSUB syme2
IF xx < 0 THEN
xx = 0: BEEP
ELSE
reponse$ = reponse$ + "g"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE droite
IF RIGHT$(reponse$, 1) = "g" THEN GOSUB syme5: GOTO syme12
xx = x + 50: yy = y
GOSUB syme2
IF xx > 300 THEN
xx = 300: BEEP
ELSE
reponse$ = reponse$ + "d"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE haut
IF RIGHT$(reponse$, 1) = "b" THEN GOSUB syme5: GOTO syme12
xx = x: yy = y - 50
GOSUB syme2
IF yy < 0 THEN
yy = 0: BEEP
ELSE
reponse$ = reponse$ + "h"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE bas
IF RIGHT$(reponse$, 1) = "h" THEN GOSUB syme5: GOTO syme12
xx = x: yy = y + 50
GOSUB syme2
IF yy > 200 THEN
yy = 200: BEEP
ELSE
reponse$ = reponse$ + "b"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE 8, 83 'correction
GOSUB syme5

CASE 27
CALL quitter: GOSUB syme14: GOTO syme11
CASE 13
IF reponse$ = "" THEN GOTO syme11
EXIT DO
CASE ELSE
BEEP

END SELECT
syme12:
IF valtouche = 8 OR valtouche = 83 OR valtouche = gauche OR valtouche = droite OR valtouche = haut OR valtouche = bas THEN
PSET (x, y), rougeclair
x = xx: y = yy
GOSUB syme2
END IF

LOOP

RETURN

symeniveau2:
DO
syme31:
LINE (0, 0)-(0, 300), blancbrill, , &HF0F0

MouseBorder 282, 75, 320, 630
MouseShow
souris = 0
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
DO
r$ = INKEY$
' Obtient l'emplacement de la souris et l'état des boutons.
MousePoll v_mouse, h_mouse, lButton, rButton
' LOCATE 21, 40: PRINT v_mouse, h_mouse'===
IF lButton THEN
IF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = hautgauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 106 AND h_mouse <= 126) THEN
valtouche = haut
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 282 AND v_mouse <= 292) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = hautdroite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 296 AND v_mouse <= 306) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = gauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 296 AND v_mouse <= 306) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = droite
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 73 AND h_mouse <= 93) THEN
valtouche = basgauche
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 106 AND h_mouse <= 126) THEN
valtouche = bas
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF (v_mouse >= 310 AND v_mouse <= 320) AND (h_mouse >= 136 AND h_mouse <= 156) THEN
valtouche = basdroite
CALL attendre(.2)
souris = 1
EXIT DO
END IF
'ok
IF v_mouse >= 308 AND v_mouse <= 320 THEN
IF h_mouse >= 280 AND h_mouse <= 390 THEN
'del
valtouche = 8
CALL attendre(.2)
souris = 1
EXIT DO
ELSEIF h_mouse >= 440 AND h_mouse <= 540 THEN
'return
valtouche = 13
CALL attendre(.2)
souris = 1
EXIT DO
ELSE
BEEP
END IF
END IF
END IF

LOOP WHILE r$ = ""

MouseHide

IF souris = 0 THEN
IF LEN(r$) < 2 THEN valtouche = ASC(r$) ELSE valtouche = ASC(RIGHT$(r$, 1))
END IF

IF (valtouche = 8 OR valtouche = 83) AND flag = 0 THEN BEEP: GOTO syme31

IF valtouche = 49 OR valtouche = 38 THEN valtouche = basgauche
IF valtouche = 50 OR valtouche = 130 THEN valtouche = bas
IF valtouche = 51 OR valtouche = 34 THEN valtouche = basdroite
IF valtouche = 52 OR valtouche = 39 THEN valtouche = gauche
IF valtouche = 54 OR valtouche = 45 THEN valtouche = droite
IF valtouche = 55 OR valtouche = 138 THEN valtouche = hautgauche
IF valtouche = 56 OR valtouche = 95 THEN valtouche = haut
IF valtouche = 57 OR valtouche = 135 THEN valtouche = hautdroite

SELECT CASE valtouche

CASE gauche
IF RIGHT$(reponse$, 1) = "d" THEN GOSUB syme5: GOTO syme32
xx = x - 50: yy = y
GOSUB syme2
IF xx < 0 THEN
xx = 0: BEEP
ELSE
reponse$ = reponse$ + "g"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE droite
IF RIGHT$(reponse$, 1) = "g" THEN GOSUB syme5: GOTO syme32
xx = x + 50: yy = y
GOSUB syme2
IF xx > 300 THEN
xx = 300: BEEP
ELSE
reponse$ = reponse$ + "d"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE haut
IF RIGHT$(reponse$, 1) = "b" THEN GOSUB syme5: GOTO syme32
xx = x: yy = y - 50
GOSUB syme2
IF yy < 0 THEN
yy = 0: BEEP
ELSE
reponse$ = reponse$ + "h"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE bas
IF RIGHT$(reponse$, 1) = "h" THEN GOSUB syme5: GOTO syme32
xx = x: yy = y + 50
GOSUB syme2
IF yy > 200 THEN
yy = 200: BEEP
ELSE
reponse$ = reponse$ + "b"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE hautgauche
IF RIGHT$(reponse$, 1) = "l" THEN GOSUB syme35: GOTO syme32
xx = x - 50: yy = y - 50
GOSUB syme2
IF yy < 0 OR xx < 0 THEN
IF yy < 0 THEN
yy = 0: xx = xx + 50: BEEP
ELSEIF xx < 0 THEN
xx = 0: yy = yy + 50: BEEP
END IF
ELSE
reponse$ = reponse$ + "j"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE hautdroite
IF RIGHT$(reponse$, 1) = "m" THEN GOSUB syme35: GOTO syme32
xx = x + 50: yy = y - 50
GOSUB syme2
IF yy < 0 OR xx > 300 THEN
IF yy < 0 THEN
yy = 0: xx = xx - 50: BEEP
ELSEIF xx > 300 THEN
xx = 300: yy = yy + 50: BEEP
END IF
ELSE
reponse$ = reponse$ + "k"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE basgauche
IF RIGHT$(reponse$, 1) = "k" THEN GOSUB syme35: GOTO syme32
xx = x - 50: yy = y + 50
GOSUB syme2
IF yy > 200 OR xx < 0 THEN
IF yy > 200 THEN
yy = 200: xx = xx + 50: BEEP
ELSEIF xx < 0 THEN
xx = 0: yy = yy - 50: BEEP
END IF
ELSE
reponse$ = reponse$ + "m"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE basdroite
IF RIGHT$(reponse$, 1) = "j" THEN GOSUB syme35: GOTO syme32
xx = x + 50: yy = y + 50
GOSUB syme2
IF yy > 200 OR xx > 300 THEN
IF yy > 200 THEN
yy = 200: xx = xx - 50: BEEP
ELSEIF xx > 300 THEN
xx = 300: yy = yy - 50: BEEP
END IF
ELSE
reponse$ = reponse$ + "l"
LINE (x, y)-(xx, yy)
flag = flag + 1
END IF

CASE 8, 83 'correction
r$ = RIGHT$(reponse$, 1)
IF r$ = "h" OR r$ = "b" OR r$ = "g" OR r$ = "d" THEN
GOSUB syme5
ELSE
GOSUB syme35
END IF

CASE 27
CALL quitter: GOSUB syme14: GOTO syme31
CASE 13
IF reponse$ = "" THEN GOTO syme31
EXIT DO
CASE ELSE
BEEP

END SELECT

syme32:
IF valtouche = 71 OR valtouche = 73 OR valtouche = 79 OR valtouche = 81 OR valtouche = 8 OR valtouche = 83 OR valtouche = gauche OR valtouche = droite OR valtouche = haut OR valtouche = bas THEN
PSET (x, y), rougeclair
x = xx: y = yy
GOSUB syme2
END IF

LOOP

RETURN

syme35:
flag = flag - 1
r$ = RIGHT$(reponse$, 1)
reponse$ = MID$(reponse$, 1, LEN(reponse$) - 1)
GOSUB syme2
IF r$ = "j" THEN
xx = x + 50: yy = y + 50
ELSEIF r$ = "k" THEN
xx = x - 50: yy = y + 50
ELSEIF r$ = "m" THEN
xx = x + 50: yy = yy - 50
ELSEIF r$ = "l" THEN
xx = x - 50: yy = yy - 50
END IF
LINE (x, y)-(xx, yy), bleu
RETURN

syme40:

IF ni = 1 THEN
w$ = "Avec les flèches " + CHR$(27) + " " + CHR$(26) + " " + CHR$(24) + " " + CHR$(25) + ", tu vas reproduire un chemin symétriquement."
z$ = "Tu peux corriger tes erreurs avec la touche " + CHR$(27) + "- ou la touche suppr."
CALL consigne(2, w$, z$, xx$)

ELSE
z$ = "reproduire un chemin symétriquement."
CALL claviernumerique(z$)
END IF

'exemple suivant niveau
SCREEN 9
CALL titre2(titr$)
LINE (320, 32)-(320, 278), blancbrill, , &HF0F0
choix = INT(RND * 5) + 1 + nombre
x = x(choix) + 20: y = y(choix) + 55
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(jaune) + dessin$(choix)
x = x2(choix) + 320: y = y2(choix) + 55
DRAW "TA0 B m=" + VARPTR$(x) + ",=" + VARPTR$(y)
DRAW "c=" + VARPTR$(vertclair) + dessin2$(choix)
CALL centre(23, jaune, "Regarde"): CALL getinvimouse(w)
RETURN


END SUB
 

 

Précédente Accueil Remonter Suivante