First working version. Game is full of bugs and nearly unplayable, but the logic is there.