Proposal: dictionary of fire
became popular 6 to 0. Enacted by Derrick
Adminned at 08 Oct 2018 16:47:32 UTC
After this line
var randomSeed = “__RANDOM”;in the text of the Master Control Program add the following functions after replacing each "\]" with a "]"
function makeFirewallDictionary(IO){
var firewallDictionary = {};
var tempstr = IO.split("\n\n");
var program;
for( var i = 0; i < tempstr.length; i++ ){
program = tempstr[i\].split("\n");
firewallDictionary[program.shift()] = program;
}
return firewallDictionary;
}
function fireCellValue(row, column, firewall){
return firewall[row][column];
}
function isAdj2Coord(midRow, midCol, sigEquip, firewall){
properties = [];
numpad = [ 1, 2, 3, 4, 6, 7, 8, 9 ];
if(midCol == 0){
if(numpad.includes(7)){
numpad.splice(numpad.indexOf(7), 1);
}
if(numpad.includes(8)){
numpad.splice(numpad.indexOf(8), 1);
}
if(numpad.includes(9)){
numpad.splice(numpad.indexOf(9), 1);
}
}
if(midCol == 7){
if(numpad.includes(1)){
numpad.splice(numpad.indexOf(1), 1);
}
if(numpad.includes(2)){
numpad.splice(numpad.indexOf(2), 1);
}
if(numpad.includes(3)){
numpad.splice(numpad.indexOf(3), 1);
}
}
if(midRow == 0){
if(numpad.includes(7)){
numpad.splice(numpad.indexOf(7), 1);
}
if(numpad.includes(4)){
numpad.splice(numpad.indexOf(4), 1);
}
if(numpad.includes(1)){
numpad.splice(numpad.indexOf(1), 1);
}
}
if(midRow == 7){
if(numpad.includes(9)){
numpad.splice(numpad.indexOf(9), 1);
}
if(numpad.includes(6)){
numpad.splice(numpad.indexOf(6), 1);
}
if(numpad.includes(3)){
numpad.splice(numpad.indexOf(3), 1);
}
}
for(i = 0; i < numpad.length; i++){
numpad[i\] = numpadValues(numpad[i\]);
}
for(i = 0; i < numpad.length; i++){
if(fireCellValue(midRow + numpad[i\][1], midCol + numpad[i\][0], firewall) == sigEquip){
return true;
}
}
return false;
}
function numpadValues(num){
switch(num){
case 1:
return [-1, 1];
case 2:
return [0, 1];
case 3:
return [1, 1];
case 4:
return [-1, 0];
case 6:
return [1, 0];
case 7:
return [-1, -1];
case 8:
return [0, -1];
case 9:
return [1, -1];
default:
return [0, 0];
}
}
function inFireWall(firewall, equip){
for(i = 0; i < firewall.length; i++){
if(firewall[i\].includes(equip)){
return true;
}
}
return false;
}
functions which deal with the firewalls. I tested them so they should work but I could’ve missed a few things since I don’t really know javascript.
Lulu: she/her