Created
January 7, 2022 05:39
-
-
Save Demindiro/946530b22f433ffcc2dbb7d681d36eba to your computer and use it in GitHub Desktop.
high-speed-chase-web
This file contains 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
let weights = [0,1,2, 3,4,5, 6,7]; | |
let centerWidth = 0; | |
let left = -1; | |
let right = 1; | |
//if (Math.min(scanArray.slice(8-centerWidth,9+centerWidth)) > 15) { | |
if (scanArray[8] > 15 && Math.min(scanArray[7],scanArray[9],) > 10) { | |
return 0; | |
} | |
if (scanArray[6] <= 3) left = 0 | |
if (scanArray[10] <= 3) right = 0 | |
if (left === 0 && right === 0) return 0; | |
if (left === 0 && right !== 0) return right; | |
if (left !== 0 && right === 0) return left; | |
let s = 0 | |
for (let i = 0; i < 8; i++) { | |
s += weights[i] * (scanArray[i] - scanArray[16 - i]); | |
} | |
if (s < 0) { | |
return right; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment