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. 1 2572
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.progr amming,
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.l earn.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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Will McGugan |
last post by:
Hi folks,
I've written a Python chess module that does the following.
* Reads / Writes PGN files
* Write FEN files
* Validates moves
* Lists legal moves
* Detects check / mate / stalemate / 50 move rule / threefold repetition
|
by: derian |
last post by:
Do you guys know if there is a program that can generate chess moves? I
recently wrote a chess game but its only 2 player... I deceided it
was too difficult to come up with the logic for the AI movements... anyone
know where i can find a DLL that will generate chess moves? Ideally, the
DLL would accept moves made by the human player and generate an AI move
based on that. Any help would be much appreciated
:\\ME
|
by: Gregc. |
last post by:
G'day
I am writing a chess program. Here is my code:
#include <stdio.h>
#include <stdlib.h>
bool isInCheck (int krow, int kcol, int qrow, int qcol)
{
double check;
|
by: Paolo Pantaleo |
last post by:
Well Python is not a good language for writing a chess engine (even if
a chess engine exists:
http://www.kolumbus.fi/jyrki.alakuijala/pychess.html), but it could be
grat for chess interfaces, for drawing boards, and similar things. I
foudn out a library for these things
(http://www.alcyone.com/software/chess/). Does anyone konw about more
chess related modules?
Thnx
PAolo
|
by: Varun Hiremath |
last post by:
Hello,
I have written a chess client using python which is a graphic
interface to play chess. It is at present a two player version,
players move their peices by clicking two squares on the board as
in any other chess clients.
Now i want to interface my program with the already available
gnuchess program. Basically i want to feed the user input to the
gnuchess and get the output and then display in my GUI. I have read
about Popen but i...
| |
by: biyubi |
last post by:
Hi, a year ago I won the 2005 Best Game categoryof the International
Obfuscated C Code Contestwith a chess program.
http://www.ioccc.org/whowon2005.html
http://www.mailcom.com/ioccc/toledo/hint.htmBut this post is because I
have discovered (asurprise for me) that it is also the worldsmallest
chess program written in C language.It has a size of 3004 bytes, or
2261 bytes simplydeleting all the spacing that makes the knightfigure,
cutting...
|
by: CoreyWhite |
last post by:
When playing games, perhaps the most simple is tic-tac-toe. The game
has two simple strategies, one is defensive and the other offensive.
It is not hard at first to learn how to tie games when playing an
opponent. And then the next stage in development comes after you
learn how to beat an opponent. You really can only employ either
strategy when you get to make the first move, and your opponent will
quickly learn what you are doing...
|
by: sam_cit |
last post by:
Hi Everyone,
I'm working on developing a chess game and i decided to use c++ for
its object oriented approach. I have a bass class unit and is
inherited to distinct number of units (like king, queen, pawns
etc...), i will have pure virtual functions in the base class for
move(), attack() etc which are applicable to all units and would
override them in the child classes. Function specific to pawn like
recovering of another unit once it...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |