You are not logged in.

#1 2019-05-22 05:26:55

Gugi
Member
Registered: 2019-01-15
Posts: 23
Website

[C++] {Chess Game} How to makes pawns movable

Hello, i am working on my own project - ChessGame.
I am looking for the way to makes pawns movable with directions ;d

I am thinking about Void, and makes groups like Queen / King / Pawn etc and there code their movements

Any ideas how it should looks like?

I am using C++ Builder.

I am here :

Its looks like:
https://imgur.com/v9LoPr8

Thinking about this, but maybe i am wrong

void __fastcall TForm1::pionblack1MouseMove(TObject *Sender,
      TShiftState Shift, int X, int Y)
{
 
}
//---------------------------------------------------------------------------

Regards,
Gugi

Last edited by Gugi (2019-05-22 05:37:56)


- I am using Arch BTW

Offline

#2 2019-05-22 13:23:27

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: [C++] {Chess Game} How to makes pawns movable

Does this question actually have anything to do with chess, or is your question simply how to enable drag-and-drop for a widget in whatever toolkit you are using?

If the latter, google for that, and the answers should be readily found.

If the former, I think you're really putting the cart before the horse.  Plan your data structures.  How will board positions be represented, and how are 'moves' represented in your data.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2019-05-22 14:14:22

Gugi
Member
Registered: 2019-01-15
Posts: 23
Website

Re: [C++] {Chess Game} How to makes pawns movable

single one part of board named in example: A1, A2... A8 ... H1 to H8 .
thinking about class pawn / bishock / queen / king / tower etc and makes them public, so i dont have to code single pawn in game, just let them acces to class with configured ways of moving ;D


- I am using Arch BTW

Offline

#4 2019-05-22 14:23:03

ayekat
Member
Registered: 2011-01-17
Posts: 1,589

Re: [C++] {Chess Game} How to makes pawns movable

And how exactly do you represent "This particular pawn is currently on C5"? Is there some "board" object that contains a list of pieces (and their individual positions)? Or does each piece manage its own position on the board?


pkgshackscfgblag

Offline

#5 2019-05-22 14:35:21

Gugi
Member
Registered: 2019-01-15
Posts: 23
Website

Re: [C++] {Chess Game} How to makes pawns movable

ayekat wrote:

And how exactly do you represent "This particular pawn is currently on C5"? Is there some "board" object that contains a list of pieces (and their individual positions)? Or does each piece manage its own position on the board?

Every single piece of board got single position, still thinking if it will help or makes things harder..?


- I am using Arch BTW

Offline

#6 2019-05-22 15:11:03

ayekat
Member
Registered: 2011-01-17
Posts: 1,589

Re: [C++] {Chess Game} How to makes pawns movable

Gugi wrote:

Every single piece of board got single position, still thinking if it will help or makes things harder..?

Well… yeah, that's a requirement for playing Chess (you can't have two pieces on the same field).
But how do you represent that in your code? Which data structure (or "class", as you seem to want to do this in an object-oriented language) holds what information?


pkgshackscfgblag

Offline

#7 2019-05-23 17:05:09

Gugi
Member
Registered: 2019-01-15
Posts: 23
Website

Re: [C++] {Chess Game} How to makes pawns movable

Actually i dont, i am looking for.


- I am using Arch BTW

Offline

Board footer

Powered by FluxBB