Skip to content

Instantly share code, notes, and snippets.

@poseidon4o
Created November 11, 2015 10:56
Show Gist options
  • Save poseidon4o/67ad547fdafdbe9a7035 to your computer and use it in GitHub Desktop.
Save poseidon4o/67ad547fdafdbe9a7035 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cstdint>
#include <bitset>
using namespace std;
enum FieldColor {
EMPTY = 0,
WHITE = 1,
BLACK = 1 << 1
};
struct Setter {
int index;
uint16_t &data;
Setter(uint16_t &d, int idx) : data(d), index(idx) {}
Setter & operator=(FieldColor fcolor) {
data |= (fcolor << index);
return *this;
}
};
struct GRow {
uint16_t data;
GRow() : data(0) {}
Setter operator[](int index) {
return Setter(data, index);
}
};
struct Game {
GRow rows[8];
GRow & operator[](int index) {
return rows[index];
}
};
int main() {
while (true) {
int row, col;
bool isVert;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment