469,643 Members | 1,772 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

Who's for chess?

Hi,
I am writing some C++ code, and the problem is analogous to the
following situation:

Take a Chess Board of 8x8 (nxn) blocks and I have 8 (n) horses. Like
in chess, the horses are placed at a distance of 2 and a half blocks
apart from the preceding horse. For example, Horse B is at a distance
of 2 and a half blocks from horse A, Horse C is at a distance of 2 and
a half blocks from horse B and so on. If one of the horses is moved
to any different block on the board, the other horses should realign
themselves so that the distances between the horse and the preceding
horse should always be 2 and a half blocks.

So, how can I ensure this?

Thanks!
Paul.
Jul 22 '05 #1
1 2433
Paul Franklin wrote:
Hi,
I am writing some C++ code, and the problem is analogous to the
following situation:

Take a Chess Board of 8x8 (nxn) blocks and I have 8 (n) horses. Like
in chess, the horses are placed at a distance of 2 and a half blocks
apart from the preceding horse. For example, Horse B is at a distance
of 2 and a half blocks from horse A, Horse C is at a distance of 2 and
a half blocks from horse B and so on. If one of the horses is moved
to any different block on the board, the other horses should realign
themselves so that the distances between the horse and the preceding
horse should always be 2 and a half blocks.

So, how can I ensure this?

Thanks!
Paul.


This is a good discussion issue for news:comp.programming,
where algorithms are discussed. This isn't a C++ language
issue, so I am setting the followups.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library

Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Will McGugan | last post: by
5 posts views Thread by derian | last post: by
11 posts views Thread by Gregc. | last post: by
5 posts views Thread by Paolo Pantaleo | last post: by
1 post views Thread by Varun Hiremath | last post: by
63 posts views Thread by biyubi | last post: by
2 posts views Thread by CoreyWhite | last post: by
10 posts views Thread by sam_cit | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.