#include "stdafx.h"
#include "Board.h"


void Board::Do(Move *move)
{
	moves.push_back(*move);
}

void Board::Undo()
{
	moves.pop_back();
}

Board::Board()
{
	//四方を壁にする。
	const int x_of_left = 0;
	const int x_of_right = ROW_MEM_SIZE - 1;
	const int y_of_top = 0;
	const int y_of_bottom = (COL_MEM_SIZE - 1) * ROW_MEM_SIZE;

	for (int y = ROW_MEM_SIZE; y < CELLS_COUNT; y += ROW_MEM_SIZE) {
		cells[x_of_left + y] = WALL;
		cells[x_of_right + y] = WALL;
	}
	for (int x = 1; x <= ROW_SIZE; x++) {
		cells[x + y_of_top] = WALL;
		cells[x + y_of_bottom];
	}


	//なにもおいてない状態にする。
	for (int y = ROW_MEM_SIZE; y < CELLS_COUNT; y+= ROW_MEM_SIZE) {
		for (int x = 1; x <= ROW_SIZE; x++) {
			cells[x + y] = EMPTY;	
		}
	}

	//４つの石を初期配置する。
	cells[position(4, 4)] = WHITE;
	cells[position(5, 5)] = WHITE;
	cells[position(4, 5)] = BLACK;
	cells[position(5, 4)] = BLACK;
}


Board::~Board()
{
}
