Download Block Party here:

Block Party CSE



A few weeks ago, a friend of mine sent me a request on Facebook Messenger to play one of the little games that they have now. So I did... And I got really addicted to it. As the title says, this game is the pretty unpopular Block Party. It is essentially the same as tetris, except that the playing field is an 8x8 square grid, and you are given 3 blocks at a time to choose from (and 3 more once you've used them all up). The goal is of course to complete rows or columns, and different amounts of points are given depending on how many rows and columns you complete at once.
EDIT: This is the same as 1010! which is a much more popular version, played on a 10x10 grid.
Needless to say this felt doable on calculator hardware, so I wrote the game in CSE hybrid basic. It runs quite slowly, a little too slow for my liking, but after all, this is basic on a CSE, there's only so much one can do. I had the game at a playable state, but I wanted to make it more presentable, by adding a home menu with the possibility to save the state of your game, a short credits and controls page, as well as a handful of high scores. I was also headed towards adding different colors for the pieces, like in the original game, but I didn't get that far.
Here is a screenshot of a slightly earlier version of the game, immediately before making the changes described above (which, being the good coder that I am, I still have)



The colors seems a bit off, they look a little nicer on-calc but that might be my monitor Razz
Things were going well, when the calc started crashing a lot. Saving of the game was done by grabbing all the necessary information and placing it in an appvar, which would then be archived. This required things to be in the form of strings, given that this is on the CSE, the old tostring method was used, but it had to be used a lot. I decided that instead of essentially repeating the code over and over again, I should make a subprogram. I didn't want the game to require 2 files being sent to the calculator, as I find that to not be very user friendly and kind of lame, so I decided to make a short routine that would take a list as input, and output a string. I would then create a new program and place the routine in it at runtime, and execute that program whenever I needed to call the routine. When quitting, I would delete the subprogram. I believe this is the part that was misbehaving. Get your sdk out, because here is the routine, and it uses quite a few celticII commands Razz

Code:
{0,1->L1
"TOSTRY->Str0
det(6
det(4
det(3
sub(Str9,1,1
sub(Str9,2,1)+"{"+Ans+"Str9:For(Q,1,dim(|LT)):|LT(Q)*L1"+Ans+"L2:LinReg(ax+b) {Y1}:Equ>String({Y1},Str1):Str9+sub(Str1,1,length(Str1)-3)+"+sub(Str9,2,1)+","+Ans+"Str9:End:sub(Str9,1,length(Str9)-1)"+Ans+"Str9->Str9
1
det(2

The list would be stored as a string in Str9, ready to be sent to the appvar stored in Str0.
Anyway, the game is unfinished, and it is pretty much impossible for me to continue without this part. Given that the subprogram method won't work, I will have to either copy the routine a few times, or give up saving any data between plays.
I'd say the game is about 85% done, given that it's already almost 4kb, which is not insignificant for the CSE's 21kb of ram.
Also, special thanks to PT_ for helping with the routine that checks for completed rows.
Little update, I added the 5 colors from the original game that this is based off of (red, blue, green, yellow and orange). I optimized a few things left and right, and I made it so that you get points for the number of tiles in each piece you add (for example, adding a 3x1 piece will add 3 points) which is what happens in the original game.

Oh, this looks really nice! Keep up the nice work Smile
YAY, ANOTHER CSE GAME COMING!
I just added a high score system, with a custom input routine. For the high score holder's name.



I also added a nifty little shaking effect when you try to place a piece in a position where you can't. The gif only shows one jerky shake, but I assure you on-calc, it shakes back and forth 4 times and much quicker than the screenshot Razz



I also made it so that when you complete rows or columns, the added score flashes on the screen a few times, rather than just appearing...

I've uploaded it to the archives, I hope there aren't any bugs I might've missed. I will add the download link once it gets accepted.
If you have any questions or find any issues with the game, feel free to contact me about it.
EDIT:
I've added the download link at the top of the thread.
Bug report: Pressing ALPHA permanently puts a selection on the board.
mets11rap wrote:
Bug report: Pressing ALPHA permanently puts a selection on the board.

Whoops, it seems that pressing any key that it is not expecting (anything except arrows, clear, enter, 2nd or del) causes this to happen. I will have a look and fix this as soon as I get the chance.
EDIT: I've fixed it and the new version is now pending approval available.
The bug still persists in the main menu.
mets11rap wrote:
The bug still persists in the main menu.

Fixed as well, and the fixed version is now in the archives.
Looks good! Keep up the good work!

P.S. Have you thought about porting it to the TI-84 pce?
Legoman314 wrote:
Looks good! Keep up the good work!

P.S. Have you thought about porting it to the TI-84 pce?

Yes, I have, but if I do, it would be ICE, probably with a bit of BOSshell, to make things easy for myself. This means that a hypothetical CE version would be MUCH faster, but require quite a bit of brain jumbling to work.
The other option would be to wait until DoorsCE is released, because then the code would be completely compatible, and would still run a little bit faster (but not nearly as fast as an ICE/BOSshell version). This option has the advantage of requiring 0 work on my end.
*5 years later*

I decided to optimize this. Most of the improvements were pretty small but 2 of them had a noticeable impact on performance:
  • Calculate the width and height of a piece once instead of several times while moving a piece around the board.
  • Check only the rows and columns which the piece could complete (example), instead of all 8 rows and columns every time a piece is placed.
Overall the game still runs slow as molasses Rolling Eyes

I also took this opportunity to throw in a new feature: Perfect clear bonuses
When you clear the entire grid, you get the points for clearing 1 extra line (eg. if you cleared a double, you get the points of a triple).

Looking good man!
  
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 1 of 1
» 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