Dev C%2b%2b Program For Tetris Game

  1. Dev C 2b 2b Program For Tetris Game Play
  2. Dev C 2b 2b Program For Tetris Games

Hi there guys may I ask if there's anyone here who has a complete guide or maybe just a guide on how to make the tetris game in c#? Thank you very much I really need your help.

Dev C 2b 2b Program For Tetris Game Play

  • 4 Contributors
  • forum8 Replies
  • 1,419 Views
  • 1 Day Discussion Span
  • commentLatest PostLatest Postby lxXTaCoXxl

Download source: 'Korobeiniki' arrangement Dave Wave.

Recommended Answers

  • This is when you can talk to them about Tetris. The Tetris analogy. At the beginning of a Tetris game, you start with an empty game. It’s like the very beginning of a coding project when there is nothing yet. Then blocks start to fall down. The way you position each block has an impact on the rest of the game.
  • Some of the class names in the code (such as actor) are chosen to give some more general ideas about the parts in a video game (not that I am a pro in that area) so if I had in mind to just develop a tetris game maybe I would have chosen different names so please keep that in mind.
  • Tetris v1.0 by Thiago Marinho Pereira. Tetris is a video game developed in the Soviet Union in 1984. The game has a simple goal of destroying lines of block before it reaches the top. The line is made up of a square block. Tetrominoes is the shape of the 4 connected blocks that falls vertically down.

Errr. I think he just wants to write it to learn something, not to compete with Tetris commercially. What conecpts are you unfamiliar with in creating this game?

Learn C game development is a course I made for everyone who knows how to program, but doesn't know where to start with game development. The course teaches you how to use the SFML library for C, to start working with graphics, events and sound to create a 2D game. Tetris Tetris game for linux (originally made for windows enviroment here) in C using SDL2 (SDL2 Library included in repository) You'll need libsdl2-gfx-dev and libsdl2-dev to use SDL on linux. If you are using Ubuntu you can get them this way. The standard Tetris rotation logic is called Super Rotation System. SRS is suited to high-level Tetris play, allowing for many variations on wall kicks and t-spins. All tetrominoes exist inside a bounding square and rotate about the center of this square unless obstructed.

Jump to Post

I agree with @skatamatic on this topic. If you must write a Tetris clone then start by learning the framework. You'll need to know how to load Textures (I use PNG but BMP works just as well) then you'll need to learn how to manipulate the texture (using keyboard and …

Jump to Post

All 8 Replies

Dev C%2b%2b Program For Tetris Game

Technical debt, legacy code… if you’re a professional software developer you must have come across those terms, and even across some code that embodies them.

But as a professional software developer, you also have to interact with people that don’t know your code. And sometimes, you have to convince these people that you need to invest in refactoring in order to improve the quality of a piece of code in order to keep working with it.

Those people include your PO or whatever business people make the requirements, your project manager, your boss, and so on.

Here is an analogy that pretty much everyone can relate to: a Tetris game!

The only reference I could find of this analogy is on Colin O’Dell’s blog. Colin’s post is interesting and focuses on the point of view of a developer, to approach a codebase. I think that what makes this analogy so great is also that anyone can understand it. This is on this aspect that we’re going to focus here.

Technical debt

Before getting into the analogy of technical debt with a Tetris game, let’s agree on what we call technical debt.

Technical debt consists in performing a fix or development in a quick and dirty way because it takes less time, even though it will make the code harder to work with in the long term. A cleaner solution would take longer to perform right now, but would have eased future developments.

This is called “debt” because it is comparable to financial debt: if you want to keep working with the concerned code, one day or the other you will need to pay it back by developing the clean solution. And the later you pay it back, the harder it will be, because the code will have grown in complexity in the meantime. This strengthens the analogy with financial debt, that builds up in time with interest.

Technical debt is not a bad thing in itself, as long as it is under control. If you have a good reason to save time on a development (for example to ship a minimal viable product), and if you have a plan to pay it back, technical debt can be beneficial. This aspect is also comparable to financial debt.

Dev C 2b 2b Program For Tetris Games

But technical debt becomes a problem when it gets out of control. Accumulating technical debt consists in piling up hacks on a piece of code, making it harder and harder to maintain. Every incremental change requires an intense reflexion and is more and more likely to cause regressions.

With too much technical debt, at some point the code can’t evolve any more. And if you really need to make the code evolve, for business reasons for example… then you have a problem.

To back out from such a situation, one way is to invest in refactoring, to undo the hacks and get a clean structure back into the code. This allows to make the code manageable again. But refactoring can take time.

From a developer’s perspective, all this sounds very logical. But from the perspective of someone that doesn’t know the state of the code, and doesn’t realize the need for refactoring, the situation might not be so simple to understand.

And if that someone has the power to grant you the time and budget resources to make your refactoring, then they have to understand.

This is when you can talk to them about Tetris.

The Tetris analogy

At the beginning of a Tetris game, you start with an empty game. It’s like the very beginning of a coding project when there is nothing yet.

Then blocks start to fall down. The way you position each block has an impact on the rest of the game. If you place blocks around without much reflexion, letting holes slip in, you’re making life harder for the rest of the game. And if you manage to build a clean, compact structure, then it will be more manageable later in the game.

The analogy with technical debt is that each new fix or development is like a new block coming in, which you need to integrate with the existing code. If you hack it in a quick and dirty way, it’s like leaving holes in the Tetris structure: you’re making life more difficult down the line.

And if you take the time to design a clean solution to integrate the fix or development, it’s like making sure you leave few holes in the Tetris game. This is less easy to achieve but it pays off in the long run.

The goal of a Tetris game is not to always have a flat structure though. It’s ok if it builds up a bit, as long as you have a plan to reduce it later. Like leaving the space for a vertical bar to slide in and clear out four rows at a time, with such a pleasant feeling:

Even if you leave a few holes in, it’s ok if you manage to have compact rows above them that will clear out and allow to fill the holes later. This is similar to technical debt, that is ok to build up if it’s under control and you have a plan to pay it back later.

How the Tetris analogy can help

What makes the Tetris analogy interesting is that anyone can relate to it, even people that are not developers or that don’t realize the state of the code.

If you’re asked to make a fix that will compromise the quality of your code, you can explain that it’s like placing a Tetris block at the wrong position. You can do it, and if you’re not too far into the game you won’t lose right now.

But blocks sticking out will make your life more difficult whenever you have to deal with that code again. This means that future developments will take more time, and are more likely to cause regressions.

After piling up hacks on the same piece of code, at some point it becomes unmanageable. And when someone asks you do keep adding features to this piece of code, you can explain to them that it is like a Tetris game filled up to the top. Because of the badly handled debt in the past, you can’t make any new block fit in.

At this point the only way to move forward is to go back in time (which you can’t do in a real Tetris game) to simplify the code with a refactoring.

I’ve tested the Tetris analogy with my PO at work, and he found it pretty clear to understand. If you try this at work too, let me know in a comment how your non-tech people reacted to The Tetris analogy, and if it helped you!

Become a Patron!
Share this post! Don't want to miss out ? Follow:
Comments are closed.