UNPKG

matrix-map

Version:

A class object for to aid in the creation of 2D grid games.

15 lines (11 loc) 407 B
const getEquivalentNeighbors = function(id){ let equivalentNeighbors = new Map(); let neighbors = this.getNeighbors(id); neighbors.forEach(n =>{ if (this.getValueOfID(id) === this.getValueOfID(n)) { equivalentNeighbors.set(n, this.getValueOfID(n)) } }) return equivalentNeighbors } export default getEquivalentNeighbors