Thanks for the compliments Smile

And you're more than welcome to poke around in the code if you like. I still have a bit of work to accomplish to it before it's playable, like rewriting the movement and rotation code. I think that's one of my biggest obstacles for BTetris now.


So, this at least shows off trying to hit up the multiple lines. It has an alignment issue with going down one line before it does what it needs to do.


Code:
:DCS
"0000005500000000000000550000000000000055000000000000005500000000000000550000000000000055000000000000005500000000000000550000000077777700000011007777770000001100774444000022111177444400002211116644440022223311664444002222331166666600223333336666660022333333
ClrDraw:AxesOff
2->W:1->D:5->C:1->V:2->T:1->U:0->P:1->theta
randInt(10,16->E
1+(E/|E2->E
0->Xmin:0->Ymin
264->Xmax:164->Ymax
Text(~1,1,91,"BTetris
Line(114,54,114,117,2,12
Line(148,54,148,117,2,12
Line(116,52,147,52,2,12
Line(116,119,147,119,2,12
{22,10->dim([A]
Fill(0,[A]
D->G
While W=2
getKey->K
If max(K={24,26,21,31:Then
Pt-Off((115+C*3)+L1(1),(115-(D-1)*3)-L1(2),1
Pt-Off((115+C*3)+L1(3),(115-(D-1)*3)-L1(4),1
Pt-Off((115+C*3)+L1(5),(115-(D-1)*3)-L1(6),1
Pt-Off((115+C*3)+L1(7),(115-(D-1)*3)-L1(8),1
End
C-((K=24 and C>1)-(K=26 and C+A<10->C
If F!=C:C->F
V-(C+(A-1(A=2)+2(A=0)-2(A=3))<10)((K=31 and V>0)-(K=21 and V<5->V
If V=0:4->V
If V=5:1->V
If K=21 or K=31:1->theta
If K=105:Then
Text(150,110,"Paused
Pause
Text(150,110,"                         
0->T:End
If K=22:Then
DelVar [A]DelVar WDelVar L1DelVar |LADelVar |LBDelVar |LCDelVar |LD
ClrDraw:Disp :Return:End
If theta=1:Then
If |E2fPart(E)=10:Then
If V=1 or V=2:{3,0,6,0,0,3,3,3->L1
If V=3 or V=4:{0,0,0,3,3,3,3,6->L1
End
If |E2fPart(E)=11:Then
If V=1 or V=3:{0,0,3,0,3,3,6,3->L1
If V=2 or V=4:{3,0,3,3,0,3,0,6->L1
End
If |E2fPart(E)=12:Then
If V=1:{3,0,0,3,3,3,6,3->L1
If V=2:{0,0,0,3,0,6,3,3->L1
If V=3:{0,0,3,0,6,0,3,3->L1
If V=4:{3,0,3,3,3,6,0,3->L1
End
If |E2fPart(E)=13:Then
If V>0 and V<5:{0,0,3,0,3,3,0,3->L1
End
If |E2fPart(E)=14:Then
If V=1 or V=3:{0,0,3,0,6,0,9,0->L1
If V=2 or V=4:{0,0,0,3,0,6,0,9->L1
End
If |E2fPart(E)=15:Then
If V=1:{0,0,0,3,3,3,6,3->L1
If V=2:{0,0,3,0,0,3,0,6->L1
If V=3:{0,0,3,0,6,0,6,3->L1
If V=4:{3,0,3,3,3,6,0,6->L1
End
If |E2fPart(E)=16:Then
If V=1:{0,3,3,3,6,3,6,0->L1
If V=2:{0,0,0,3,0,6,3,6->L1
If V=3:{0,0,3,0,6,0,0,3->L1
If V=4:{0,0,3,0,3,3,3,6->L1
End
|E2fPart(E->Z
If max(Z={10,11,12,15,16:Then
If V=1 or V=3:Then:2->A:1->B:End
If V=2 or V=4:Then:1->A:2->B:End:End
If Z=13:Then:1->A:1->B:End
If Z=14:Then
If V=1 or V=3:Then:3->A:0->B:End
If V=2 or V=4:Then:0->A:3->B:End
End
0->theta
End
If D=G:Then
Pt-On((115+C*3)+L1(1),(115-(D-1)*3)-L1(2),1,|E2fPart(E
Pt-On((115+C*3)+L1(3),(115-(D-1)*3)-L1(4),1,|E2fPart(E
Pt-On((115+C*3)+L1(5),(115-(D-1)*3)-L1(6),1,|E2fPart(E
Pt-On((115+C*3)+L1(7),(115-(D-1)*3)-L1(8),1,|E2fPart(E
End
If T>U:Then
D+1->D
If D+B=21 or iPart([A](D+(L1(2)/3)+1,C+(L1(1)/3)))=1 or iPart([A](D+(L1(4)/3)+1,C+(L1(3)/3)))=1 or iPart([A](D+(L1(6)/3)+1,C+(L1(5)/3)))=1 or iPart([A](D+(L1(8)/3)+1,C+(L1(7)/3)))=1:Then
E->[A](D+(L1(2)/3),C+(L1(1)/3
E->[A](D+(L1(4)/3),C+(L1(3)/3
E->[A](D+(L1(6)/3),C+(L1(5)/3
E->[A](D+(L1(8)/3),C+(L1(7)/3
Matr>list([A]^^T,D,|LA
If D+1<=21:Matr>list([A]^^T,D+1,|LB
If D+2<=21:Matr>list([A]^^T,D+2,|LC
If D+3<=21:Matr>list([A]^^T,D+3,|LD
If sum(iPart(|LA))=10:Then
0->L
For(O,1,10
Pt-Off(115+O*3,(115-(D-1)*3),1
0->[A](D-1,O
End
End
If D+1<=21:Then
If sum(iPart(|LB))=10:Then
1->L
For(O,1,10
Pt-Off(115+O*3,(115-D*3),1
0->[A](D,O
End
End:End
If D+2<=21:Then
If sum(iPart(|LC))=10:Then
2->L
For(O,1,10
Pt-Off(115+O*3,(115-(D+1)*3),1
0->[A](D+1,O
End
End:End
If D+3<=21:Then
If sum(iPart(|LD))=10:Then
3->L
For(O,1,10
Pt-Off(115+O*3,(115-(D+2)*3),1
0->[A](D+2,O
End
End:End
1->D:5->C:1->V:1->P:1->theta
S+1->S
randInt(10,16->E
1+(E/|E2->E
End

End
If P=0 and D!=G:Then
Pt-Off((115+F*3)+L1(1),(115-(G-1)*3)-L1(2),1
Pt-Off((115+F*3)+L1(3),(115-(G-1)*3)-L1(4),1
Pt-Off((115+F*3)+L1(5),(115-(G-1)*3)-L1(6),1
Pt-Off((115+F*3)+L1(7),(115-(G-1)*3)-L1(8),1
D->G
End
If P=1:D->G
0->P
End:"W=2


For your viewing pleasure so far, I guess?
Whoa, it computes that super-fast. Very impressive work, tifreak8x; I'm thrilled to see how far you've gotten with this without it getting bogged down in the logic mess I found myself in. I hope you keep it up.
Thanks Kerm Smile

The line checking bit is down near the end of the program, the 4 lines of Matrix>List( stuff. I just have to make it start clearing the proper lines Smile
Wow this is looking awesome tifreak!
Thanks tr1p1ea! Smile I hope to be able to keep up the level of quality by the time it is 'finished'
Wow, I'm very impressed! Nice work tifreak. Maybe you should backport it to the black and white calculators. I bet it will be even faster with the lower-resolution screen!
Thanks elfprince! Very Happy I have actually given some thought to doing just that once this version is 100% operational, just for fun.

On a side note, I moved D+1->D to the end of the conditional block it is in, and it has fixed all alignment issues regarding pieces hitting the bottom, and fixed erasing lines! Very Happy I only did it on a single line erasure, I'll try to play it more in a while to see if it does multi. Then it will be time to make straggling pieces fall from above.

Edit:

First attempts to make the pieces fall after a line is cleared has gone less than successful, I believe my idea for showing how many lines are cleared is a bit flawed and needs to be rethought.


On the right track!

Code:
:DCS
"0000005500000000000000550000000000000055000000000000005500000000000000550000000000000055000000000000005500000000000000550000000077777700000011007777770000001100774444000022111177444400002211116644440022223311664444002222331166666600223333336666660022333333
ClrDraw:AxesOff
2->W:1->D:5->C:1->V:2->T:1->U:0->P:1->theta
randInt(10,16->E
1+(E/|E2->E
0->Xmin:0->Ymin
264->Xmax:164->Ymax
Text(~1,1,91,"BTetris
Line(114,54,114,117,2,12
Line(148,54,148,117,2,12
Line(116,52,147,52,2,12
Line(116,119,147,119,2,12
{21,10->dim([A]
Fill(0,[A]
D->G
While W=2
getKey->K
If max(K={24,26,21,31:Then
Pt-Off((115+C*3)+L1(1),(115-(D)*3)-L1(2),1
Pt-Off((115+C*3)+L1(3),(115-(D)*3)-L1(4),1
Pt-Off((115+C*3)+L1(5),(115-(D)*3)-L1(6),1
Pt-Off((115+C*3)+L1(7),(115-(D)*3)-L1(8),1
End
C-((K=24 and C>1)-(K=26 and C+A<10->C
If F!=C:C->F
V-(C+(A-1(A=2)+2(A=0)-2(A=3))<10)((K=31 and V>0)-(K=21 and V<5->V
If V=0:4->V
If V=5:1->V
If K=21 or K=31:1->theta
If K=105:Then
Text(150,110,"Paused
Pause
Text(150,110,"                         
End
If K=22:Then
DelVar [A]DelVar WDelVar L1DelVar |LADelVar |LBDelVar |LCDelVar |LD
ClrDraw:Disp :Return:End
If theta=1:Then
If |E2fPart(E)=10:Then
If V=1 or V=3:{3,0,6,0,0,3,3,3->L1
If V=2 or V=4:{0,0,0,3,3,3,3,6->L1
End
If |E2fPart(E)=11:Then
If V=1 or V=3:{0,0,3,0,3,3,6,3->L1
If V=2 or V=4:{3,0,3,3,0,3,0,6->L1
End
If |E2fPart(E)=12:Then
If V=1:{3,0,0,3,3,3,6,3->L1
If V=2:{0,0,0,3,0,6,3,3->L1
If V=3:{0,0,3,0,6,0,3,3->L1
If V=4:{3,0,3,3,3,6,0,3->L1
End
If |E2fPart(E)=13:Then
If V>0 and V<5:{0,0,3,0,3,3,0,3->L1
End
If |E2fPart(E)=14:Then
If V=1 or V=3:{0,0,3,0,6,0,9,0->L1
If V=2 or V=4:{0,0,0,3,0,6,0,9->L1
End
If |E2fPart(E)=15:Then
If V=1:{0,0,0,3,3,3,6,3->L1
If V=2:{0,0,3,0,0,3,0,6->L1
If V=3:{0,0,3,0,6,0,6,3->L1
If V=4:{3,0,3,3,3,6,0,6->L1
End
If |E2fPart(E)=16:Then
If V=1:{0,3,3,3,6,3,6,0->L1
If V=2:{0,0,0,3,0,6,3,6->L1
If V=3:{0,0,3,0,6,0,0,3->L1
If V=4:{0,0,3,0,3,3,3,6->L1
End
|E2fPart(E->Z
If max(Z={10,11,12,15,16:Then
If V=1 or V=3:Then:2->A:1->B:End
If V=2 or V=4:Then:1->A:2->B:End:End
If Z=13:Then:1->A:1->B:End
If Z=14:Then
If V=1 or V=3:Then:3->A:0->B:End
If V=2 or V=4:Then:0->A:3->B:End
End
0->theta
End
If D=G:Then
Pt-On((115+C*3)+L1(1),(115-(D)*3)-L1(2),1,|E2fPart(E
Pt-On((115+C*3)+L1(3),(115-(D)*3)-L1(4),1,|E2fPart(E
Pt-On((115+C*3)+L1(5),(115-(D)*3)-L1(6),1,|E2fPart(E
Pt-On((115+C*3)+L1(7),(115-(D)*3)-L1(8),1,|E2fPart(E
End
If T>U:Then

If D+B=20 or iPart([A](D+(L1(2)/3)+1,C+(L1(1)/3)))=1 or iPart([A](D+(L1(4)/3)+1,C+(L1(3)/3)))=1 or iPart([A](D+(L1(6)/3)+1,C+(L1(5)/3)))=1 or iPart([A](D+(L1(8)/3)+1,C+(L1(7)/3)))=1:Then
E->[A](D+(L1(2)/3),C+(L1(1)/3
E->[A](D+(L1(4)/3),C+(L1(3)/3
E->[A](D+(L1(6)/3),C+(L1(5)/3
E->[A](D+(L1(8)/3),C+(L1(7)/3
Matr>list([A]^^T,D,|LA
If D+1<=21:Matr>list([A]^^T,D+1,|LB
If D+2<=21:Matr>list([A]^^T,D+2,|LC
If D+3<=21:Matr>list([A]^^T,D+3,|LD
If sum(iPart(|LA))=10:Then
0->L
For(O,1,10
Pt-Off(115+O*3,115-D*3,1
0->[A](D-1,O
End
End
If D+1<=21:Then
If sum(iPart(|LB))=10:Then
1->L
For(O,1,10
Pt-Off(115+O*3,(115-(D+1)*3),1
0->[A](D,O
End
End:End
If D+2<=21:Then
If sum(iPart(|LC))=10:Then
2->L
For(O,1,10
Pt-Off(115+O*3,(115-(D+2)*3),1
0->[A](D+1,O
End
End:End
If D+3<=21:Then
If sum(iPart(|LD))=10:Then
3->L
For(O,1,10
Pt-Off(115+O*3,(115-(D+3)*3),1
0->[A](D+2,O
End
End:End
If L<5:3->W
0->R
(D+L)-1->M
While W=3
Matr>list([A]^^T,M,|LA
Pt-On(105,115-M*3,1,10
Text(1,1,D
Text(14,1,L
Text(27,1,M
Text(40,1,sum(|LA)
If sum(|LA)>0:Then
For(O,1,10
Pt-Off(115+O*3,115-M*3,1
[A](M,O)->[A](M+1,O
0->[A](M,O
If [A](M+1,O)>0
Pt-On(115+O*3,(115-(M+1)*3),1,|E2fPart([A](M+1,O
End
End
If R>5 and (sum(iPart(|LA))=0 or M<3:2->W
M-1->M:R+1->R
End:"W=3

0->D:5->C:1->V:1->P:1->theta
S+1->S
randInt(10,16->E
1+(E/|E2->E
End
D+1->D
End
If P=0 and D!=G:Then
Pt-Off((115+F*3)+L1(1),(115-(G)*3)-L1(2),1
Pt-Off((115+F*3)+L1(3),(115-(G)*3)-L1(4),1
Pt-Off((115+F*3)+L1(5),(115-(G)*3)-L1(6),1
Pt-Off((115+F*3)+L1(7),(115-(G)*3)-L1(8),1
D->G
End
If P=1:D->G
0->P:5->L
End:"W=2


The issue is inside the While W=3 segment. For whatever reason, I'm getting this:



I don't know what else to do with this thing, it's not making sense that it's doing what it is doing.

So, a fresh set of eyes is in order.

I appreciate it ahead of time if anyone looks at the code, thanks.
Figured out the issue I was having. Setting the lines to 0 inside the matrix was off for alignment issues. Now that that's fixed, I have to make it see that more than one line is cleared. Otherwise, it only drops pieces 1 line down after clearing more than one line :p
tifreak8x wrote:
Figured out the issue I was having. Setting the lines to 0 inside the matrix was off for alignment issues. Now that that's fixed, I have to make it see that more than one line is cleared. Otherwise, it only drops pieces 1 line down after clearing more than one line :p
Congratulations, I know that issue was frustrating you. Smile Keep up the good work.
Thanks Kerm Smile I'm trying to figure out some 'smart' way to make it look for empty lines below where the first pieces fall so it knows..


So, I've got that working Very Happy What do you all think?

I'd be grateful if someone would be able to throw the game at their calc, and give it some testing in regards to line clearing? Smile

http://tifreakware.net/tifreak8x/btetris/BTETRIS.8xp

Thanks in advance!
Wait, it looks that black T piece suddenly ends up missing a row of its pink buddy.
It's jstified's screen capture's fault, it doesn't capture colors properly all the time :<
tifreak8x wrote:
It's jstified's screen capture's fault, it doesn't capture colors properly all the time :<
I can verify this. I need to fix that one of these days. Sad Nice job on fixing this though, tifreak; I'll test it tonight or tomorrow morning.
KermMartian wrote:
tifreak8x wrote:
It's jstified's screen capture's fault, it doesn't capture colors properly all the time :<
I can verify this. I need to fix that one of these days. Sad Nice job on fixing this though, tifreak; I'll test it tonight or tomorrow morning.


Would greatly appreciate it and any thoughts you have in regards to its functionality Smile

Code:
Matr>list([A]^^T,D,|LA
If D+1<=21:Matr>list([A]^^T,D+1,|LB
If D+2<=21:Matr>list([A]^^T,D+2,|LC
If D+3<=21:Matr>list([A]^^T,D+3,|LD
If sum(iPart(|LA))=10:Then
0->L
For(O,1,10
Pt-Off(115+O*3,115-D*3,1
0->[A](D,O
End
End
If D+1<=21:Then
If sum(iPart(|LB))=10:Then
1->L
For(O,1,10
Pt-Off(115+O*3,(115-(D+1)*3),1
0->[A](D+1,O
End
End:End
If D+2<=21:Then
If sum(iPart(|LC))=10:Then
2->L
For(O,1,10
Pt-Off(115+O*3,(115-(D+2)*3),1
0->[A](D+2,O
End
End:End
If D+3<=21:Then
If sum(iPart(|LD))=10:Then
3->L
For(O,1,10
Pt-Off(115+O*3,(115-(D+3)*3),1
0->[A](D+3,O
End
End:End


This is what I'm looking to shrink down in BTetris. At the moment, I'm not sure how to get L to be the proper values that they are now if they were in a loop. The rest of it doesn't seem all that difficult, I think..

Code:
For(Q,0,3
If D+Q<=21:Then
Matr>list([A]^^T,D+Q,|LA
If sum(iPart(|LA))=10:Then
Q->L
For(O,1,10
Pt-Off(115+O*3,(115-(D+Q)*3),1
0->[A](D+Q,O
End:End:End:End


Is what I reduced it down to, 370 bytes to 107, which brings the Tetris game down to 2,667 bytes. Smile

Going to work on the moving left and right bit next, so it doesn't push through other pieces.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 5
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement