wip
This commit is contained in:
@@ -3,9 +3,14 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "field.h"
|
#include "field.h"
|
||||||
|
|
||||||
|
|
||||||
using Tile = unsigned long long int;
|
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() {
|
int main() {
|
||||||
Field field(4);
|
Field field(4);
|
||||||
char action;
|
char action;
|
||||||
@@ -20,18 +25,26 @@ int main() {
|
|||||||
switch (action) {
|
switch (action) {
|
||||||
case 'w':
|
case 'w':
|
||||||
field.move(Direction::up);
|
field.move(Direction::up);
|
||||||
|
printf("EMPTY POSITIONS");
|
||||||
|
printVecOfPos(field.getEmptyTiles());
|
||||||
field.spawnTile(field.getEmptyTiles());
|
field.spawnTile(field.getEmptyTiles());
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
field.move(Direction::down);
|
field.move(Direction::down);
|
||||||
|
printf("EMPTY POSITIONS");
|
||||||
|
printVecOfPos(field.getEmptyTiles());
|
||||||
field.spawnTile(field.getEmptyTiles());
|
field.spawnTile(field.getEmptyTiles());
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
field.move(Direction::left);
|
field.move(Direction::left);
|
||||||
|
printf("EMPTY POSITIONS");
|
||||||
|
printVecOfPos(field.getEmptyTiles());
|
||||||
field.spawnTile(field.getEmptyTiles());
|
field.spawnTile(field.getEmptyTiles());
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
field.move(Direction::right);
|
field.move(Direction::right);
|
||||||
|
printf("EMPTY POSITIONS");
|
||||||
|
printVecOfPos(field.getEmptyTiles());
|
||||||
field.spawnTile(field.getEmptyTiles());
|
field.spawnTile(field.getEmptyTiles());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user