utility function now takes correct AI color into account.