Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Tetris- Not functioning properly  RSS feed

Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I tried to run a code which was developed by one of my friends but the code is not running as expected. I tried to debug the code to figure out the problem, but was not successful. Would some one mind to look into this and explain me the problem..

This code is based on Tetris game

When I ran this, the starting score is displayed as 3430. When I debugged the code, instead of "0".

Can some one help me in understanding the problem and the possible solution to correct that.
[ July 31, 2008: Message edited by: Schandha Ravi ]
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Here is the problem :-

This method checkGame() loops N rows and N columns
This will in turn call checkShape() method which will loop 15 times i.e for the shape for each row and column
This will in turn call clearShape() method which loops till next value becomes 4 adn updates the totalscore and then so on ....

I tried printing rows and columns when the total score is updated,
You can try the below code to see when totalscore is updated

I believe the logic is completely off ...

ice is for people that are not already cool. Chill with this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!