snakeplusplus/src/botinterface.hpp

33 lines
994 B
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 GetNewPath(const sf::Vector2f& source, const sf::Vector2f& boundaries, const int snakeSize);
PlayerDirection GetInput(const sf::Vector2f* source);
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.500;
std::stack<sf::Vector2f> botPathUnsanitized;
void BFS(const sf::Vector2f& source, const sf::Vector2f& boundaries);
void DFS(const sf::Vector2f& source, const sf::Vector2f& boundaries);
sf::Vector2f GetAnyOpenPath(const sf::Vector2f& source);
void UnvisitBoard(void);
void UpdateAverage(const int size);
void TrimPath(void);
};
#endif