wip
This commit is contained in:
@@ -3,9 +3,14 @@
|
||||
#include <algorithm>
|
||||
#include "field.h"
|
||||
|
||||
|
||||
using Tile = unsigned long long int;
|
||||
|
||||
void printVecOfPos(const std::vector<Position> &positions) {
|
||||
for (const auto &pos : positions) {
|
||||
std::cout << pos.x << ' ' << pos.y << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
Field field(4);
|
||||
char action;
|
||||
@@ -20,18 +25,26 @@ int main() {
|
||||
switch (action) {
|
||||
case 'w':
|
||||
field.move(Direction::up);
|
||||
printf("EMPTY POSITIONS");
|
||||
printVecOfPos(field.getEmptyTiles());
|
||||
field.spawnTile(field.getEmptyTiles());
|
||||
break;
|
||||
case 's':
|
||||
field.move(Direction::down);
|
||||
printf("EMPTY POSITIONS");
|
||||
printVecOfPos(field.getEmptyTiles());
|
||||
field.spawnTile(field.getEmptyTiles());
|
||||
break;
|
||||
case 'a':
|
||||
field.move(Direction::left);
|
||||
printf("EMPTY POSITIONS");
|
||||
printVecOfPos(field.getEmptyTiles());
|
||||
field.spawnTile(field.getEmptyTiles());
|
||||
break;
|
||||
case 'd':
|
||||
field.move(Direction::right);
|
||||
printf("EMPTY POSITIONS");
|
||||
printVecOfPos(field.getEmptyTiles());
|
||||
field.spawnTile(field.getEmptyTiles());
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user