Skip to content

Commit

Permalink
fix(chess): missing algorithm include
Browse files Browse the repository at this point in the history
  • Loading branch information
tolstenko committed Mar 28, 2023
1 parent ad643d6 commit efc42a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 deletions.
18 changes: 9 additions & 9 deletions core/engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ void Engine::processInput() {

Vector2 Engine::getInputArrow() const { return arrowInput; }

// todo: optimize this
template <class T> std::unordered_set<T> Engine::FindObjectsOfType() {
std::unordered_set<T> ret;
for (GameObject* go : gameObjects)
if (T elem = dynamic_cast<T>(&go)) // todo: check this
ret.insert(elem);

return ret;
}
//// todo: optimize this
// template <class T> std::unordered_set<T> Engine::FindObjectsOfType() {
// std::unordered_set<T> ret;
// for (GameObject* go : gameObjects)
// if (T elem = dynamic_cast<T>(&go)) // todo: check this
// ret.insert(elem);
//
// return ret;
// }

// todo: optimize this
void Engine::Destroy(GameObject* go) { toDestroy.push_back(go); }
9 changes: 1 addition & 8 deletions core/engine/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Engine {

public:
Window* window;
// ImGuiContext *imGuiContext;

// todo: move this to a scene manager and make this private
std::unordered_set<GameObject*> gameObjects;
Expand All @@ -31,9 +30,6 @@ class Engine {
private:
bool done = false;

// Our state
bool show_demo_window = true;
bool show_another_window = false;
ImVec4 clear_color = ImVec4(0, 0, 0, 1);

// todo: move this to input class
Expand All @@ -44,17 +40,14 @@ class Engine {
std::vector<GameObject*> toDestroy;

public:
//#ifdef __EMSCRIPTEN__
// static void loop();
//#endif
Engine();
~Engine();
bool Start(std::string title);
void Run();
void Tick();
void Exit();

template <class T> std::unordered_set<T> FindObjectsOfType();
// template <class T> std::unordered_set<T> FindObjectsOfType();

void Destroy(GameObject* go);
};
Expand Down
9 changes: 2 additions & 7 deletions examples/chess/Search.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#include <iostream>
#include "Search.h"
#include "Heuristics.h"

#include "pieces/Bishop.h"
#include "pieces/King.h"
#include "pieces/Pawn.h"
#include "pieces/Knight.h"
#include "pieces/Queen.h"
#include "pieces/Rook.h"
#include "pieces/Pieces.h"
#include "algorithm"

auto Search::ListMoves(WorldState& state, PieceColor turn) -> std::vector<Move> {
vector<Move> moves;
Expand Down

0 comments on commit efc42a4

Please sign in to comment.