Handle non-empty memory in ircbotRun(). Turns out [].reduce() passes 4 parameters

This commit is contained in:
Juhani Krekelä 2018-05-26 22:55:07 +03:00
parent cd00c3cded
commit 713ded5adb
1 changed files with 2 additions and 2 deletions

4
gir.js
View File

@ -976,8 +976,8 @@ function ircbotRun(program, input, maxCycles = 400000) {
// even if there are no indices we can get values that
// the rest of the code can work with
let memoryIndices = Array.from(result.state.memory.keys());
let min = memoryIndices.reduce(Math.min, tapeHead);
let max = memoryIndices.reduce(Math.max, tapeHead);
let min = memoryIndices.reduce((x,y) => Math.min(x, y), tapeHead);
let max = memoryIndices.reduce((x,y) => Math.max(x, y), tapeHead);
// Get 15 cells of context on each side of tape head
// Exception is if max or min comes up before that, in which