Page 1 of 1
Program C++/Java
Posted: January 8th, 2011, 1:13 am
by vidyevad
I want to write a command line program in C++/Java with ? Input: a list of space separated numbers, each 0-63. The first number is the position of a knight on a chess board. Subsequentnumbers are the positions of one or more pawns on the chessboardOutput: a sequence of legal moves the knight makes to go and capture all the pawns. The moves can be output as a sequence ofnumbers representing squares on the chessboard.Numbers relate to squares on the board, where0 is a11 is b1?8 is a2?.63 is h8in normal chess notation.A chess board is notated as follows:87654321 A B C D E F G HExample:prompt> yourProgramExecutable 18 23 61 282122923385561Any idea on this?
Program C++/Java
Posted: January 8th, 2011, 5:59 pm
by Hansi
What's the problem?
Program C++/Java
Posted: January 10th, 2011, 3:33 am
by vidyevad
I have no idea. can someone please give me some idea? how shall i start?
Program C++/Java
Posted: January 10th, 2011, 9:19 am
by Hansi
What do you know? What is stopping you from just writing the code?
Program C++/Java
Posted: January 10th, 2011, 9:28 am
by daveangel
QuoteOriginally posted by: vidyevadI have no idea. can someone please give me some idea? how shall i start?
Program C++/Java
Posted: January 10th, 2011, 11:55 am
by ExSan
QuoteOriginally posted by: vidyevadI have no idea. can someone please give me some idea? how shall i start? first, is the problem clear for you ?
Program C++/Java
Posted: January 10th, 2011, 1:23 pm
by Etuka
Problem is not clear to me either. what is a legal sequence of knight moves that takes all pawns? I imagine that it would have a possible movement of an opposing pawn in between each knight move...
Program C++/Java
Posted: January 10th, 2011, 2:32 pm
by vidyevad
Pawns are not going to move. When knight moves, it can move two squares horizontally and one square vertically, or two squares vertically and one square horizontally. I am trying write a function to calculate legal movement of the knight. Initially, I was thinking to add(+6,+15,+17,+10,-10,-17,-15,-6) to knight's position. But, its not going to work.