@@ -30,7 +30,7 @@ function create_environment_axis(
30
30
x_limits = x_limits .+ limit_margins
31
31
y_limits = y_limits .+ limit_margins
32
32
33
- aspect = x_limits[ 2 ] / y_limits[ 2 ]
33
+ aspect = DataAspect ()
34
34
limits = (x_limits, y_limits)
35
35
environment_axis = Makie. Axis (
36
36
figure;
@@ -43,54 +43,10 @@ function create_environment_axis(
43
43
axis_kwargs... ,
44
44
)
45
45
46
- visualize ! (environment_axis, environment; viz_kwargs... )
46
+ Makie . plot ! (environment_axis, environment; viz_kwargs... )
47
47
environment_axis
48
48
end
49
49
50
- function visualize_players! (
51
- axis,
52
- players;
53
- player_colors = range (colorant " red" , colorant " blue" , length = blocksize (players[], 1 )),
54
- )
55
- for player_i in 1 : blocksize (players[], 1 )
56
- player_color = player_colors[player_i]
57
- position = Makie. @lift Makie. Point2f ($ players[Block (player_i)][1 : 2 ])
58
- Makie. scatter! (axis, position; color = player_color)
59
- end
60
- end
61
-
62
- function visualize_obstacle_bounds! (
63
- axis,
64
- players;
65
- player_colors = range (colorant " red" , colorant " blue" , length = blocksize (players[], 1 )),
66
- obstacle_radius = 1.0 ,
67
- )
68
- for player_i in 1 : blocksize (players[], 1 )
69
- player_color = player_colors[player_i]
70
- position = Makie. @lift Makie. Point2f ($ players[Block (player_i)][1 : 2 ])
71
- Makie. scatter! (
72
- axis,
73
- position;
74
- color = (player_color, 0.4 ),
75
- markersize = 2 * obstacle_radius,
76
- markerspace = :data ,
77
- )
78
- end
79
- end
80
-
81
- function visualize_targets! (
82
- axis,
83
- targets;
84
- player_colors = range (colorant " red" , colorant " blue" , length = blocksize (targets[], 1 )),
85
- marker = " +" ,
86
- )
87
- for player_i in 1 : blocksize (targets[], 1 )
88
- color = player_colors[player_i]
89
- target = Makie. @lift Makie. Point2f ($ targets[Block (player_i)])
90
- Makie. scatter! (axis, target; color, marker)
91
- end
92
- end
93
-
94
50
function visualize_sim_step (
95
51
game,
96
52
step;
@@ -100,7 +56,7 @@ function visualize_sim_step(
100
56
ylims = (- 5 , 5 ),
101
57
aspect = 1 ,
102
58
player_colors = range (colorant " red" , colorant " blue" , length = num_players (game)),
103
- player_names = [" Pursuer " , " Evader " ],
59
+ player_names = [" P $ii " for ii in 1 : num_players (game) ],
104
60
weight_offset = 0.0 ,
105
61
heading = " " ,
106
62
show_legend = false ,
@@ -126,7 +82,7 @@ function visualize_sim_step(
126
82
ax_kwargs... ,
127
83
)
128
84
129
- visualize ! (ax, game. env)
85
+ Makie . plot ! (ax, game. env)
130
86
131
87
plots = []
132
88
@@ -135,7 +91,7 @@ function visualize_sim_step(
135
91
γ = Makie. @lift $ s. strategy. substrategies[ii]
136
92
pos = Makie. @lift Makie. Point2f ($ s. state[Block (ii)][1 : 2 ])
137
93
scatter = Makie. scatter! (ax, pos; color)
138
- visualize ! (ax, γ; weight_offset, color)
94
+ Makie . plot ! (ax, γ; weight_offset, color)
139
95
push! (plots, [scatter])
140
96
end
141
97
0 commit comments