Typescript Count Unique Values Python Snake Game