Fix undoing function's codes

I fixed codes about "Undo"'s function. And  splited "BoardState"'s
class.