π
<-

Optimisation de code

Optimisation de code

Unread postby quentin974 » 30 Jan 2013, 18:04

Bonsoir

Après avoir trimé sur cet utilitaire, GEOGEBRA sur Z80 est enfin né. Mais son code n'est certainement pas optimisé, et comme je vois pas en quoi, je préfère m'en référer à des professionnels...

Mon code, le voici :
Code: Select all
:Degree
:GridOff
:PlotsOff
:FnOff
:Full
:ClrDraw
:AxesOff
:0→Xmin
:94→Xmax
:0→Ymax
:‾62→Ymin
:CoordOff
:Lbl D
:ClrHome
:Text(57,4,"A+
:Line(18,‾58,32,‾61
:Text(57,40,"FIG^ 
:Text(57,60,"OPT^
:Text(57,79,"MES^
:Goto 1
:ClrHome
:Lbl 1
:While 1
:getKey→K
:If K=11
:Then
:Input
:Pt-On(X,Y,3
:End
:If K=12
:Then
:Input
:Pt-On(X,Y,2
:X→A
:Y→B
:Input
:Line(A,B,X,Y
:Pt-On(X,Y,2
:End
:If K=13
:Then
:Menu("FIGURES","CERCLE",2,"TRIANGLE",3,"PARALLELE",7,"DROITE",8,"MILIEU",9,"PARALLELOGRAMME",50,"RETOUR",30
:Lbl 50
:Input
:X→A
:Y→B
:Pt-On(A,B
:Input
:X→C
:Y→D
:Line(A,B,C,D
:Input
:Line(C,D,X,Y
:Line(X,Y,X-(C-A),Y-(D-B)
:Line(A,B,X-(C-A),Y-(D-B)
:Goto D
:Lbl 9
:Input
:X→A
:Y→B
:Input
:(X+A)/2→X
:(Y+B)/2→Y
:Pt-On(X,Y,3)
:Goto D
:Lbl 8
:Input
:X→A
:Y→B
:Input
:(Y-B)/(X-A)→C
:Y-CX→B
:DrawF C(X)+B
:Goto D
:Lbl 7
:Input
:X→A
:Y→B
:Input
:X→C
:Y→D
:Input
:Pt-On(X,Y,2
:Pt-On(X+(C-A),Y+(D-B),2
:Line(X,Y,X+(C-A),Y+(D-B)
:Goto D
:Lbl 3
:Input
:Pt-On(X,Y,2
:X→A
:Y→B
:Input
:Pt-On(X,Y,2
:Line(A,B,X,Y
:X→C
:Y→D
:Input
:Pt-On(X,Y,2
:Line(A,B,X,Y
:Line(C,D,X,Y
:Goto D
:Lbl 2
:Input
:Pt-On(X,Y,3
:X→A
:Y→B
:Input
:Circle(A,B,√((X-A)²+(Y-B)²)
:Goto D
:End
:If K=15
:Then
:Menu("MESURES","LONGUEUR",20,"ANGLE",21,"RETOUR",30
:Lbl 21
:Input
:X→A
:Y→B
:Input
:√((X-A)²+(Y-B)²)→L
:X→C
:Y→D
:Input
:√((X-A)²+(Y-B)²)→H
:√((X-C)²+(Y-D)²)→M
:Disp "ANGLE°",cos<sup>-1</sup>((H²-M²-L²)/(‾2ML)
:Pause
:DispGraph
:Goto D
:Lbl 20
:Input
:X→A
:Y→B
:Input
:ClrHome
:Disp "LONGUEUR",√((X-A)²+(Y-B)²)
:Pause
:DispGraph
:Goto D
:End
:If K=14
:Then
:Menu("OPTIONS","OUVRIR",4,"SAUVER",5,"EFFACER",6,"QUITTER",10,"TEXTE",40,"RETOUR",30
:Lbl 40
:Input
:Input "TEXTE : ",Str1
:Text(‾Y,X,Str1
:Goto D
:Lbl 30
:Goto D
:Lbl 10
:Menu("SAUVER ?","OUI",55,"NON",56
:Lbl 55
:StorePic 9
:Goto 56
:Lbl 56
:ClrDraw
:ZStandard
:CoordOn
:AxesOn
:Disp
:Stop
:Lbl 4
:RecallPic 9
:Goto D
:Lbl 5
:StorePic 9
:Goto D
:Lbl 6
:prgmGEOGEBRA
:End
:End
:Goto 1


Une idée ?
Image

Cercle trigonométrique sur TI Nspire: archives_voir.php?id=9299
Thème modernity sur TI Nspire : archives_voir.php?id=9616
Maths générales pour z80 : archives_voir.php?id=9389
Géogebra pour z80 : archives_voir.php?id=10833
User avatar
quentin974
Niveau 11: LV (Légende Vivante)
Niveau 11: LV (Légende Vivante)
Level up: 0.4%
 
Posts: 260
Images: 7
Joined: 14 Nov 2012, 05:32
Location: Nice
Gender: Male
Calculator(s):
MyCalcs profile
Class: L1 de Physique

Re: Optimisation de code

Unread postby ticot » 30 Apr 2013, 15:27

Enlever les Goto et les Label :D
User avatar
ticot
Niveau 0: MI (Membre Inactif)
Niveau 0: MI (Membre Inactif)
Level up: 40%
 
Posts: 1
Joined: 30 Apr 2013, 15:24
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: Optimisation de code

Unread postby Bisam » 30 Apr 2013, 15:49

Bien tenté, ticot...
Mais à cause des "Menu", c'est impossible !
Par ailleurs, cela améliorerait peut-être la lisibilité mais pas les performances.

Il y a une toute petite amélioration possible : supprimer le Label 30 et modifier les menus pour qu'ils renvoient directement sur le label D et non sur le label 30.
User avatar
BisamAdmin
Niveau 15: CC (Chevalier des Calculatrices)
Niveau 15: CC (Chevalier des Calculatrices)
Level up: 69.6%
 
Posts: 5670
Joined: 11 Mar 2008, 00:00
Location: Lyon
Gender: Male
Calculator(s):
MyCalcs profile


Return to TI-Basic

Who is online

Users browsing this forum: ClaudeBot [spider] and 3 guests

-
Search
-
Social TI-Planet
-
Featured topics
Ndless for CX 4.5.5 / CX II 6.2.0
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
12345
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
2222 utilisateurs:
>2012 invités
>203 membres
>7 robots
Record simultané (sur 6 mois):
43991 utilisateurs (le 10/09/2025)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)