π
<-

Trouve le nombre amélio et opti

Trouve le nombre amélio et opti

Unread postby Commando12345 » 28 Sep 2015, 22:26

voilà un petit jeu pour 83 PCE programmé on calc j'aimera avoir votre avis et de l'aide pour l'opti :D (et comment l'ameliorer)

Code: Select all
Lbl X
EffÉcran
DelVar PDelVar YDelVar ZDelVar SDelVar MDelVar ADelVar T
14→X
5000→V
Menu("TROUVE LE NOMBRE","NORMAL(0-5000)",1,"VIES LIMITEES",2,"PERSONALISE",3,"QUITTER",θ
Lbl 3
2→T
Disp "NOMBRE MAXIMUM?"
Input "",V
Menu("VIES","VIES ILLIMITEES",1,"VIES PERSO",B
Lbl 2
1→T
Lbl B
EffÉcran
Disp "NOMBRE DE VIES
Input "",X
X→A
Lbl 1
nbrAléatEnt(0,V→Z
EffÉcran
Disp "QUEL EST LE NOMBRE?
Input "",Y
While Y≠Z
If Y<Z
Disp "TROP PETIT!
If Y>Z
Disp "TROP GRAND!
S+1→S
If S=A et (Y>Z  ou Y<Z)
Then
EffÉcran
Output(5,9,"GAME OVER
1→P
Goto A
End
Input "",Y
End
If Y=Z
Then
EffÉcran
Output(4,7,"TU AS GAGNE EN
Output(5,10,S+1
Output(5,13,"COUPS
End
Lbl A
If S≥⌊NMBR(1) et non(T
Then
Output(7,7,"HIGH SCORE:
Output(7,19,⌊NMBR(1
Goto Z
End
If S<⌊NMBR(1) et non(T
Then
Output(7,6,"NOUVEAU RECORD:
S+1→⌊NMBR(1
Output(7,21,⌊NMBR(1
Goto Z
End
If S≥⌊NMBR(2) ou P=1 et T=1
Then
Output(7,7,"RECORD:
Output(7,19,⌊NMBR(2
Goto Z
End
If S<⌊NMBR(2) et T=1 et non(P
Then
Output(7,6,"NOUVEAU RECORD:
S+1→⌊NMBR(2
Output(7,21,⌊NMBR(2
Goto Z
End
If S≥⌊NMBR(3) ou P=1 et T=2
Then
Output(7,7,"RECORD:
Output(7,19,⌊NMBR(3
Goto Z
End
If S<⌊NMBR(3) et T=2 et non(P
Then
Output(7,6,"NOUVEAU RECORD:
S+1→⌊NMBR(3
Output(7,21,⌊NMBR(3
End
Lbl Z
Pause
Goto X
Lbl θ
EffÉcran
Fin

*petit édit
You do not have the required permissions to view the files attached to this post.
Last edited by Commando12345 on 30 Sep 2015, 17:20, edited 15 times in total.
User avatar
Commando12345Premium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 84.4%
 
Posts: 42
Joined: 03 Aug 2015, 18:20
Location: près de Paris
Gender: Male
Calculator(s):
MyCalcs profile
Class: Master 1 Ecole d'ingé Aéronautique et Spatial

Online

Re: Trouve le nombre amélio et opti

Unread postby noelnadal » 28 Sep 2015, 22:32

Remplace les 0->V par des Delvar V
Ne ferme pas les guillemets à la fin des Disp.
Remplace T=0 par non(T sans la parenthèse à la fin.
idem pour nbrAléatEnt(0,V)→Z à remplace par nbrAléatEnt(0,V→Z

Après, les Goto/Lbl, j'aime moyennement, mais bon...
User avatar
noelnadalEcrivain
Niveau 17: GM (Grand Maître des calculatrices)
Niveau 17: GM (Grand Maître des calculatrices)
Level up: 40%
 
Posts: 2269
Images: 0
Joined: 10 Mar 2011, 00:00
Location: France, Melun (77)
Gender: Male
Calculator(s):
MyCalcs profile
Class: INRIA Paris
Twitter: nadalnoel
Facebook: noel.nadal1
GitHub: noelnadal

Re: Trouve le nombre amélio et opti

Unread postby Hamza.S » 29 Sep 2015, 10:51

Code: Select all
Menu("VIES","VIES ILLIMITEES",1,"VIES PERSO",B
Lbl B
EffÉcran
Disp "NOMBRE DE VIES" // utilisé un peu plus bas
Input "",X  // idem
Goto S  // inutile
Lbl 2
1→T
Disp "NOMBRE DE VIES
Input "",X
Lbl S  // inutile sauf si un autre Goto l'utilise
// j'ai pas lu tout le code pour le moment

tu répètes la même chose presque inutilement, pour l'améliorer tu peux faire
Code: Select all
Menu("VIES","VIES ILLIMITEES",1,"VIES PERSO",B
Lbl 2
1→T
Lbl B
EffÉcran
Disp "NOMBRE DE VIES
Input "",X


une question : classes-tu le score en fonction du nombre de coups?
Image
User avatar
Hamza.SAdmin
Niveau 17: GM (Grand Maître des calculatrices)
Niveau 17: GM (Grand Maître des calculatrices)
Level up: 29.3%
 
Posts: 4512
Images: 18
Joined: 07 Nov 2014, 00:43
Gender: Male
Calculator(s):
MyCalcs profile

Re: Trouve le nombre amélio et opti

Unread postby Hamza.S » 29 Sep 2015, 11:50

pensez-vous que cette boucle peut remplacer le début du boucle While?
je l'ai fait sans réfléchir
Code: Select all
Lbl 1
randInt(0,V→Z
ClrHome
For (I,1,A)
Disp "QUEL EST LE NOMBRE?
Input "",Y
S+1→S
If Y<Z
Disp "TROP PETIT!
If Y>Z
Disp "TROP GRAND!
If Y=Z
Then
EffÉcran
Output(4,7,"TU AS GAGNE EN
Output(5,10,S
Output(5,13,"COUPS
End
If S=A and (Y>Z or Y>Z)
Then
Output(5,9,"GAME OVER
1→P
End
...
End
Image
User avatar
Hamza.SAdmin
Niveau 17: GM (Grand Maître des calculatrices)
Niveau 17: GM (Grand Maître des calculatrices)
Level up: 29.3%
 
Posts: 4512
Images: 18
Joined: 07 Nov 2014, 00:43
Gender: Male
Calculator(s):
MyCalcs profile

Re: Trouve le nombre amélio et opti

Unread postby GalacticPirate » 29 Sep 2015, 12:04

Bon, j'ai fait de l'opti : fusion des Lbl 2 et Lbl B, et par conséquent suppression du Lbl S qui ne servait donc plus à rien. J'ai aussi viré le dernier Goto Z inutile. Bref, aux codeurs, dites moi ce que vous en pensez :
Code: Select all
Lbl X
EffÉcran
DelVar PDelVar YDelVar ZDelVar SDelVar MDelVar ADelVar T
14→X
"BLA→Str1
5000→V
Menu("TROUVE LE NOMBRE","NORMAL(0-5000)",1,"VIES LIMITEES",2,"PERSONALISE",3,"QUITTER",θ
Lbl 3
2→T
Disp "NOMBRE MAXIMUM?"
Input "",V
Menu("VIES","VIES ILLIMITEES",1,"VIES PERSO",B
Lbl 2
1→T
Lbl B
EffÉcran
Disp "NOMBRE DE VIES
Input "",X
X→A
Lbl 1
nbrAléatEnt(0,V→Z
EffÉcran
Disp "QUEL EST LE NOMBRE?
Input "",Y
While Y≠Z
If Y<Z
Disp "TROP PETIT!
If Y>Z
Disp "TROP GRAND!
S+1→S
If S=A
Then
EffÉcran
Output(5,9,"GAME OVER
1→P
Goto A
End
Input "",Y
End
If Y=Z
Then
EffÉcran
Output(4,7,"TU AS GAGNE EN
Output(5,10,S+1
Output(5,13,"COUPS
End
Lbl A
If S≥⌊NMBR(1) et non(T
Then
Output(7,7,"HIGH SCORE:
Output(7,19,⌊NMBR(1
Goto Z
End
If S<⌊NMBR(1) et non(T
Then
Output(7,6,"NEW HIGH SCORE:
S+1→⌊NMBR(1
Output(7,21,⌊NMBR(1
Goto Z
End
If S≥⌊NMBR(2) ou P=1 et T=1
Then
Output(7,7,"HIGH SCORE:
Output(7,19,⌊NMBR(2
Goto Z
End
If S<⌊NMBR(2) et T=1 et non(P
Then
Output(7,6,"NEW HIGH SCORE:
S+1→⌊NMBR(2
Output(7,21,⌊NMBR(2
Goto Z
End
If S≥⌊NMBR(3) ou P=1 et T=2
Then
Output(7,7,"HIGH SCORE:
Output(7,19,⌊NMBR(3
Goto Z
End
If S<⌊NMBR(3) et T=2 et non(P
Then
Output(7,6,"NEW HIGH SCORE:
S+1→⌊NMBR(3
Output(7,21,⌊NMBR(3
End
Lbl Z
Pause
Goto X
Lbl θ
EffÉcran
Fin
Mon profil TI-PlanetDevenez premium !
ImageImage
Modérateur de TI-Planet.org depuis décembre 2015, et membre de la communauté depuis Mai 2015.Cliquez ci-dessus pour faire un don à TI-Planet.org via PayPal et devenir Donateur ou Premium (à partir de 3€) ! Vous aurez accès à des générations illimitées et prioritaires avec Mviewer GX Creator, ainsi qu'au forum secret ! :bj: En plus, vous pourrez être orange sur le chat :troll:

Image
User avatar
GalacticPirateModo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 1.3%
 
Posts: 1156
Images: 2
Joined: 23 May 2015, 10:36
Location: Hauts-de-Seine, France
Gender: Male
Calculator(s):
MyCalcs profile
Class: M2

Online

Re: Trouve le nombre amélio et opti

Unread postby noelnadal » 29 Sep 2015, 12:38

Tu peux remplaçer "HIGH SCORE" par "RECORD", ça te fait gagner des octets. :P
User avatar
noelnadalEcrivain
Niveau 17: GM (Grand Maître des calculatrices)
Niveau 17: GM (Grand Maître des calculatrices)
Level up: 40%
 
Posts: 2269
Images: 0
Joined: 10 Mar 2011, 00:00
Location: France, Melun (77)
Gender: Male
Calculator(s):
MyCalcs profile
Class: INRIA Paris
Twitter: nadalnoel
Facebook: noel.nadal1
GitHub: noelnadal

Re: Trouve le nombre amélio et opti

Unread postby Ti64CLi++ » 29 Sep 2015, 12:47

Et remplacer TROP GROS par - et TROP PETIT par + :troll:
Image
User avatar
Ti64CLi++Modo
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 32.5%
 
Posts: 3446
Images: 75
Joined: 04 Jul 2014, 14:40
Location: Clermont-Ferrand 63
Gender: Male
Calculator(s):
MyCalcs profile
Class: ENS Rennes
GitHub: Ti64CLi

Online

Re: Trouve le nombre amélio et opti

Unread postby noelnadal » 29 Sep 2015, 13:42

Non mais, vive le français, quoi... :P
User avatar
noelnadalEcrivain
Niveau 17: GM (Grand Maître des calculatrices)
Niveau 17: GM (Grand Maître des calculatrices)
Level up: 40%
 
Posts: 2269
Images: 0
Joined: 10 Mar 2011, 00:00
Location: France, Melun (77)
Gender: Male
Calculator(s):
MyCalcs profile
Class: INRIA Paris
Twitter: nadalnoel
Facebook: noel.nadal1
GitHub: noelnadal

Re: Trouve le nombre amélio et opti

Unread postby Commando12345 » 30 Sep 2015, 17:22

Je l'ai opti (édit du 1er post) encore quelque chose à faire ?
Image
User avatar
Commando12345Premium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 84.4%
 
Posts: 42
Joined: 03 Aug 2015, 18:20
Location: près de Paris
Gender: Male
Calculator(s):
MyCalcs profile
Class: Master 1 Ecole d'ingé Aéronautique et Spatial


Return to TI-Basic

Who is online

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

-
Search
-
Social TI-Planet
-
Featured topics
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 !
1234
-
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.
3210 utilisateurs:
>3191 invités
>11 membres
>8 robots
Record simultané (sur 6 mois):
29271 utilisateurs (le 11/07/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)