So far, I have modified the Nibbles game (works correctly, no errors) so it exits outside the program, instead of inside the program.
Original code:
Code:
Modified Code:
Code:
The only problem is that makes the game slower. If you were to run the original game and this game back-to-back, you can definitely tell a difference. Is there a faster way to do this so it doesn't affect performance? There are no memory leaks in this program. (This is programmed in Source Coder 3 on Cemetech, so ignore if some parts of the code if it looks funny. ~'s are negatives, and -> is the Store (→) character. theta is θ)
Original code:
Code:
AxesOff:FnOff
ClrDraw
ZStandard
104→Xmax
⁻72→Ymin
ZInteger
Line(94,0,94,⁻61
Line(0,0,0,⁻61
Horizontal 0
Horizontal ⁻61
41→A:Ans→E
29→B:Ans→F
1→H:0→V
5→S:0→θ
Pt-On(41,⁻29,2
Repeat not(pxl-Test(N-1,M-1
2+3int(31rand→M
2+3int(20rand→N
End
Pt-On(M,⁻N,2
Pt-Off(M,⁻N,3
Pxl-On(N,M
Repeat 0
getKey→K
If Ans:Then
If H:Then
(Ans=34)-(Ans=25→V
If Ans
0→H
Else
(Ans=26)-(Ans=24→H
If Ans
0→V
End
End
If H:Then
A+3H→A
If pxl-Test(B,Ans-H)
Then
Text(27,34,"SCORE:",θ
Return
End
Pt-On(Ans,⁻B,2
Pxl-Off(B,Ans-H
Pxl-Off(B,Ans-2H
Else
B+3V→B
If pxl-Test(Ans-V,A:Then
Text(27,34,"SCORE:",θ
Return
End
Pt-On(A,⁻Ans,2
Pxl-Off(Ans-V,A
Pxl-Off(Ans-2V,A
End
If pxl-Test(B,A
Then
Pxl-Off(B,A
Repeat not(pxl-Test(N-1,M-1
2+3int(31rand→M
2+3int(20rand→N
End
Pt-On(M,⁻N,2
Pt-Off(M,⁻N,3
Pxl-On(N,M
If θ=95:Then
Text(27,34,"WIN.
Return
End
Pxl-On(62,θ
1+θ→θ
S+3→S
End
If S:Then
S-1→S:Else
pxl-Test(F,E-1)-pxl-Test(F,E+1
If Ans:Then
Pxl-On(F,E+2Ans
Pt-Off(E,⁻F,2
E+3Ans→E
Else
1-2pxl-Test(F+1,E
Pxl-On(F+2Ans,E
Pt-Off(E,⁻F,2
F+3Ans→F
End
End
End
Modified Code:
Code:
ClrDraw
ZStandard
104->Xmax
~72->Ymin
ZInteger
real(12,3,0,0,94,61,1
41->A:Ans->E
29->B:Ans->F
1->H:0->V
5->S:0->theta
0->D
Pt-On(41,~29,2
Repeat not(pxl-Test(N-1,M-1
2+3int(31rand->M
2+3int(20rand->N
End
Pt-On(M,~N,2
Pt-Off(M,~N,3
Pxl-On(N,M
Repeat D or K=45
getKey->K
If Ans:Then
If H:Then
(Ans=34)-(Ans=25->V
If Ans
0->H
Else
(Ans=26)-(Ans=24->H
If Ans
0->V
End
End
If H:Then
A+3H->A
If pxl-Test(B,Ans-H
1->D
A
Pt-On(Ans,~B,2
Pxl-Off(B,Ans-H
Pxl-Off(B,Ans-2H
Else
B+3V->B
If pxl-Test(Ans-V,A:1->D
B
Pt-On(A,~Ans,2
Pxl-Off(Ans-V,A
Pxl-Off(Ans-2V,A
End
If D
Goto SQ
If pxl-Test(B,A:Then
Pxl-Off(B,A
Repeat not(pxl-Test(N-1,M-1
2+3int(31rand->M
2+3int(20rand->N
End
Pt-On(M,~N,2
Pt-Off(M,~N,3
Pxl-On(N,M
Pxl-On(62,theta
theta+1->theta
If Ans=95
1->D
S+3->S
End
If D
Goto SQ
If S:Then
S-1->S:Else
pxl-Test(F,E-1)-pxl-Test(F,E+1
If Ans:Then
Pxl-On(F,E+2Ans
Pt-Off(E,~F,2
E+3Ans->E
Else
1-2pxl-Test(F+1,E
Pxl-On(F+2Ans,E
Pt-Off(E,~F,2
F+3Ans->F
End:End
Lbl SQ:End
The only problem is that makes the game slower. If you were to run the original game and this game back-to-back, you can definitely tell a difference. Is there a faster way to do this so it doesn't affect performance? There are no memory leaks in this program. (This is programmed in Source Coder 3 on Cemetech, so ignore if some parts of the code if it looks funny. ~'s are negatives, and -> is the Store (→) character. theta is θ)