Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isChip(tool)
- {
- return tool<0;
- }
- function getCellsToUseTool(tool, leek)
- {
- return isChip(tool) ? getCellsToUseChip(-tool, leek) : getCellsToUseWeapon(leek);
- }
- function getNearestCellToUseToolFromCell(tool, cellFrom, leek)
- {
- var array = [];
- for (var cell in getCellsToUseTool(tool, leek))
- {
- array[cell] = getPathLength(cellFrom, cell);
- }
- return search(array, arrayMin(array));
- }
- function getNeededMPsToExecuteCombo(combo, leek)
- {
- var MPsNeeded = 0;
- var previousCell = getCell();
- for (var tool in combo)
- {
- var cellToUseTheTool = getNearestCellToUseToolFromCell(tool, previousCell, leek);
- MPsNeeded += getPathLength(previousCell, cellToUseTheTool);
- previousCell = cellToUseTheTool;
- }
- return MPsNeeded;
- }
- // Le corps :
- for (var key : var possibleCombo in permutations)
- {
- permutationsNeededMPs[key] = getNeededMPsToExecuteCombo(possibleCombo,leek);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement