chessboard in C language
Results 1 to 10 of 10

Thread: chessboard in C language

  1. #1

    Talking chessboard in C language

    I have a school project.They want me to write a program in C language that will make all the
    moves of the knight in the middle of the chess board.The knight will be placed in the middle of the chess board and I have to get all the possible moves of the knight in the middle of the board.Can someone pls help me code this program?Thanks in advance!

  2. #2
    Senior Member
    Join Date
    Mar 2004
    Posts
    557
    Hi

    Your first post and you assign us with your assignment?

    I do not understand your description but are you talking about
    the "famous" knight problem[1]? If so, then don't worry - it has
    been solved for the 8x8 chessboard already in August 2003...[2]

    As per how to solve it (it's just an NP hard problem ...): you need all
    the moves. So, the only thing you can do is using a "backtracking"-algorithm.
    In its simplest realisation, this is implemented using recursive functions.

    You'll figure it out, I am sure.
    Good luck.'
    Cheers

    p.s. while looking for a page which describes the backtracking algorithm
    I stumbled across a solution to the knight problem ...

    [1] http://en.wikipedia.org/wiki/Knight%27s_Tour
    [2] http://mathworld.wolfram.com/news/20...06/magictours/
    If the only tool you have is a hammer, you tend to see every problem as a nail.
    (Abraham Maslow, Psychologist, 1908-70)

  3. #3
    oh ok..thanks...I just can't figure out how to do it..

  4. #4
    I checked on the wikipedia link you gave..that's the exact thing I want to happen with my program.I wish I could get a C code for that...

  5. #5
    Senior Member
    Join Date
    Feb 2005
    Posts
    150
    All I can say is if your a beginner at C programming, that is going to be extremely difficult. Does it have to be made Graphically?

  6. #6
    Senior Member
    Join Date
    Mar 2004
    Posts
    557
    Hi

    We have here two things, which should be looked at completely decoupled
    (Microsoft should do this as well ): a functionality and its presentation.
    To develop an algorithm (the functionality) has nothing to do with its presentation
    (do I perform a graphic representation of the steps or do I just print out one
    possible "hopping sequence"). How fast would the Internet be, if a router
    calculates the best possible path while representing it graphically during the
    calculation process?



    The difficulty in the problem lies not in programming it in c/pascal/...
    (you need to know about arrays and how to define a function),
    but in the development of the algorithm.

    Essentially, you can try to formulate the algorithm with a pen and a sheet
    of paper. This is a brainteaser. To put it on the computer does not require
    more than the two things I mentioned above.

    Cheers.
    If the only tool you have is a hammer, you tend to see every problem as a nail.
    (Abraham Maslow, Psychologist, 1908-70)

  7. #7
    I could say I have a bit knowledge in C.I studied that back in college.Honestly this project is for my brother...I kinda forgot some of the syntax but I'll try to recall it. We're trying to program hard coded using the old school C environment (DOS).The graphical presentation doesnt really matter.

  8. #8
    () \/V |\| 3 |) |3\/ |\|3G47|\/3
    Join Date
    Sep 2002
    Posts
    744
    Voltagirl, typhoid mary, etc...

    You've been banned what, three or four times, now? Everytime you come back it's asking for others to do your "tech support" work, your (or your "brother's") homework, or how to bypass your admin's security settings.

    It's tiring...really.

    Go Finland!
    Deviant Gallery

  9. #9
    what do you care ?

  10. #10
    () \/V |\| 3 |) |3\/ |\|3G47|\/3
    Join Date
    Sep 2002
    Posts
    744
    I have a school project.They want me to write a program in C language
    Let us start from the beginning, shall we?

    First you LIE to us and say you are working on a school assignment. Not to mention it's your first post (under this name). Then, oh, well...no, it's not *cough* really my project.....

    Honestly this project is for my brother
    This is not the first time you've lied in a post...and then later admitted it in another post.

    what do you care ?
    Hmmm....a question so eloquently asked, I'll attempt a response.

    I care about the integrity of people....and I care about the quality of AO, both of which you are giving a bad name.

    Go Finland!
    Deviant Gallery

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •