picoEngineQueen

In my most recent commit, which you can check out in full at my GitLab, I added the ability for the queen to move to the picoEngine. This completes all of the major/minor pieces of motion, and only leaves the king and pawns to complete (believe it or not, these are the hardest to do, as they have many conditional clauses).

I actually was able to hammer this out in about 15 minutes, since it really is just a combination of the rook and bishop moves with a “q” instead of the respective letters. Since it is identical to those, I wont post much of the code here. If you are wondering, however, how I add them to the header files, it looks like this in Moves.h:

#pragma once
#include <cmath>
#include <string>
using namespace std;

class Moves {

private:
char m_theBoard[64] = {‘R’,’N’,’B’,’Q’,’K’,’B’,’N’,’R’,’P’,’P’,’P’,’P’,’P’,
‘P’,’P’,’P’,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,
‘-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,’-‘,
‘-‘,’p’,’p’,’p’,’p’,’p’,’p’,’p’,’p’,’r’,’n’,’b’,’q’,’k’,’b’,’n’,’r’};

bool m_whitesTurn = true;
bool m_Kcastle = true;
bool m_Qcastle = true;
bool m_kcastle = true;
bool m_qcastle = true;
bool m_enPassant = false;
string m_enPasPawn = “”;
int m_moveSince = 0;
int m_turnCount = 0;
// Public prototypes go here
public:

// All available moves.
string available(string boardPositions, bool whoseTurn);

// Best move.
string bestMove(string boardPositions, bool whoseTurn, bool styleRandom);

// Is the king safe?
bool isKingSafe(string boardPositions, bool whoseTurn);

// Black night moves:
string nightMovesB(string boardPositions, int i);
// white night moves:
string nightMoves(string boardPositions, int i);
// Black rook moves:
string rookMovesB(string boardPositions, int i);
// white rook moves:
string rookMoves(string boardPositions, int i);
// Black bishop moves:
string bishopMovesB(string boardPositions, int i);
// white bishop moves:
string bishopMoves(string boardPositions, int i);
// Black queen moves:
string queenMovesB(string boardPositions, int i);
// white queen moves:
string queenMoves(string boardPositions, int i);

};

After adding the command option to the header file, then I can actually create it in the Moves.cpp file:

string Moves::queenMoves(string boardPositions, int i) {
————– Abridged, see commit for details. ——————-
} // End white queen moves.

Object oriented programming (oop) is a really fun way to program. The top 2 programming languages used for video games today are Java and C++, which are both oop types of programming. Since Android devices now make up more percentage of the worlds operating system than any other operating system, and most Android games are written in oop like Java and C++, that makes sense. But even most desktop games are made with these languages as well.

Linux – keep it simple.

Leave a Reply

Your email address will not be published. Required fields are marked *