Othello game, gave up debugging

This is a discussion on Othello game, gave up debugging within the Game Programming forums, part of the General Programming Boards category; >> evalVal = minimax( depth + 1, otherPlayer( player ), boardCopy, &chosenMove ); This line is within the minimax() function. ...

  1. #16
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >> evalVal = minimax( depth + 1, otherPlayer( player ), boardCopy, &chosenMove );

    This line is within the minimax() function. Here, chosenMove is already a pointer, so you don't need to pass it's address.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  2. #17
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    WOW i changed the last lines of minimax function to
    Code:
    if (mode==MAXIMIZE)
      return max;
    else
      return min;
    and i lost 3 times in a row!!

    By the way i still haven't swapped this

    Code:
    if ( mode == MINIMIZE )
             if ( evalVal > max) {
                max = evalVal;
                chosenMove->row = listMoves[ counter ].row;
                chosenMove->col = listMoves[ counter ].col;
             }
          else if ( mode == MAXIMIZE )
             if ( evalVal < min ) {
                min = evalVal;
                chosenMove->row = listMoves[ counter ].row;
                chosenMove->col = listMoves[ counter ].col;
             }
    back yet because for some reason it plays very bad if i do it. I think this is anothr implementation bug.

    But thanks a 'lot' PJYelton. You're so cute ^.^, ( i mean your avatar);

  3. #18
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    but chosenMove is a structure? Does that make a difference?

    Also,,i found that losing 3 times is just a coincidence..
    There is still the generateMoves() bug which reports the wrong number of moves. But it could be errors in other functions which are causing this.
    Last edited by Nutshell; 01-24-2003 at 05:39 PM.

  4. #19
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    updated source file
    Attached Files Attached Files

  5. #20
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    I looked over the new source and made some changes, tell me if they work or not! I can't test it since when I try running with MSVC++ it doesn't like a lot of your things like KB_HIT and gotoxy etc. I also commented where I made the changes. I only really looked at the minimax function though!
    Attached Files Attached Files

  6. #21
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    Hi,

    The code compiles, but it doesn't run. I could not choose the game mode, nothing responds. It compiles, but doesn't run properly.

    Also, i realli thought of your way to undo the move, but you haven't taken into account to undo the 'flipped' pieces, and turn them back into their color before.

    I've attached the compiled exe. I also tried only changing the

    Code:
    if ( player == 'X' )
       mode = MAXIMIZE
    else
       mode = MINIMIZE
    But the compiled result is the same, didn't work.
    Attached Files Attached Files

  7. #22
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Oops, you're right about the changed pieces, guess you need the loop then. I have no idea why its not working now, all I changed was the stuff in the minimax function, none of which should have done anything...

  8. #23
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    The only thing I can think of at the moment would be to go back to your last working version and make the changes that I wrote about. Try that and see what happens. My changes should in no way screw up the rest of the program like that since you haven't even called minimax yet!

    Let me know what happens!

  9. #24
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Also, give this file a try:
    Attached Files Attached Files

  10. #25
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    Nope, the same thing occurred, exe doesn't work. And that is troubling me too, minimax isn't called on yet!!

    Ugh,,,,my heads gonna explode.

    I'll play my piano for a while..

    This problem is so illogical.

  11. #26
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Did you try going back to your last working source code and making the changes I wrote down?

  12. #27
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    Yes, but the compiled exe won't work if i made those changes, not even one.

  13. #28
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    But it works without the changes?? Doesn't make any sense! Go back to the last working exe, make one change at a time, and test it. See where it is screwing up. But make sure that the the source works first before changing anything.

  14. #29
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    That's what i tried. Can you please try it? I've attached the files required to compile my code, if you have time, pls try it yourself.
    Attached Files Attached Files

  15. #30
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    I need keys.h first.

    When you added one change at a time and ran it, at what point did it screw up?

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open-source Game Project
    By Glorfindel in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 03-24-2009, 01:12 AM
  2. So you want to be a game programmer?
    By dxfoo in forum Game Programming
    Replies: 23
    Last Post: 09-26-2006, 08:38 AM
  3. C++ Game of Life Program
    By rayrayj52 in forum C++ Programming
    Replies: 16
    Last Post: 09-26-2004, 03:58 PM
  4. Try my game
    By LuckY in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-15-2004, 11:58 AM
  5. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21