Author |
Message |
MysticVegeta
![](http://www.geocities.com/ohsoinsane/my_avatar.JPG)
|
Posted: Thu Oct 20, 2005 2:01 pm Post subject: Programming Problem - Knight Move! |
|
|
PS: This problem is made by me! No I dont know the solution. All Languages welcome.
A grid (x, y) represents the size of the chess board. A Knight is a piece of the chess board that only moves 21/2 steps. For Example, x marks the points where the knight moves. '0' represents his position
code: | .X.X
X...
..0.
X... |
A knight when placed in the centre of a 8 X 8 board moves in 8 directions
1) 2 steps up and 1 right
2) 2 steps up and 1 left
3) 2 steps down and 1 right
4) 2 steps down and 1 left
5) 1 step left and 2 up
6) 1 step left and 2 down
7) 1 step right and 2 up
8) 1 step right and 2 down
Your job is to calculate the minimum number of moves requried for the Knight to complete his travel on all the squares.
Input: The first line will contain the X coordinate, Y coordinate where
x, y >= 4, x = y. separated by commas
Output : The minimum number of moves required for the knight to complete his travel
Sample Input
4, 4
8, 8
Any programming language is available
Problem copyright by me |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Mazer
![](http://compsci.ca/v3/uploads/user_avatars/1323750815476d9f446d80c.png)
|
Posted: Thu Oct 20, 2005 4:58 pm Post subject: (No subject) |
|
|
What's the second line? And why bother listing x and y if, as you said, x = y?
Also, this should probably be in the contests section. |
|
|
|
|
![](images/spacer.gif) |
Blade
|
Posted: Fri Oct 21, 2005 2:46 am Post subject: (No subject) |
|
|
man, i was totally assigned that problem 2 years ago for grade 12 programming at east elgin in aylmer ontario... i dont think i have the turing file anymore but i remember i used recursive functions to solve it. |
|
|
|
|
![](images/spacer.gif) |
zylum
![](http://compsci.ca/v3/uploads/user_avatars/1689129126468091c334ee0.gif)
|
Posted: Sun Oct 23, 2005 9:07 pm Post subject: (No subject) |
|
|
here's a better one i came up with:
You are to find the fewest number of moves a knight must make to capture 0 < p <= 20 peices which are placed on various squares on an NxM chess board where 4 <= M, N <= 100. These peices are immobile and will not move.
Input:
The first line will contain N and M separated by a single space. The next line will contain the column and the row which the knight begins at, separated by a single space. The next line will be p. The next p lines will be the columns and rows of each peice separated by a single space. You can assume no set of coordinates will be repeated.
Output:
Print the fewest number of moves to capture all of the peices.
* The first person to submit a solution that runs in under 10 seconds will receive 100 bits!!! * |
|
|
|
|
![](images/spacer.gif) |
MysticVegeta
![](http://www.geocities.com/ohsoinsane/my_avatar.JPG)
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Mon Oct 24, 2005 2:47 pm Post subject: (No subject) |
|
|
No, not someone, thousands of people . I recently saw somebody doing a problem like this for a logic course, except for the whole chess board.
Quote: Problem copyright by me
*cough* |
|
|
|
|
![](images/spacer.gif) |
MysticVegeta
![](http://www.geocities.com/ohsoinsane/my_avatar.JPG)
|
Posted: Mon Oct 24, 2005 5:58 pm Post subject: (No subject) |
|
|
Quote: except for the chessboard I was trying to relate 2 of my interests lol. ah i feel sorta embarrased now ![Embarassed Embarassed](http://compsci.ca/v3/images/smiles/icon_redface.gif) |
|
|
|
|
![](images/spacer.gif) |
|