Help with Tetris game, can't find the errors.

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
andreicap
Posts: 1
Joined: May 11th, 2013, 11:04 am

Help with Tetris game, can't find the errors.

Post by andreicap » May 16th, 2013, 1:43 pm

I don't know why it isn't working. I have no big experience in programming. I'm at lesson 15. Tried to use debugger, and by calculations all should work fine .
Help please.
Attachments
Tetris.zip
Visual Studio project.
(8.12 MiB) Downloaded 189 times

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Help with Tetris game, can't find the errors.

Post by albinopapa » May 16th, 2013, 7:20 pm

first run, while drawing one of the lines or rectangles one the parameters being sent is missing a value. Haven't found it yet will edit when I do.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Help with Tetris game, can't find the errors.

Post by albinopapa » May 17th, 2013, 1:00 am

one of the biggest problem is your code is very confusing to follow. I know as far as the compiler is concerned spaces don't matter between variables and operators such as the = or <=, but as far as someone being able to read it and follow along not having the spaces make it hard to debug.

I found a couple of places where you didn't have { } surrounding your for loops.

There is an if control statement that just says if(true) which there isn't a comparison so wouldn't be needed true will never be false.

In debug mode I get errors basically saying PutPixel is trying to draw outside the boundaries of the window, which are at the moment the problem is y < 0 when drawing some of the rectangles.

You also said that you just went through lesson 15, a lesson over struct. I believe you can really use that information and change from int fgx[11][5][5][3] to something a little more readable.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Help with Tetris game, can't find the errors.

Post by cameron » May 24th, 2013, 9:31 pm

I found several errors in your code some of which albinopapa said. The problem is your code is just too unreadable I would not use multidimensional arrays. I would go with something like a struct.
Computer too slow? Consider running a VM on your toaster.

Post Reply