MCPcopy Create free account
hub / github.com/codecombat/codecombat / layoutsAreEquivalent

Function layoutsAreEquivalent

app/lib/level-generation.js:1406–1430  ·  view source on GitHub ↗
(thangsA, thangsB)

Source from the content-addressed store, hash-verified

1404}
1405
1406function layoutsAreEquivalent (thangsA, thangsB) {
1407 for (let col = 0; col < maxCols; ++col) {
1408 for (let row = 0; row < maxRows; ++row) {
1409 const pos = { x: col, y: row }
1410 let thangA = findThangAt(pos, thangsA)
1411 let thangB = findThangAt(pos, thangsB)
1412 if (thangA && floorSpriteNames.includes(thangTypesToSpriteNames[thangA.thangType])) {
1413 thangA = null
1414 }
1415 if (thangB && floorSpriteNames.includes(thangTypesToSpriteNames[thangB.thangType])) {
1416 thangB = null
1417 }
1418 if (!thangA && !thangB) {
1419 continue
1420 }
1421 if (!thangA || !thangB) {
1422 return false
1423 }
1424 if (thangA.thangType !== thangB.thangType) {
1425 return false
1426 }
1427 }
1428 }
1429 return true
1430}
1431
1432function processExplosiveChain ({ zapTargetPosSrc, zapTargetPosNew, thangsSrc, thangsNew, processedPositions, visitedPositions, actionSrc, actionNew }) {
1433 const directions = [

Callers 1

Calls 1

findThangAtFunction · 0.85

Tested by

no test coverage detected