Commit d253e259 authored by AlaskaLinuxUser's avatar AlaskaLinuxUser

rewrote FEN due to space errors.

parent 24dbe061
No preview for this file type
......@@ -14,7 +14,9 @@
*/
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
string engineName = "picoEngine A01";
......@@ -22,6 +24,16 @@ string inputString = "";
bool runProgram = true;
bool styleRandom = false;
bool whitesTurn = true;
bool Kcastle = true;
bool Qcastle = true;
bool kcastle = true;
bool qcastle = true;
bool enPassant = false;
string enPasPawn = "";
int moveSince = 0;
int turnCount = 0;
char theBoard[] = {'r','n','b','q','k','b','n','r','p','p','p','p','p',
'p','p','p','-','-','-','-','-','-','-','-','-','-','-','-','-','-',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-',
......@@ -33,6 +45,18 @@ string algebraBoard[] = {"a8","b8","c8","d8","e8","f8","g8","h8","a7","b7",
"e4","f4","g4","h4","a3","b3","c3","d3","e3","f3","g3","h3","a2",
"b2","c2","d2","e2","f2","g2","h2","a1","b1","c1","d1","e1","f1",
"g1","h1"};
vector<string> split(string str, char delimiter) {
vector<string> internal;
stringstream ss(str); // Turn the string into a stream.
string tok;
while(getline(ss, tok, delimiter)) {
internal.push_back(tok);
}
return internal;
}
void inputUCI()
{
......@@ -67,37 +91,43 @@ void inputIsReady()
}
void inputPosition(string posString)
{
string str1 = posString.substr (9);
if (str1.rfind("fen", 0) == 0)
vector<string> sepVect = split(posString, ' ');
string str1 = sepVect[1];
if (sepVect[1] == "fen")
{
// FEN board setup.
string stringBoard = "";
string str2 = posString.substr (12);
string str2 = sepVect[2];
for (int i = 0; (unsigned)i < str2.length(); i++) {
char myChar = str2.at(i);
if (isdigit(myChar))
{
// it is a number of blank spaces.
int imyChar = myChar - '0';
{ int imyChar = myChar - '0';
for (int a = 0; a < imyChar; a++)
{
stringBoard = stringBoard + "-";
}
{ stringBoard = stringBoard + "-"; }
}
else if (isalpha(myChar))
{
// it is a letter.
stringBoard = stringBoard + myChar;
}
{ stringBoard = stringBoard + myChar; }
} // end for.
for (int i = 0; i < 64; i++) {
theBoard[i] = stringBoard.at(i);
cout << theBoard[i] << endl;
}
}
int j = stringBoard.length();
for (int i = 0; i < j; i++) {
if (i < 64){ theBoard[i] = stringBoard.at(i); }
}
if (sepVect[3].at(0) == 'w')
{ whitesTurn = true; } else { whitesTurn = false; }
if (sepVect[4].at(0) == 'K')
{ Kcastle = true; } else { Kcastle = false; }
if (sepVect[4].at(1) == 'Q')
{ Qcastle = true; } else { Qcastle = false; }
if (sepVect[4].at(2) == 'k')
{ kcastle = true; } else { kcastle = false; }
if (sepVect[4].at(3) == 'q')
{ qcastle = true; } else { qcastle = false; }
if (sepVect[5].at(0) == '-')
{ enPassant = false;} else { enPassant = true;}
moveSince = stoi (sepVect[6]);
turnCount = stoi (sepVect[7]);
} // End FEN
else if (str1.rfind("startpos moves", 0) == 0)
{
cout << "moves" << endl;
......
No preview for this file type
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment