snakeplusplus/src/botinterface.hpp

35 lines
932 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();
2024-08-03 20:42:34 -05:00
void GetNewPath(const sf::Vector2f& source);
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;
2024-08-03 20:42:34 -05:00
double probabilityBFS = 0.800;
bool pathFailed = false;
std::stack<sf::Vector2f> botPathUnsanitized;
2024-08-03 20:42:34 -05:00
void BFS(const sf::Vector2f& source);
void DFS(const sf::Vector2f& source);
sf::Vector2f GetAnyOpenPath(const sf::Vector2f& source);
void UnvisitBoard(void);
void UpdateAverage(const int size);
void TrimPath(void);
2024-08-03 20:42:34 -05:00
void EmptyPath(void);
};
#endif