2023-08-19 12:56:40 -05:00
|
|
|
#ifndef BOTINTERFACE_HPP
|
|
|
|
#define BOTINTERFACE_HPP
|
|
|
|
|
|
|
|
#include "common.hpp"
|
2023-10-13 19:07:08 -05:00
|
|
|
#include <stack>
|
2023-08-19 12:56:40 -05:00
|
|
|
#include <SFML/System/Vector2.hpp>
|
|
|
|
|
2024-08-02 19:45:07 -05:00
|
|
|
class AISnake {
|
|
|
|
public:
|
|
|
|
std::stack<sf::Vector2f> path;
|
|
|
|
AISnake();
|
2024-08-03 20:42:34 -05:00
|
|
|
void GetNewPath(const sf::Vector2f& source);
|
2024-08-02 19:45:07 -05:00
|
|
|
PlayerDirection GetInput(const sf::Vector2f* source);
|
|
|
|
void UpdateProbability(int snakeSize);
|
|
|
|
void AdjustProbability(double amount);
|
2024-08-03 01:26:10 -05:00
|
|
|
void AddIteration(const int size);
|
|
|
|
void ResetPath(void);
|
|
|
|
int amountPlayed = 0;
|
2024-08-02 19:45:07 -05:00
|
|
|
private:
|
2024-08-03 01:26:10 -05:00
|
|
|
int totalLength = 0;
|
|
|
|
double average = 0;
|
2024-08-03 20:42:34 -05:00
|
|
|
double probabilityBFS = 0.800;
|
|
|
|
bool pathFailed = false;
|
2024-08-02 19:45:07 -05:00
|
|
|
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);
|
2024-08-03 01:26:10 -05:00
|
|
|
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);
|
2024-08-02 19:45:07 -05:00
|
|
|
};
|
2023-08-19 12:56:40 -05:00
|
|
|
|
|
|
|
#endif
|