- Block Party (0808) CSE
- 08 Jan 2018 04:34:31 pm
- Last edited by mr womp womp on 21 Jan 2018 02:54:14 pm; edited 2 times in total
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
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
Code:
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.
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
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
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.