Categories
Mastering Development

Elixir: Looping through a map, comparing it to itself, and updating it

I have a map of a billiard ball table, as follows: ball_map = %{ "cue" => {"x":-15.0, "z": 0.0, "velocity_x": 0.0, "velocity_z": 0.0, "is_idle": true}, "ball_1" => {"x":15.0, "z": 0.0, "velocity_x": 0.0, "velocity_z": 0.0, "is_idle": true}, "ball_2" => {"x":17.0, "z": 1.1, "velocity_x": 0.0, "velocity_z": 0.0, "is_idle": true}, "ball_3" => {"x":17.0, "z": -1.1, "velocity_x": 0.0, "velocity_z": […]