Serving the Quantitative Finance Community

 
User avatar
vidyevad
Topic Author
Posts: 0
Joined: April 4th, 2010, 6:20 pm

Program C++/Java

January 8th, 2011, 1:13 am

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?
 
User avatar
Hansi
Posts: 41
Joined: January 25th, 2010, 11:47 am

Program C++/Java

January 8th, 2011, 5:59 pm

What's the problem?
 
User avatar
vidyevad
Topic Author
Posts: 0
Joined: April 4th, 2010, 6:20 pm

Program C++/Java

January 10th, 2011, 3:33 am

I have no idea. can someone please give me some idea? how shall i start?
Last edited by vidyevad on January 9th, 2011, 11:00 pm, edited 1 time in total.
 
User avatar
Hansi
Posts: 41
Joined: January 25th, 2010, 11:47 am

Program C++/Java

January 10th, 2011, 9:19 am

What do you know? What is stopping you from just writing the code?
 
User avatar
daveangel
Posts: 5
Joined: October 20th, 2003, 4:05 pm

Program C++/Java

January 10th, 2011, 9:28 am

QuoteOriginally posted by: vidyevadI have no idea. can someone please give me some idea? how shall i start?
knowledge comes, wisdom lingers
 
User avatar
ExSan
Posts: 495
Joined: April 12th, 2003, 10:40 am

Program C++/Java

January 10th, 2011, 11:55 am

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 ?
 
User avatar
Etuka
Posts: 1
Joined: January 1st, 2002, 7:40 pm

Program C++/Java

January 10th, 2011, 1:23 pm

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...
 
User avatar
vidyevad
Topic Author
Posts: 0
Joined: April 4th, 2010, 6:20 pm

Program C++/Java

January 10th, 2011, 2:32 pm

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.