snakeplusplus/src/botinterface.hpp

49 lines
1.2 KiB
C++
Raw Normal View History

#ifndef BOTINTERFACE_HPP
#define BOTINTERFACE_HPP
#include "common.hpp"
2023-10-13 19:07:08 -05:00
#include <stack>
#include <SFML/System/Vector2.hpp>
class AISnake {
public:
std::stack<sf::Vector2f> path;
AISnake(void);
void GetNewPath(void);
PlayerDirection GetInput(void);
void UpdateProbability(int snakeSize);
void AdjustProbability(double amount);
void AddIteration(const int size);
void ResetPath(void);
int amountPlayed = 0;
private:
int totalLength = 0;
double average = 0;
double probabilityBFS = 0.200;
2024-08-03 20:42:34 -05:00
bool pathFailed = false;
// Generic search algorithms
std::stack<sf::Vector2f> botPathUnsanitized;
void BFS(void);
void DFS(void);
sf::Vector2f GetAnyOpenPath(void);
void UnvisitBoard(void);
void UpdateAverage(const int size);
void TrimPath(void);
2024-08-03 20:42:34 -05:00
void EmptyPath(void);
// Unsupervised learning
// Make decisions about current state of board
double probabilityUp = 0.25;
double probabilityDown = 0.25;
double probabilityLeft = 0.25;
double probabilityRight = 0.25;
PlayerDirection CurrentBestDecision(void);
void CheckLocalFreedom(void);
void CheckFoodDirection(void);
void RemoveImpossibleChoice(void);
};
#endif