Thread: Change scoring system Tetris

  1. #1
    Registered User
    Join Date
    Feb 2017
    Posts
    3

    Change scoring system Tetris

    Hello everybody

    my name is Julie and at the moment i am a trainee at a huge german brewery.
    In my free time, I try to learn some coding.

    I am also a Tetris-enthusiast and I love to play this version: GitHub - DavidGriffith/tint: TINT Is Not Tetris(tm) ...at least the name isn't
    So I started so read, understand and modify the code of this game. But now I have a problem:
    I want to change the scoring system, so that you receive more points when you quit multiple lines. According to the NES-version (Scoring | Tetris Wiki | Fandom powered by Wikia)

    Can somebody help me to do this?
    In my opinion the scoring system is in file "tint.c" (81) and "engine.c" (287)


    So, keep calm and drink beer!

    Julie

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    GDB Documentation

    Basically, run the code in the debugger (don't forget to compile with the -g flag).
    If you believe score_function is involved, then set a breakpoint (b score_function) to test your idea.

    You might want to look at where score_function is called from, which should be the code which locates a completed row.

    The debugger is advantageous since
    - you don't need to edit the code to observe behaviour
    - you can examine all the program data
    - you can examine the call stack to figure out where things are called from
    - you can change data on the fly to test ideas about how things might work differently.

    Or you can go for the crude approach of sprinkling debug prints through the code.
    Code:
    static void score_function (engine_t *engine)
    {
       printf("DEBUG: score_function called\n");
       /// rest of code
    }
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Feb 2017
    Posts
    3
    Quote Originally Posted by Salem View Post
    Basically, run the code in the debugger
    Thank You Salem for your reply.

    But I am totally new to coding, so I have no idea how to work with the debugger.
    I just want to change the code for the scoring. Can you just write it for me, please ? I think I am too spacy to understand it...

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > I try to learn some coding.
    ...
    > Can you just write it for me, please

    You can't learn how to cook from just reading the menus at a restaurant.

    > But I am totally new to coding, so I have no idea how to work with the debugger.
    Fine, don't use a debugger. Just spread some print statements around and see what happens.

    To be honest, if you're that new to coding, you need to hone your skills on much smaller programs.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Feb 2017
    Posts
    3
    Quote Originally Posted by Salem View Post
    You can't learn how to cook from just reading the menus at a restaurant.
    Fine, don't use a debugger. Just spread some print statements around and see what happens.
    You're absolutely right, Salem. That was not clever by myself.
    I have to learn a lot more in coding.

    But is it right, that I have to focus on "engine.c" (Lines 212-236 and Lines 298-321) and on "tint.c" (Lines 81-91) ?

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I've told you all you need to know to start answering your own questions.

    You make a prediction, you make a test printf() to test your analysis and you observe the results.

    If your result matches your expectation, you move on.
    If it doesn't, you try again.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Table tennis scoring system
    By Saimadhav in forum C++ Programming
    Replies: 3
    Last Post: 10-20-2008, 06:55 AM
  2. Read and set\change system time
    By Hexxx in forum C++ Programming
    Replies: 9
    Last Post: 01-02-2006, 07:11 AM
  3. Can't change directories via system("cd");
    By Frosty in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2005, 10:45 AM
  4. Tetris...
    By Stan100 in forum Game Programming
    Replies: 5
    Last Post: 02-21-2003, 04:40 PM
  5. Talk about a high scoring game
    By golfinguy4 in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-01-2002, 11:08 PM

Tags for this Thread