create abstract function for computing flattened indices from a point
modify setFoodLocation to be more efficient by using boardTiles as an object(dictionary) rather than an array. This allows constant-time deletion of elements, which is much better than my previous use of splice(), which would shift all elements of the array after the removed element. In the worst case this splicing could take O(n) for every snake position to remove, where n = boardTiles.length