-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMagic_Tiles.h
More file actions
33 lines (27 loc) · 749 Bytes
/
Magic_Tiles.h
File metadata and controls
33 lines (27 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once
#ifndef MAGIC_TILES
#define MAGIC_TILES
#include <fstream>
#include <string>
using namespace std;
struct Tile { // Struct to represent each tile with name, edges values and orientation.
string name;
int numArray[4];
int rotation = 0;
};
class Magic_Tiles
{
public:
Magic_Tiles(ifstream& inFile); // Constructor
void solve(int index); // Solves puzzle
void rotateBoard(); // Rotates entire board
void printBoard(); // Prints current board configuration
~Magic_Tiles();
private:
bool found = false;
void swap(int x, int y); // Swap function for parmutations
void rotateTile(int tileNum); // rotates a tile
bool edgesMatch(int position); // Compares edges based on position
Tile tileArray[9];
};
#endif