C'est SNKEmini!
La taille de ce jeu est super petite. 255, 241 198 195 181 180 octets!
Il est suffisamment petit pour tenir en mode RUN•MAT!
Il n'est pas nécessaire de créer un programme en mode PRGM pour le lancer.
Essayez de voir si vous pouvez réduire cette taille (sans supprimer aucune fonctionnalité)
Cliquez pour afficher le code
Cliquer pour enrouler
ClrText
4 -> Q~Y
{7, 21 -> Dim Mat A
Mat A -> Mat B
Do
If X = Q(Y = R :Then
Do
RanInt#(1, 7 -> R
RanInt#(1, 21 -> Q
LpWhile Mat A[R, Q
Locate Q, R, "●"
Else
Mat A[W, V
0 -> Mat A[W, V
Locate V, W, " "
Mat B[W, V -> W
Ans -> V
IfEnd
U
GetKey => 6 - 2MOD(GetKey, 4
U > 3 Xor Ans > 3 => Ans -> U
X
Y -> T
U > 3 => 1 + MOD(Y - U + 4, 7 -> Y
U < 3 => 1 + MOD(X - U, 21 -> X
Locate X, Y, "O
X -> Mat A[T, Ans
Y -> Mat B[T, Ans
LpWhile 0 = Mat A[Y, X
Cette version est plus grande car elle a plus de fonctionnalités
La taille est de 241 octets
Enveloppe d'écran
La 'pomme' ne se pose jamais sur le serpent
Les O sont utilisés pour le corps et la pomme est un ●
Vous ne pouvez pas vous tuer en reculant
Essayez de le rendre le plus petit possible, tout en le rendant jouable!
Cliquez pour afficher le code 181 bytes
Cliquer pour enrouler 181 bytes
ClrText
6 → Q~Y
{21, 7 → Dim Mat A
Do
If X = Q(Y = R :Then
RanInt#(1, 7 → R
RanInt#(1, 21 → Q
Else
Mat A[V, W
0 -> Mat A[V, W
Locate V, W, " "
ReP Ans → V
ImP Ans → W
IfEnd
Locate Q, R, 8
GetKey ⇒ 4GetKey Rmdr 8 → U
X : Y → T
U > 3 ⇒ X + U - 5 → X
U < 3 ⇒ Y + U - 1 → Y
Locate X, Y, 0
X + Yi → Mat A[Ans, T
LpWhile Not Mat A[X, Y
Cliquez pour afficher le code 195 bytes
Cliquer pour enrouler 195 bytes
ClrText
6 -> Q~Y
{14, 21 -> Dim Mat A
Do
If X = Q(Y = R :Then
RanInt#(1, 7 -> R
RanInt#(1, 21 -> Q
Else
Mat A[W, V
0 -> Mat A[W, V
Locate V, W, " "
Mat A[W+7, V -> W
Ans -> V
IfEnd
Locate Q, R, 8
GetKey => 2MOD(GetKey, 4 -> U
X
Y -> T
U < 3 => Y + U - 1 -> Y
U > 3 => X + U - 5 -> X
Locate X, Y, 0
X -> Mat A[T, Ans
Y -> Mat A[T+7, Ans
LpWhile Not Mat A[Y, X
Cette version a été faite pour être aussi petite que possible (tout en restant jouable)
La taille est 198 195 181 octets (180 octets si vous utilisez l'opérateur binaire Not de C.Basic ou Base Mode)
Frapper le bord de l'écran va vous tuer
Revenir sur vous-même vous tuera
Courir en toi va te tuer
Le corps est composé de 0's et la pomme est un 8
English description:
This is SNKEmini!
The size of this game is super small. 255, 214 198 195 180 Bytes!
It's small enough to fit inside RUN•MAT mode!
You don't have to make a program in PRGM mode to trun it
Try see if you can this smaller (without removing any features)
Click to show code 241bytes
Click to hide code 241bytes
ClrText
4 -> Q~Y
{7, 21 -> Dim Mat A
Mat A -> Mat B
Do
If X = Q(Y = R :Then
Do
RanInt#(1, 7 -> R
RanInt#(1, 21 -> Q
LpWhile Mat A[R, Q
Locate Q, R, "●"
Else
Mat A[W, V
0 -> Mat A[W, V
Locate V, W, " "
Mat B[W, V -> W
Ans -> V
IfEnd
U
GetKey => 6 - 2MOD(GetKey, 4
U > 3 Xor Ans > 3 => Ans -> U
X
Y -> T
U > 3 => 1 + MOD(Y - U + 4, 7 -> Y
U < 3 => 1 + MOD(X - U, 21 -> X
Locate X, Y, "O
X -> Mat A[T, Ans
Y -> Mat B[T, Ans
LpWhile 0 = Mat A[Y, X
This version is bigger because it has more features
Size is 241 bytes
Screen Wrap
The 'apple' never gets placed on the Snake
O's are used for the body and the apple is a ●
You can't insta kill yourself by going backwards
Try making this as small as possible, while still keeping it playable!
Click to show code 181 bytes
Click to hide code 181 bytes
ClrText
6 → Q~Y
{21, 7 → Dim Mat A
Do
If X = Q(Y = R :Then
RanInt#(1, 7 → R
RanInt#(1, 21 → Q
Else
Mat A[V, W
0 -> Mat A[V, W
Locate V, W, " "
ReP Ans → V
ImP Ans → W
IfEnd
Locate Q, R, 8
GetKey ⇒ 4GetKey Rmdr 8 → U
X : Y → T
U > 3 ⇒ X + U - 5 → X
U < 3 ⇒ Y + U - 1 → Y
Locate X, Y, 0
X + Yi → Mat A[Ans, T
LpWhile Not Mat A[X, Y
Click to show code 195 bytes
Click to hide code 195 bytes
ClrText
6 -> Q~Y
{14, 21 -> Dim Mat A
Do
If X = Q(Y = R :Then
RanInt#(1, 7 -> R
RanInt#(1, 21 -> Q
Else
Mat A[W, V
0 -> Mat A[W, V
Locate V, W, " "
Mat A[W+7, V -> W
Ans -> V
IfEnd
Locate Q, R, 8
GetKey => 2MOD(GetKey, 4 -> U
X
Y -> T
U < 3 => Y + U - 1 -> Y
U > 3 => X + U - 5 -> X
Locate X, Y, 0
X -> Mat A[T, Ans
Y -> Mat A[T+7, Ans
LpWhile Not Mat A[Y, X
This version was made to be as small as possible (while still being playable)
Size is 198 195 181 bytes (180 bytes if you use the binary operator Not from C.Basic or Base Mode)
Hitting the edge of the screen will kill you
Going backwards on yourself will kill you
Running into yourself will kill you
The body is made of 0's and the apple is an 8
Do
Getkey
LpWhile Ans!=27
{21,7->Dim Mat A
{21,7->Dim Mat B
1->A~Z
0->P~Q
Do
Getkey
Ans=>Ans->K
X->T
Y->U
K=38=>Dsz X
K=27=>Isz X
K=28=>Dsz Y
K=37=>Isz Y
X->Mat A[T,U
Y->Mat B[T,U
Locate X,Y,0
If X=P And Y=Q Or Not PQ
Then RanInt#(1,21->P
RanInt#(1,7->Q
Else Mat A[L,M->N
0->Mat A[L,M
Locate L,M," "
Mat B[L,M->M
N->L
IfEnd
Locate P,Q,1
LpWhile Not Mat A[X,Y
264 octets avec le titre du programme, soit 232 octets de code !
I was able to shave off 3 bytes
198 to 195 bytes
by removing the initialization of Mat A → Mat B (-8 bytes)
and instead just making {7, 21 -> Dim Mat A twice the size. changing 7 to 14 (+1 byte)
then just indexing +7 into Mat A Mat B[W, V -> W to Mat A[W+7, V -> W (+2 bytes) Y -> Mat B[T, Ans to Y -> Mat A[T+7, Ans (+2 bytes)
was able to shave off another 15 bytes by using complex numbers Rmdr and the binary operator Not
instead of saving X and Y separately to the matrix
X -> Mat A[T, Ans
Y -> Mat A[T+7, Ans
why not just combine them and perform one save
X + Yi → Mat A[Ans, T
+ Yi is +4 bytes
but the savings from removing the 2nd line is -12 bytes
also reading from the matrix becomes smaller
Mat A[W, V
Mat A[W+7, V -> W
Ans -> V
Rep and ImP sadly are both 2 bytes. +4bytes
but not needing to read the matrix twice gives us -9bytes
Mat A[V, W
ReP Ans → V
ImP Ans → W
A Rmdr B for postive numbers performs exactly the same as Mod(A,B)
except we don't need the comma , or ending bracket ) Rmdr and Mod are both 2 bytes each 2MOD(GetKey, 4 to 2GetKey Rmdr 8 -1 byte
yesterday I found out about the binary operator Not
not to be confused with the logical operator Not
you can obtain it via C.Basic or using an external program and extracting it from a Base Mode program (press [F2] (BASE) while creating a new basic program)
it is only 1byte compared to 2bytes. -1 byte
sadly it is noticeably much slower than the normal Not operator
Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd