small optimization: added score recalculation, removed check on every move