Created
February 27, 2015 14:26
-
-
Save lovasoa/22a9300179a3b077ecf3 to your computer and use it in GitHub Desktop.
ARSYS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MAX = 3; | |
var a=0, b=0, n=0, p=0; | |
var ncorr = 0, pred=0; | |
var histpred = {}; | |
var hist = [false,false,false,false]; | |
for (var i=0; i<24; i++) { | |
a = (a+1)%2; | |
b = (b+1)%3; | |
var act = a<b; | |
var id = JSON.stringify(hist); | |
pred = histpred[id] || false; | |
ncorr += act == pred; | |
histpred[id] = act; | |
hist.push(act); | |
hist.shift(); | |
} | |
console.log(ncorr); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment