How to program Tetris.

Basic and Machine Language

Moderator: Moderators

Post Reply
adric22
Vic 20 Hobbyist
Posts: 143
Joined: Fri Mar 11, 2005 6:54 pm

How to program Tetris.

Post by adric22 »

I've thought for a long time about trying to write a Tetris game. I know there are already some out there, but just to do it for my own pleasure.

I certainly don't need any help writing code, but what I seem to have a difficult time with is the actual logic to how this would work. You have different shapes of pieces falling, each piece made of 4 little squares. So, in the program code, do you treat it as one piece or do you treat it as 4 falling pieces? Either way seems to present a set of challenges in regards to rotation and detecting when it has hit the bottom.

I saw a Tetris done in like 20-some-odd lines of Basic code one time, and I couldn't make heads or tails of it. I'd probably write mine in assembler, but the point remains I need to figure out how to approach the task first.
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Re: How to program Tetris.

Post by Jeff-20 »

adric22 wrote:I saw a Tetris done in like 20-some-odd lines of Basic code one time, and I couldn't make heads or tails of it. I'd probably write mine in assembler, but the point remains I need to figure out how to approach the task first.
That 20 Line Tetris was awesome! I also had trouble really understanding it. Collision detection, I guess I would call it, is really difficult.
High Scores, Links, and Jeff's Basic Games page.
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

take a look to the source of Tetris+
Mega-Cart: the cartridge you plug in once and for all.
adric22
Vic 20 Hobbyist
Posts: 143
Joined: Fri Mar 11, 2005 6:54 pm

Post by adric22 »

nbla000 wrote:take a look to the source of Tetris+
Wow.. I tried the game. It is fantastic, too bad it wasn't around in the 1980's. It is actually better than the C64 official version of Tetris. Sad, huh? I can't say that I like the design of the blocks, though. I would have used a different character pattern.

Anyway, I'll check out the source later.
Diddl
Vic 20 Afficionado
Posts: 425
Joined: Wed Jun 10, 2009 3:18 am

Post by Diddl »

nbla000 wrote:take a look to the source of Tetris+
Look very nice! Source code isn't downloadable ...
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

Look very nice! Source code isn't downloadable ...
argh !!! the host denied access to zip file... I will modify the page.
Mega-Cart: the cartridge you plug in once and for all.
Post Reply