RSS Forums RSS

Chess...confusing problem =(

Please support our C++ advertiser: Programming Forums
Reply
Posts: 391
Reputation: skatamatic will become famous soon enough skatamatic will become famous soon enough 
Solved Threads: 38
skatamatic skatamatic is offline Offline
Posting Whiz

Chess...confusing problem =(

  #1  
Jan 7th, 2009
Well I don't have any specific question. I've been writing a chess game and can't seem to figuire out what the problem is with it! I tried debugging it for a few hours now and am about to give up altogether and rewrite it. The problem occurs seemingly randomly when the king is moved (on either team). It throws an access violation for some reason...and I can't seem to figuire out the exact circumstances that trigger it. I'm thinking the problem lies in the recent (and still pretty sloppy) additions of check, checkmate, and castling. Any help would be appreciated!! I would post the code but the project is pretty big at this point, so it's probably easiest just to download it (Project is attached). Thanks!
Attached Files
File Type: zip ChessEngine.zip (253.7 KB, 11 views)
AddThis Social Bookmark Button
Reply With Quote  
Posts: 1,495
Reputation: vmanes is a name known to all vmanes is a name known to all vmanes is a name known to all vmanes is a name known to all vmanes is a name known to all vmanes is a name known to all 
Solved Threads: 167
vmanes's Avatar
vmanes vmanes is offline Offline
Nearly a Posting Virtuoso

Re: Chess...confusing problem =(

  #2  
Jan 8th, 2009
Your zip file appears to be corrupt. At least according to my copy of WinZip.
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote  
Posts: 79
Reputation: MatEpp is an unknown quantity at this point 
Solved Threads: 12
MatEpp MatEpp is offline Offline
Junior Poster in Training

Re: Chess...confusing problem =(

  #3  
Jan 8th, 2009
I got it to open with 7-zip
Reply With Quote  
Posts: 391
Reputation: skatamatic will become famous soon enough skatamatic will become famous soon enough 
Solved Threads: 38
skatamatic skatamatic is offline Offline
Posting Whiz

Re: Chess...confusing problem =(

  #4  
Jan 8th, 2009
Sorry I zipped it as rar then changed the extension to zip after I found out rar cant be uploaded. WinRar opens it fine! I don't have winzip =(. When I get home I'll get winzip and re-upload for you. I appreciate that some people are actually making an attempt to help debug it!
Last edited by skatamatic : Jan 8th, 2009 at 12:21 pm.
Reply With Quote  
Posts: 1,495
Reputation: vmanes is a name known to all vmanes is a name known to all vmanes is a name known to all vmanes is a name known to all vmanes is a name known to all vmanes is a name known to all 
Solved Threads: 167
vmanes's Avatar
vmanes vmanes is offline Offline
Nearly a Posting Virtuoso

Re: Chess...confusing problem =(

  #5  
Jan 8th, 2009
And it seems you have archives within archives within archives?

And, shouldn't there be some implementation files for the various classes?
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote  
Posts: 105
Reputation: u8sand is an unknown quantity at this point 
Solved Threads: 13
u8sand's Avatar
u8sand u8sand is offline Offline
Junior Poster

Re: Chess...confusing problem =(

  #6  
Jan 8th, 2009
Well before you do anything, might wana fix a lil problem w/ ur game.
Your pon can move 2 spaces even when its not its first move : /
I recomend saying if the pon is not in the start y axis, then it can only move 1 space, else it can move 2. Because pons cant move backwards, this will assure it works. But i havent looked at code first so i cant solve your problem yet. I will check.


also i moved the king allot and dident get any access violation. But i will see
Last edited by u8sand : Jan 8th, 2009 at 5:51 pm.
Reply With Quote  
Posts: 391
Reputation: skatamatic will become famous soon enough skatamatic will become famous soon enough 
Solved Threads: 38
skatamatic skatamatic is offline Offline
Posting Whiz

Re: Chess...confusing problem =(

  #7  
Jan 8th, 2009
Originally Posted by u8sand View Post
Well before you do anything, might wana fix a lil problem w/ ur game.
Your pon can move 2 spaces even when its not its first move : /
I recomend saying if the pon is not in the start y axis, then it can only move 1 space, else it can move 2. Because pons cant move backwards, this will assure it works. But i havent looked at code first so i cant solve your problem yet. I will check.


also i moved the king allot and dident get any access violation. But i will see


hmmm yeah something must be horribly wrong with that entire project, because the pawn movement is fine >.< . Each piece has a bHasMoved member that represents whether or not it has moved, and the pawns use that to prevent them from moving more than 2 spaces after their first move.

i will redo the whole thing right now since the one i uploaded seems to be totally fried.
Reply With Quote  
Posts: 391
Reputation: skatamatic will become famous soon enough skatamatic will become famous soon enough 
Solved Threads: 38
skatamatic skatamatic is offline Offline
Posting Whiz

Re: Chess...confusing problem =(

  #8  
Jan 8th, 2009
Lol. Sorry about that everyone. Here's the new project that, other than the forementioned issue, is working fine. And regarding the implementation files, everything is inlined right now, so its all jammed in the headers. I will probably end up changing this when I start the AI to increase performance.
Attached Files
File Type: zip ChessEngine01.zip (102.7 KB, 8 views)
Reply With Quote  
Posts: 485
Reputation: daviddoria has a spectacular aura about daviddoria has a spectacular aura about daviddoria has a spectacular aura about 
Solved Threads: 31
daviddoria daviddoria is offline Offline
Posting Pro in Training

Re: Chess...confusing problem =(

  #9  
Jan 9th, 2009
Generally it's a good idea to abstract the problem into as simple and small piece of source code that you can rather than upload your entire project. This way when an answer is obtained, it will help others in the future as well, rather than just help the king move properly!

Dave
Reply With Quote  
Posts: 391
Reputation: skatamatic will become famous soon enough skatamatic will become famous soon enough 
Solved Threads: 38
skatamatic skatamatic is offline Offline
Posting Whiz

Re: Chess...confusing problem =(

  #10  
Jan 9th, 2009
Originally Posted by daviddoria View Post
Generally it's a good idea to abstract the problem into as simple and small piece of source code that you can rather than upload your entire project. This way when an answer is obtained, it will help others in the future as well, rather than just help the king move properly!

Dave


Generally, I'd agree with you. But this source is somewhat complex, and as I had already explained I'm not sure where the problem is occurring. And I think that posting about 11 hours worth of work can be beneficial to others, seeing as chess source is hard to come by.

-Update - I think I may have the king working now, but now the checkmate seems to be failing! I'll post up when I get home tonight.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the C++ Forum
Views: 427 | Replies: 9 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 9:59 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC