From Abstract

create your AI from the abstract, means creating all algorithme

My AI class

Your IA class have to be an inheritance of AbstractIA. This abstract gives you all functions you need.

// This class is the example of benji-35 doc for Gomoku game

#include "Gomoku.hpp"

namespace Gomoku {

    class MyAI : public AbstractIA {
        public:
            MyAI();
            ~MyAI();

            Vector chooseBestMove() override;

        protected:
        private:
    };

}

Overriding function

In this class there is only 1 function to override :

  • chooseBestMove that return a Vector.

This function is your algoritm for you AI. this is here tht you make your calculs.

Tools

[FUNC] canMoveAtPos(x, y) or canMoveAtPos(Vector)

This is a function in AI abstract class. This function checks if you can move at position x and y.

If you can, it returns true otherwise it returns false.

[FUNC] getBoard()

This is a function in AI abstract class. This function gives you the current board game in vector of string.

[FUNC] getHistory()

This is a function in AI abstract class. This function gives you the game history in vector of Vector.

[FUNC] getBoardWidth()

This is a function in AI abstract class. This function gives you the board width in std::size_t.

[FUNC] getBoardHeight()

This is a function in AI abstract class. This function gives you the board height in std::size_t.

[FUNC] getGameChar()

This is a function in AI abstract class. This function gives you the char in board of your opponent.

[FUNC] getIAChar()

This is a function in AI abstract class. This function gives you the char in board of your AI.

[FUNC] getEmptyChar()

This is a function in AI abstract class. This function gives you the char in board of empty place.

[FUNC] posIsPlayed(x, y) or posIsPlayed(Vector)

This is a function in AI abstract class. This function return if position is already played by someone.

[FUNC] whoPlayedAt(x, y) or whoPlayedAt(Vector)

This is a function in AI abstract class. This function return who played a specific position (value type: MoveType)

Last updated