That's going to be interesting, good luck with it. Let me know when you finish so I can play with Celtic 2 CSE and rendering pieces. Smile
Haha will do! Going to try to make those fixes sometime today. Need to look up how scoring is done so I can start implementing that as well.
tifreak8x wrote:
Haha will do! Going to try to make those fixes sometime today. Need to look up how scoring is done so I can start implementing that as well.
My very clear and not at all long comment in Tetric A for scoring goes like this:
Code:
;score += 2*(1+lastlines)*(y-firstclearedy)*(y-firstclearedy)*(level);
In other words:
Code:
 score = score + 2*(level)*(1+number_of_lines_cleared_last_piece)*(number_of_lines_cleared_this_piece)^2
If you are on level 10 and clear two lines with one piece, then clear two lines with the next piece, the first piece will score 2*10*(1+0)(2)^2=80. The next piece clearing another two lines will score 2*10*(1+2)(2)^2=240. I also add (level) points for every piece placed.

Edit: But every time you drop a piece, lines_cleared_this_piece -> lines_cleared_last_piece, so if you clear a line, drop a piece that doesn't clear a line, and drop a third piece that clears a line, you get no bonus.
I guess I hadn't realized that the scoring was that 'complex'. I was going to go with something simple, mainly you get 2 points per piece that hits the bottom or otherwise stops, and X amount of points per line cleared, with the more lines cleared being awarded bonus. Hrm...
tifreak8x wrote:
I guess I hadn't realized that the scoring was that 'complex'. I was going to go with something simple, mainly you get 2 points per piece that hits the bottom or otherwise stops, and X amount of points per line cleared, with the more lines cleared being awarded bonus. Hrm...
That would also work well, I'd think. It looks like the canonical game does something in between our two methods, complexity-wise: http://tetris.wikia.com/wiki/Scoring
I've managed partial blocking for pieces moving to the right into other pieces, and it seems to work fine going left, but when you get to the third row from the bottom, it allows the piece to go right one, even though it's registering there is a piece there.


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
If K=26:Then
If C+A<10 and ([A](D,C+A+1(C+A<10))=0 or [A](D+1,C+A+1(C+A<10))=0 or [A](D+2,C+A+1(C+A<10))=0 or [A](D+3,C+A+1(C+A<10))=0:Then
C+1->C
End:End
If K=24:Then
If C>1 and ([A](D,C-1)=0 or [A](D+1,C-1)=0 or [A](D+2,C-1)=0 or [A](D+3,C-1)=0:Then
C-1->C
End:End
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
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
If L<5:3->W
0->R
D+L->M
0->N
While W=3
Matr>list([A]^^T,M,|LA
If sum(|LA)>0:Then
For(O,1,10
Pt-Off(115+O*3,115-M*3,1
[A](M,O)->[A](M+N,O
0->[A](M,O
If [A](M+N,O)>0
Pt-On(115+O*3,(115-(M+N)*3),1,|E2fPart([A](M+N,O
End
End
If R<5 and sum(iPart(|LA))=0:N+1->N
If R>5 and (sum(iPart(|LA))=0 or M<3:2->W
M-1->M:R+1->R
End
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


This is the most up to date code so far.
Seems I might have gotten the problem solved. Now all that I need to do is show how many lines are cleared and the score, and it should be ready for a release Smile

Edit:

Updated the file: http://tifreakware.net/tifreak8x/btetris/BTETRIS.8xp

Would be very grateful if someone could play around with this for a while and see how it plays? Thanks in advance!
Bug report: Tried moving a square block left near the lower-left of the playfield, with C=1 and D=15, and got an Invalid Dimension error near the If K=24 line. Solution: Because TI-BASIC doesn't do short-circuiting, break up the conditional:
Code:
If C>1:Then
If not([A](D,C-1)) or [A](D+1,...


Edit: Same thing seems to happen if you are holding the left arrow key when the piece hits the bottom.
Alright, thanks. Were you having any issues going towards the right, or through pieces? Smile
tifreak8x wrote:
Alright, thanks. Were you having any issues going towards the right, or through pieces? Smile
Pressing the right arrow against the right edge of the field didn't cause any problems. Pressing left when a piece was falling next to another piece made the falling piece get stuck inside the existing placed piece.
Bah, that shouldn't be happening. Neutral I'll do some more playing around with it, it wasn't doing that before hand. :< This is far harder than I thought it would be.
Any progress on tracking that bug down, tifreak8x? Or is it more of an issue of needing to redesign the rotate+move code? If the latter, you're more than welcome to pick at Tetric B for code or my brain for ideas and algorithmic details.
I've made some changes to the code, I just haven't tested it as of yet. I've updated the file at the link, and I'll try to test it later today. Yesterday was very busy in the shop. :<
tifreak8x wrote:
I've made some changes to the code, I just haven't tested it as of yet. I've updated the file at the link, and I'll try to test it later today. Yesterday was very busy in the shop. :<
I tested it some more, and it mostly seems to be fixed. I can't go through the left side and trigger a dimension error any more. The only time I can get a piece into another piece in a few minutes of testing is moving a piece left one place into another piece while it falls. Like so:


Code:
    22   
   22       [ -> LEFT before during fall -> ]     22
 11                                             122
 11                                             11
111                                            111
*note to self*

Ignore row D is on, look at D+1 through D+4.

Updated the program at the link!

Just need to add scoring, level tracking, Line clearing(?), and game over detection.
I think I've worked out the bugs for moving left and right with a new system that is more dynamic then what the previous setup allowed.

Also, here:

Thoughts?

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

For anyone to test it out Smile
Congratulations! I'm glad to hear you worked out the movement bugs. Is there anything left to do other than the lines/score/level numbers and tracking the score before I start poking at hybridization?
The only thing I've not added beyond those is detecting a game over.

And link edited in the post above

I got it 'finished'!

http://www.cemetech.net/programs/index.php?mode=file&id=969


Back ported to the 83+/84+ Smile What do you think?

And this is what it looks like on the normal 83:

I like it! Smile Why does the 83 version say BA` instead of By:?
  
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 3 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