Skip to content

Commit

Permalink
Merge pull request #377 from EvgSkv/ti2023
Browse files Browse the repository at this point in the history
Implementing slowdown of robot.html.
  • Loading branch information
EvgSkv authored Sep 13, 2024
2 parents 3740559 + 15ffe24 commit dd5cc4a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion docs/logica.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ self.onmessage = function(event) {
console.log('Compiling predicate...');
let program = data.program;
let predicate = data.predicate;
let result = self.compile_predicate(program, predicate).toJs();
let result = new Map();
result.set('result', 'select \'hi\';')
result.set('status', 'error')
result.set('error_message', 'Compiler is not ready.')
if (self.compile_predicate) {
result = self.compile_predicate(program, predicate).toJs();
}
result.set('type', 'compile_predicate');
console.log(result);
self.postMessage(result);
Expand Down
9 changes: 8 additions & 1 deletion docs/robot.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@
setTimeout(() => {console.log('Called here!'); outputResult(worker_response)}, 100);
//outputResult(worker_response);
theSQL = 'BROKEN';
if (worker_response.get('error_message') == 'Compiler is not ready.') {
compile_attempt += 1;
setTimeout(() => {console.log('Trying to compile again.'); digest();}, 100);
worker_response.set('error_message',
worker_response.get('error_message') + ' / Attempt ' + compile_attempt)
}
return;
}
theSQL = worker_response.get('result');
Expand Down Expand Up @@ -686,7 +692,8 @@

let speed_of_time = 1.0;
let desire_balance_threshold = 4;
setTimeout(digest, 15000);
let compile_attempt = 0;
setTimeout(digest, 1000);
let interval_of_timeStep = setInterval(timeStep, 5);
let interval_of_requestDesire2 = setInterval(requestDesire2, 50);

Expand Down

0 comments on commit dd5cc4a

Please sign in to comment.