added checking (whether king is attacked)

AI reflects change, only makes legal moves, still random