Browse Source

more comments

Kajetan Johannes Hammerle 3 years ago
parent
commit
25d6d5eb51
1 changed files with 3 additions and 7 deletions
  1. 3 7
      source/Game.cpp

+ 3 - 7
source/Game.cpp

@@ -75,11 +75,6 @@ bool Game::parseLine(const String& line) {
             line == "************************Player 2 won!**********************") {
         // stop the game if anybody wins - the server does not do that
         std::cerr << line << "\n";
-        
-        //std::cerr << "Turns: " << turns << "\n";
-        //std::cerr << "Moves: " << moves << "\n";
-        //std::cerr << "Total selection time: " << selectionTime << "\n";
-        //std::cerr << "Total move time: " << moveTime << "\n";
         std::cerr << turns << "," << moves << "," << selectionTime << "," << moveTime << "\n";
         return true;
     }
@@ -193,7 +188,7 @@ uint Game::move(const Vector& from, const Vector& to) {
     direction = to - from;
     // remember the old location to block moving to it again
     lastLocations.add(from);
-    // actually from the stone
+    // actually move the stone
     fields.setState(to, fields.getState(from));
     fields.setState(from, Fields::EMPTY);
     // get the enemy by inverting the goal state
@@ -347,6 +342,7 @@ bool Game::isTakingPossible() const {
         // check if any white neighbored stone can move to the found empty stone
         for(Vector& m : neighbours) {
             Vector from = to + m;
+            // prevent invalid moves
             if(!isInRange(from) || !areNeighbors(from, to) || !fields.hasState(from, Fields::WHITE)) {
                 continue;
             }
@@ -385,4 +381,4 @@ uint Game::getBestEnemyRank() const {
 
 long int Game::getNanos() {
     return std::chrono::high_resolution_clock::now().time_since_epoch().count();
-}
+}