class VirtualMemory {
r = 0;
s = 0;
score = 0;
constructor (score) {
this.r = Math.floor(Math.random() * 1e7 + 1157);
this.set(score);
}
check () {
if (this.s !== ((this.score + 117) ^ (this.r - 117))) {
this.score = (this.s ^ (this.r - 117)) - 117;
}
}
get () {
return this.score ^ this.r;
}
add (score) {
this.check();
this.set(this.get() + score);
}
set (score) {
this.score = score ^ this.r;
this.s = (this.score + 117) ^ (this.r - 117);
}
toJSON () {
return this.get();
}
toString () {
return this.get();
}
}