From BasicAI

this AI help you to with some helpful functions

My AI class

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

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

#include "Gomoku.hpp"
#include "BasicAI/BasicAI"

namespace Gomoku {

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

            Vector chooseBestMove() override;
            Vector myAIAlgo() override;

        protected:
        private:
    };

}

Overriding function

In this class there is only 1 function to override :

  • chooseBestMove return a Vector.

  • myAIAlgo return a Vector.

The difference between these both function is simple :

If you override chooseBestMove, you have to rewrite all algorithme.

If you override myAIAlgo, BasicAI gonna check first your winning positions. If your AI can win, the BasicAI gonna play the position. If there is no win positions for your player, BasicAI gonna check if opponent can win. If your opponent can win, BasicAI gonna play the position. If no win positions found, BasicAI gonna call your algorithme in myAIAlgo.

Tools

All functions in AbstractIA are available in your AI.

[FUNC] getBestMoves(MoveType ref, bool preshot = false)

This function gonna find you the winning move for the ref. It return a std::vector of CheckIntel.

[FUNC] getRandomMove()

This function gives you a random available position to play.

Last updated