|
@@ -253,16 +253,29 @@ for(let i = 6, step = 1; i > 0; i--) {
|
|
|
}
|
|
|
console.log(trigon)
|
|
|
|
|
|
-// //blacke belt
|
|
|
-// let history = [1, 1, 1, 1]
|
|
|
-// let predictArray[1][1][1][1] = 0
|
|
|
+//black belt
|
|
|
+let history = [1, 1, 1, 1]
|
|
|
+let predictArray = [
|
|
|
+ [
|
|
|
+ [[-1],[-1]],[[-1],[-1]]
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ [[-1],[-1]],[[-1],[-1]]
|
|
|
+ ]
|
|
|
+]
|
|
|
|
|
|
-// while(true) {
|
|
|
-// let variant = +prompt('input 1 or 0') || alert('wrong input!')
|
|
|
+while(true) {
|
|
|
+ console.log('my prediction is:',
|
|
|
+ predictArray[history[0]][history[1]][history[2]][history[3]] >= 0? predictArray[history[0]][history[1]][history[2]][history[3]]:
|
|
|
+ Math.random() > 0.5? 1 : 0
|
|
|
+ )
|
|
|
+ let variant = prompt('input 1 or 0')
|
|
|
|
|
|
-// if(+variant === 1 || +variant === 0) {
|
|
|
-
|
|
|
-// history.shift()
|
|
|
-// history.push(variant)
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if(variant === null) {
|
|
|
+ break;
|
|
|
+ } else if(+variant === 1 || +variant === 0) {
|
|
|
+ predictArray[history[0]][history[1]][history[2]][history[3]] = +variant
|
|
|
+ history.shift()
|
|
|
+ history.push(+variant)
|
|
|
+ }
|
|
|
+}
|