Thread: Board game in C

  1. #76
    Registered User
    Join Date
    Mar 2012
    Posts
    27
    Quote Originally Posted by javaeyes View Post
    I'm sorry it didn't work out. I am torn between just giving you the code, which does no one any good, and trying to teach it, which I'm not really qualified to do. This is tough stuff, don't knock yourself too bad. As I said earlier I have a few Ws on my college transcript and it's just not the end of the world. Good luck whatever you do.
    I don't want the code. You are right it does no one any good. I want to be able to do this myself. What angers me is these idiotic posters here who post wrong things and people who support these wrong things and like their comments. I want to work on this myself and if I get it I will surely let you know. Thanks for being so patient.

  2. #77
    Registered User javaeyes's Avatar
    Join Date
    Feb 2012
    Posts
    153
    That's the spirit. Don't let yourself get too down because of what any poster writes. Hop back up on the horse. Tell me what YOU think the next step should be. And then I'll tell you why you are wrong. (kidding) I've got no problem giving small psuedo code hints and letting you write some actual code and then getting it critiqued by everyone. Write some code and post it, that's what the forum is for.

  3. #78
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    > What angers me is these idiotic posters here
    I don't see any idiotic posters in this thread. Are you mad because someone noticed what you *might* be doing and posted about it? You certainly aren't helping your case by being defensive, calling them idiots, and writing a huge rambling post on why they're wrong.

    > and people who support these wrong things and like their comments
    Quit being passive-aggressive. You're clearly referring to oogabooga's post that I liked, so if you truly feel the need to be angry over a liked post, at least be up-front about it.

    And also, I still agree with oogabooga. When someone who is actually writing code is accused of not writing code, their first reaction is usually to post the said code to prove them wrong. Given that you've posted twice since then and not actually provided evidence of doing work, it makes the whole thread seem more like the code fishing it probably is.

  4. #79
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I believe sssk has shown a LOT of patience with a fair amount of "preaching" from the forum members, AND I believe the forum members have been VERY patient with the way in which the problem was presented. Then seemingly changed. Then changed again. For instance, i went to the puzzle website and played a few games of this, and it definitely allowed you to cross over a square that was already marked - but later on, the OP says you can't do that.

    Uh huh. Definitely confusing to us. We're used to nearly perfect criteria for a program. Any amount of fog in them, and it appears like the pitch black hole to nowhere, to us.

    I'd like to thank sssk for bringing this puzzle problem into the forum - it's a good one. I hope to spend some more time with it.

    Still hard to imagine that a student with less than 3 months of C programming, is working on a program like this, but I'm making no judgements there. It's tough to work like a lumberjack, when all you've got is a pocket knife.

    If you're looking for the logic to solve this sssk, the logic was given in Quzah's post earlier in this thread.

  5. #80
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    i scanned through the thread, can anybody outline what the actual problem is clearly? i could not get the link provided to open you see, It was blocked on this computer.

    Is it pathfinding? sounds like the depth first search sometimes,
    Would this be a valid path (numbers represent steps through a 9x9 if you like)

    123
    456
    789

    It sounds interesting, at least it would if i knew the rules concisely!
    what about invalid paths ? Was it cleared up if there are 'non walkable' tiles to start with in the area? Or does it just mean 'some tiles become invalid for that path once they have been interacted with in a certain way?
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  6. #81
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    This is puzzle #1 from the website. [ ] represents a square shape and 0 a circle.
    Code:
    
     0  [ ] [ ]
     0  [ ]  0
    [ ]  0   0
    
    The correct moves are numbered:
     1   8   2
     5   9   4
     6   7   3
    
    Note that this puzzle requires no backtracking to be solved. Other puzzles did require it, however.

    The solver on the website lists how many paths failed in the puzzle, and how many succeeded. Every solution was shown for the small puzzles, not just one.

    Puzzles sizes range from 3 x 3 to 5 x 5 on the website, but the OP needed to extend it to 9 x 9 size.

    On the website, the first sqr moved to is given, and changes. The OP wanted the first sqr to always be the 0,0 sqr.

    The website also had the ability to give you either a few pre-set puzzles, or it could generate a puzzle for you. The generated puzzles may not have a solution, however.

    The puzzle above has only two colors and shapes, but other puzzles had three colors. I believe the puzzle could have any number of shapes and colors, and at the larger sizes, would have to have them, to be any challenge.


    This was the second puzzle from the website:
    Code:
    
    [ ]  0  [ ]
     0   0   0
    [ ] [ ]  0
    
    Starting square is given as 1,1
     5   2   6
     9   1   8
     4   3   7
    
    This is what the website output looks like:
    Soln: ,11,10,12,02,00,20,22,21,01 (col,row)
    Soln: ,11,01,21,22,20,00,02,12,10 (col,row)
    Total solutions: 2

    Total falsePaths: 15

    The website puzzle allows crossing back over a square that was already marked as a move, but the OP seemed to not allow that - I'm not quite sure what he meant, though. Lost some interest at that point.
    Last edited by Adak; 04-03-2012 at 08:23 AM.

  7. #82
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    thanks man, its still not too clear but i wil look properly tomorrow, am confused by first 'correct moves' in terms of indicies(?) but like i say, will check tomorrow.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  8. #83
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    The website used col, row order of indices.

    Another difference between the OP and the website. On the website, the starting square was given - you had no choice in the matter.

    The OP stated that in his assignment, all the starting squares would be at row 0, column 0. I'm not sure why that would effect the program. Seems like the logic stays the same.
    Last edited by Adak; 04-03-2012 at 05:24 PM.

  9. #84
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Adak View Post
    The correct moves are numbered:
    1 8 2
    5 9 4
    6 7 3

    Note that this puzzle requires no backtracking to be solved.
    What do you mean by backtracking? Typically we mean that the solver hit a dead end, and went back to an earlier position to try from there:

    0/0 > 0/1 no, backtrack to 0/0
    0/0 > 0/2 yes
    0/2 > 0/1 no backtrack to 0/2



    Quzah.
    Hope is the first step on the road to disappointment.

  10. #85
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by quzah View Post
    What do you mean by backtracking? Typically we mean that the solver hit a dead end, and went back to an earlier position to try from there:

    0/0 > 0/1 no, backtrack to 0/0
    0/0 > 0/2 yes
    0/2 > 0/1 no backtrack to 0/2



    Quzah.
    In the games I've programmed, that wouldn't be backtracking, since the move to row 0/col 1 is illegal. It would never be a part of a solution set of moves.

    A backtrack is where the legal moves the program has been finding, reaches a dead end, but has not reached every square yet, and must go back.

    If you use row major, order, with a nested column loop, the first puzzle is solved, with no backtracking. The second puzzle however, requires it, if you use that same logic.

    If you are defining illegal moves as part of the move set, then your definition of backtracking differs from mine.

  11. #86
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Adak View Post
    In the games I've programmed, that wouldn't be backtracking, since the move to row 0/col 1 is illegal. It would never be a part of a solution set of moves.

    A backtrack is where the legal moves the program has been finding, reaches a dead end, but has not reached every square yet, and must go back.

    If you use row major, order, with a nested column loop, the first puzzle is solved, with no backtracking. The second puzzle however, requires it, if you use that same logic.

    If you are defining illegal moves as part of the move set, then your definition of backtracking differs from mine.
    Yeah. That makes more sense. I was mixing up checking directions to go with going there then checking I guess. The only reason you don't backtrack though is because in your effort to solve it, you went clockwise while you made your "where do I go" selections:
    Code:
     0  [ ] [ ]
     0  [ ]  0
    [ ]  0   0
    
    The correct moves are numbered:
     1   8   2
     5   9   4
     6   7   3
    Had you gone counter-clockwise, you would have gone from 0/0 to 1/0, and you would have had to backtrack. My point was that there is very likely a chance that you had to backtrack to solve this, and if you didn't, it was really pure luck. Or because you did a BFS search instead of a DFS search.


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Board Game
    By Tiago in forum C Programming
    Replies: 4
    Last Post: 04-10-2010, 09:33 AM
  2. Tilting board game
    By vonxi in forum Game Programming
    Replies: 6
    Last Post: 02-18-2010, 01:06 PM
  3. Replies: 1
    Last Post: 09-04-2007, 05:31 AM
  4. Game Programming Board improvements
    By JoshG in forum Game Programming
    Replies: 8
    Last Post: 10-17-2002, 03:32 PM
  5. Board Game
    By Govtcheez in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 08-17-2001, 12:29 PM