Poster un nouveau sujet Poster une réponse
PONG 2 joueurs pour 82 stats.fr
Auteur Message
thomas



Autorisation : Membre
Nb de messages : 1
Inscrit le : Sam 18 Jan 2014, 13:34
Posté le : Sam 18 Jan 2014, 13:45   Citer 

Bonjours à tous aujourd'hui je poste mon premier programme sur ce site il s'agit du célèbre jeu PONG en version 2 joueurs
C'est une version des plus basique, une amélioration sur le graph est en cours
Le code est assez long (1095 octets) mais je pense qu'il les vaut


Code
:4->Y:9 -> X:4 -> H
:4 -> L:4 -> Z:15 -> thêta
:¯1 -> D:0 -> E:0 -> O:0 -> P:4 -> R:¯1 -> N
:Repeat K=105
:   getKey -> K
:   Output(1,4,"PONG V1.1
:   Output(2,2,"PROGRAMMED BY
:   Output(3,6,"KLEIN
:   Output(4,3,"MOVES FOR P1
:   Output(5,2,"ln(  7  5  1
:   Output(6,3,"MOVES FOR P2
:   Output(7,4,"ARROWS
:   Output(8,2,"]
:   Output(8,15,"[
:   Output(8,R,"°
:   Output(8,R-N,"
:   R+N -> R
:   If R=3
:      1 -> N
:   If R=14
:      ¯1 -> N
:End
:ClrHome
:Repeat F>0
:   Input "SCORE TO WIN=",F
:End
:Lbl 1
:ClrHome
:0 -> E
:4 -> H:4 -> Z:4 -> Y
:Output(4,6,"READY?
:Pause
:ClrHome
:While 1
:   getKey -> K
:   Output(1,9,":
:   Output(2,9,":
:   Output(3,9,":
:   Output(4,9,":
:   Output(5,9,":
:   Output(6,9,":
:   Output(7,9,":
:   Output(8,1,"------
:   Output(8,7,O
:   Output(8,8,"-/-
:   Output(8,11,P
:   Output(8,12,"-----
:   If X <= 1:Then
:      ClrHome
:      Output(3,8,"P2
:      Output(5,6,"SCORED
:      Pause
:      P+1 -> P
:      If F=P
:         Goto 2
:      8 -> X
:      H -> Y
:      Goto 1
:   End
:   If X >= 16:Then
:      ClrHome
:      Output(3,8,"P1
:      Output(5,6,"SCORED
:      Pause
:      O+1 -> O
:      If O=F
:         Goto 2
:      10 -> X
:      Z -> Y
:      Goto 1
:   End
:   If Y=7
:      ¯1 -> E
:   If Y=1
:      1 -> E
:   X+D -> X
:   Y+E -> Y
:   Output(H,L,"]
:   Output(Z,thêta,"[
:   Output(Y,X,"°
:   Output(Y-E,X-D,"
:   If (X=L+1 or X=L) and Y=H
:   Then
:      1 -> D
:      randInt(1,3) -> S
:      If S=1
:         ¯1 -> E
:      If S=2
:         0 -> E
:      If S=3
:         1 -> E
:   End
:   If (X=thêta-1 or X=thêta) and Y=Z
:   Then
:      ¯1 -> D
:      randInt(1,3) -> S
:      If S=1
:         ¯1 -> E
:      If S=2
:         0 -> E
:      If S=3
:         1 -> E
:   End
:   If K - 0
:   Then
:      If K=45
:      Then
:         ClrHome
:         Stop
:      End
:      If K=81 and L >= 2
:      Then
:         L-1 -> L
:         Output(H,L+1,"
:      End
:      If K=72 and H >= 2
:      Then
:         H-1 -> H
:         Output(H+1,L,"
:      End
:      If K=92 and H <= 5
:      Then
:         H+1 -> H
:         Output(H-1,L,"
:      End
:      If K=83 and L <= 7
:      Then
:         L+1 -> L
:         Output(H,L-1,"
:      End
:      If K=24 and thêta >= 11:Then
:         thêta-1 -> thêta
:         Output(Z,thêta+1,"
:      End
:      If K=25 and Z >= 2
:      Then
:         Z-1 -> Z
:         Output(Z+1,thêta,"
:      End
:      If K=26 and thêta <= 15:Then
:         thêta+1 -> thêta
:         Output(Z,thêta-1,"
:      End
:      If K=34 and Z <= 6
:      Then
:         Z+1 -> Z
:         Output(Z-1,thêta,"
:      End
:   End
:End
:Lbl 2
:ClrHome
:Output(3,5,"P  WINS
:Output(4,4,"THIS GAME
:Output(6,6,O
:Output(6,8,"/
:Output(6,10,P
:If O=F
:   Output(3,6,1
:If P=F
:   Output(3,6,2


le rebond est aléatoire pour un peu plus de piment winkle.gif

 Adresse email Haut de page Bas de page 
 
Google_AdSense



Publicité    



 
linkakro



Autorisation : Membre
Nb de messages : 3738
Inscrit le : Lun 19 Oct 2009, 21:25
Posté le : Sam 18 Jan 2014, 17:47   Citer 

aide avec l'unicode
J'ai édité directement ton programme pour enlever ces fichus codes html.

----------------------
ti82statfr: 2008, inscrit: 2009, ti84pocketfr: noël2011, ti30xbmultiview: iut 2012-2014
Perfectionniste, manque tact. Pas le temps de tout publier depuis 2011. Répond toujours aux questions. (rédigé juin 2014)

Pour tout le monde et surtout les débutants, quelques-uns des articles courants :
*Traductions Algorithmie/Ti-Basic.
*Caractères spéciaux sur Tout82
Les défauts du TI-Basic : Goto_versus_algo et DelVar/End/Lbl/guillemet/store
 Adresse email Haut de page Bas de page 
 
Poster un nouveau sujet Poster une réponse





  Page générée en 6 requêtes