Boids/Java: Difference between revisions

m
Fixed syntax highlighting.
m (Fwend moved page Boids simulation/Java to Boids/Java: Boids has moved)
m (Fixed syntax highlighting.)
 
(One intermediate revision by one other user not shown)
Line 1:
This code supports flocking behavior, but not collision avoidance.
 
Loosely based on natureofcode.com's Chapter 6. Autonomous Agents' sample code.
{{works with|Java|8}}
[[File:boids_java.png|300px|thumb|right]]
<langsyntaxhighlight lang="java">import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.geom.*;
Line 351 ⟶ 353:
return acos(v.dot(v2) / (v.mag() * v2.mag()));
}
}</langsyntaxhighlight>
9,488

edits