Added illegal move detection

cannot access last two columns of map now though.