apos algum profiling
[xYpjg3TdSw.git] / migrando / RandomEnemy.cpp
blob557baea2c48704033bfba2ff58e8c064fd3cdd94
1 #include "RandomEnemy.h"
2 #include "Board.h"
4 #include <cstdio>
6 void RandomEnemy::move(Board *board, int& fromX, int& fromY, int& toX, int& toY)
8 _board = board;
10 Board::MoveList moveList;
11 _board->all_moves(_player, moveList);
13 int choice = rand() % moveList.size();
16 printf("choice: %i\n", choice);
17 reps(i, moveList) {
18 printf("%i: (%i, %i) -> (%i, %i)\n", i, INDEX_X(moveList[i].first), INDEX_Y(moveList[i].first)
19 , INDEX_X(moveList[i].second), INDEX_Y(moveList[i].second));
20 fflush(stdout);
21 } //*/
23 fromX = INDEX_X(moveList[choice].first);
24 fromY = INDEX_Y(moveList[choice].first);
25 toX = INDEX_X(moveList[choice].second);
26 toY = INDEX_Y(moveList[choice].second);