# Thread: chessboard in C language

1. ## 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. Hi

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/

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

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. 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. 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.

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. 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.

9. what do you care ?

10. 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.

#### Posting Permissions

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

×