big reactors

jay2144

New Member
Jul 29, 2019
45
0
0
above i have given you some reactor templates config settings and computercraft apis
 

jay2144

New Member
Jul 29, 2019
45
0
0
Code:
// How much RF/t does the reactor have to make to pass the test basically
var requestedEstimateRFPerTick = 0;

var cellType = [
{ character: 'C', name: 'Gelid Cryotheum'},
{ character: 'E', name: 'Liquid Ender'},
{ character: 'X', name: 'Control Rod' }
];


/*
*http://br.sidoh.org/api/simulate?
definition=%7B%22xSize%22%3A7%2C%22zSize%22%3A7%2C%22height%22%3A7%2C%22layout%22%3A%22EEEEEEXXEEEXCXEEXXXEEEEEE%22%2C%22isActivelyCooled%22%3Afalse%2C%22controlRodInsertion%22%3A81%7D
*/

function getRemote(obj) {
try{
return JSON.parse($.ajax({
type: "GET",
method: "GET",
url: "http://br.sidoh.org/api/simulate",
data : {definition : JSON.stringify(obj)},
headers : {
accept: "application/json, text/javascript, */*; q=0.01",
referrer: "http://br.sidoh.org/"
},
async: false
}).responseText);
} catch (e){
console.log(e);
return false;
}
}

var data = {
layout: "",
efficiency: 0,
RFPerTick: 0,
MBPerTick: 0
};
var currentDesign = {
width: 2,
length: 2,
height: 3,
RFPerTick: 0,
MBPerTick: 0,
RFPerMB: 0,
cells: [],
fillWithRods : function (){
for(var i = 0; i < (this.width * this.length); i++){
this.cells[i] = 'X';
}
}

};

var definition = {
xSize: currentDesign.width + 2,
zSize: currentDesign.length + 2,
height: currentDesign.height + 2,
layout: '',
isActivelyCooled: false,
controlRodInsertion: 0
};

var progress = 0;
var OBJ = [];
var cycle = true;
var response;
function recursion () {
if (cycle)
if( progress == (currentDesign.width * currentDesign.length) ){
definition.layout = "";
//definition.controlRodInsertion = 0;
var send = false;
OBJ.forEach(function (v,k) {
//console.log("asd" + k + " " + v);
definition.layout += cellType[v].character;
if(cellType[v].character === 'X'){
send = true;
}
});


console.log(definition.layout);
if (send){
response = getRemote(definition);
if (response !== false){
// We have a response!
console.log(response);
var eff = response.output / response.fuelConsumption;

if (eff > data.efficiency && response.output >= requestedEstimateRFPerTick) {
data.efficiency = eff;
data.layout = definition.layout;
data.RFPerTick = response.output;
data.MBPerTick = response.fuelConsumption;
}
}
}

} else {
//console.log("pass");
progress++;
for(var i = 0; i < cellType.length; i++){
OBJ[progress] = i;
try{
recursion();
} catch (e){
return false;
}
}
progress--;
}
}

function getQueryVariable(variable) {
var query = window.location + "";
query = query.replace("http://br.sidoh.org/#reactor-design?", "");
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return currentDesign[variable];
//alert('Query Variable ' + variable + ' not found');
}
//$.getScript('https://gist.githubusercontent.com/BraynStorm/b7af02b1cbced797d8b2/raw/d4877c6683a52441c6588fe7f700fb5dd6318d63/reactor_bot.js');
function bootUp(){
requestedEstimateRFPerTick = parseInt(prompt("How much RF/t does the reactor have to produce to pass the test ?","20500"));

currentDesign.width = parseInt(getQueryVariable("width"));
currentDesign.height = parseInt(getQueryVariable("height"));
currentDesign.activelyCooled = parseInt(getQueryVariable("activelyCooled"));
currentDesign.length = parseInt(getQueryVariable("length"));
currentDesign.controlRodInsertion = parseInt(getQueryVariable("controlRodInsertion"));

definition = {
xSize: currentDesign.width + 2,
zSize: currentDesign.length + 2,
height: currentDesign.height + 2,
layout: '',
isActivelyCooled: false,
controlRodInsertion: 0
};

currentDesign.fillWithRods();

recursion();

window.location =
"http://br.sidog.org/#reactor-design?" +
"length=" + currentDesign.length +
"&width=" + currentDesign.width +
"&height=" + currentDesign.height +
"&activelyCooled=" + definition.isActivelyCooled +
"&layout=" + data.layout;

}
bootUp();


to help sido out you can run this code locally on your server or computer lets all give it a try eh