![]() ![]() Si.hStdError=GetStdHandle(STD_ERROR_HANDLE) If(!CreatePipe(&hStderrRead,&hStderrWrite,&saAttr,0)) Create pipe for the child process's standard error If(!CreatePipe(&hStdoutRead,&hStdoutWrite,&saAttr,0)) Create pipe for the child process's standard output Printf("CreatePipe failed (%d).\n",GetLastError()) If(!CreatePipe(&hStdinRead,&hStdinWrite,&saAttr,0)) Create pipe for the child process's standard input GetLegalMoves(clickedPiece->GetPiecePositionString().c_str()) Įlse if(player_to_act = 'b') // black turn Printf("piece pos str=%s\n",clickedPiece->GetPiecePositionString().c_str()) Printf("piece clicked Rank,File: %d,%d\n",clickedPiece->GetRank(),clickedPiece->GetFileInt()) If((autoplayTimer+=MegaEngine::getDeltaTime()) > autoplayInterval)ĬhessPiece* clickedPiece=getMouseOverPiece() SaAttr.nLength=sizeof(SECURITY_ATTRIBUTES) #include "Game.h"Ĭhessboard_Sprite->init(TEXTURE_CHESSBOARD) If you tried to just copy this into your own project, it would probably be a bad example. Meanwhile, I will post the bulk of the code here (NOTE: The code is work in progress, some stuff returns wrong values etc but I myself having written the code can navigate through that. That was the question out of the way and I really hope it is possible. "Legal e2") but I am pretty sure there is NOT :( Any way at all would be great, otherwise I have to implement a lot of the logic for the whole game myself just to get this list of legal moves. If there is a command to return something like this it would be grand (eg. But using Stockfish, I cannot seem to find enough data in the "info" string or any other that I found to piece together a list of valid destination squares for the selected piece. The problem I am writing here about at this time is, I want the user to be able to click a piece (let's say he clicks Pawn e2 at the start of match), I want to highlight all the legal squares that can go to. However, when I come to include a Human player this is where I ran into problems. I can start a CPU vs CPU game and watch it moving all the pieces. I convert that string into bunch of Piece sprites and lay them out where the string dictates they should go.) I decided to make a new version, and I use the FEN string as the basis of the rendering logic (ie. ![]() Anyway, when I came to try add Stockfish as CPU opponent, I started to learn about FEN string and all that other good stuff. It ended up ok to have 1v1 against a friend locally, but really was just for fun. The first one didn't have stockfish and I done the move logic by myself. I do now have a C++ game project set up and it opens a stockfish process etc and interacts with it (sends commands and listens to commands). I've never worked with Stockfish or anything command line based like this before, so it took me a lot of getting used to in send/receiving the messages etc. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |