Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Final Project Help

Author
Message
sonshuma
11
Years of Service
User Offline
Joined: 9th Dec 2012
Location:
Posted: 27th Apr 2013 19:49
Hello Everyone,

(Skip the first paragraph if you wanna get to the problem)
First of all, I would like to say thank you to everyone who has responded to any of my post over the past year. I have learned a tremendous amount from everyone's responses while learning how to program and use the DarkGDK library. This will be a valuable tool for years to come and I hope that with my continued use, I will be able to help others on this forum.

Noe for the problem, I have a "Pretty simple" program that has been giving me trouble for a good while. Its my final for a class. I've been working on it for about a semester. I know that there are some things that would make the program more efficient so please bare with me with the code below. The issue I am having is as follows:

Whenever player one scores, their score shoots up to 500+ for no reason.

I have debugged the program several times, changed numerous things within the program, and did every check I could with no success at all. Even my randoms SEEM to be correct. If someone wouldn't mind taking a look or maybe even running that program, that would be great.

I have asked my teacher several times about how to fix this and she doesn't even see the issue.

I am NOT looking for a "Change this to this and its fixed." I'm looking for tips on what is wrong with an explanation. Thank you to anyone who looks and responds to this.

Attachments

Login to view attachments
sonshuma
11
Years of Service
User Offline
Joined: 9th Dec 2012
Location:
Posted: 27th Apr 2013 22:44
And by she doesn't even see the issue. I mean, she sees the problem but she doesn't see a solution for it either.
Boca
13
Years of Service
User Offline
Joined: 25th Nov 2010
Location:
Posted: 28th Apr 2013 00:31
I ran the program at first with debug on to see if anything stood out. I noticed after running it anytime I made a first " match " the program ended and declaired that person as the winner. I did not see any score persay.

When I ran the program in release mode I noticed that sometimes when you matched a tile it would " delete " and hide them, but on another turn it would redisplay the " deleted " tile, usually only one of them so sometimes the game board had an odd number on the screen. I have a pic of it to show what I mean.

Attachments

Login to view attachments
sonshuma
11
Years of Service
User Offline
Joined: 9th Dec 2012
Location:
Posted: 28th Apr 2013 02:33
Boca: I had not noticed that before. Very interesting. I'll look and see what I can from that information. That definitely gives me a few places to look. I figured the scoring was a memory leak of some sort but I'm just not seeing whats not right.
mr_d
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Mar 2007
Location: Somewhere In Australia
Posted: 28th Apr 2013 11:10 Edited at: 28th Apr 2013 11:17
I don't have C++ set up on my computer, so could not compile and run or debug your program.
just looking at your code, I couldn't see anything obvious that would account for what you are seeing, but did notice that your clenup function seems to be a little incorrect in both it's lower bound and it's upper bound values; this shouldn't have any impact on the problem you describe, but you may want to correct that anyway.

EDIT: I noticed you used a lot of pointers and associated operations (e.g. de-referencing), which I assume is part of your coursework and required for your project submission. However, I would suggest that if you don't need to use these (e.g. simple assignment of integers to variables and function parameters), then not to do so as it unnecessarily complicates the readability of your code.

sonshuma
11
Years of Service
User Offline
Joined: 9th Dec 2012
Location:
Posted: 28th Apr 2013 19:23
Mr_D: That is correct and I also completely agree on the readability. We have to use referencing with basically everything... which is a pain but I get that we are demonstrating knowledge on how to use them. I will definitely look at the cleanup function so thanks for the heads up on that.

If you check the download, I posted a "release" of the game so you can see the issue Boca experienced (and I later experienced when I compiled it into release).

Attachments

Login to view attachments
sonshuma
11
Years of Service
User Offline
Joined: 9th Dec 2012
Location:
Posted: 28th Apr 2013 19:25
Also,

I don't know if this is public or if my teacher did this BUT, this is what I have been using to debug the program to find the issue.

sonshuma
11
Years of Service
User Offline
Joined: 9th Dec 2012
Location:
Posted: 29th Apr 2013 23:25
Just as an Update, I have spotted the potential issue. It has to do with the display array functions. C++/DarkGDK don't like trying to show something that doesn't exist.

Login to post a reply

Server time is: 2024-11-18 21:35:48
Your offset time is: 2024-11-18 21:35:48