Skip to content

Instantly share code, notes, and snippets.

@rvishwajith
Created January 13, 2021 05:58
Show Gist options
  • Save rvishwajith/c1a76334b14870c159680cd0c86f64d3 to your computer and use it in GitHub Desktop.
Save rvishwajith/c1a76334b14870c159680cd0c86f64d3 to your computer and use it in GitHub Desktop.
rule1(Boid b)
Vector pC = <0, 0, 0> // Number of dimensions can change
FOR b2 in Boids
IF b != b2 // Ignore duplicate boids
pC += b2.position
pC = pC / (Boids.length - 1)
result = (pC - b.position) / 200 // 0.5% towards the percieved center
RETURN result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment