src/game/computer.cpp
// Calculate and return the best input to achieve the current state.
Calculate and return the best input to achieve the current state.
Calculate and return the best input to achieve the current state .
Input Computer::calculateInput(tetris::Ai::State state) const {
		Input input{};
		if (state.rotationLeft > 0) {
			input.rotate = !input_.rotate;
		}
		if (state.left > 0) {
			input.left = true;
		} else if (state.left < 0) {
			input.right = true;
		}
		if (state.left == 0 && state.rotationLeft == 0) {
			input.down = true;
		}
		return input;
	}
Input Computer :: calculateInput ( tetris :: Ai :: State state ) const { Input input { } ; if ( state . rotationLeft > 0 ) { input . rotate = ! input_ . rotate ; } if ( state . left > 0 ) { input . left = true ; } else if ( state . left < 0 ) { input . right = true ; } if ( state . left == 0 && state . rotationLeft == 0 ) { input . down = true ; } return input ; }
Calculate and return the best input to achieve the current state.
Calculate and return the best input to achieve the current state .