-
March 4th, 2005, 11:35 PM
#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!
-
March 5th, 2005, 12:04 AM
#2
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)
-
March 5th, 2005, 12:13 AM
#3
oh ok..thanks...I just can't figure out how to do it..
-
March 5th, 2005, 12:15 AM
#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...
-
March 5th, 2005, 02:26 AM
#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?
-
March 5th, 2005, 02:46 AM
#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.
If the only tool you have is a hammer, you tend to see every problem as a nail.
(Abraham Maslow, Psychologist, 1908-70)
-
March 5th, 2005, 03:23 AM
#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.
-
March 5th, 2005, 03:46 AM
#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.
-
March 5th, 2005, 03:58 AM
#9
-
March 5th, 2005, 04:24 AM
#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.
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
-
Forum Rules
|
|