Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class GameMap {
- has Int $.x_dim;
- has Int $.y_dim;
- has Array[Int] @.map;
- method generate_new_empty_map() {
- my Array[Int] @t_map = Array[Int].new,;
- for 0..$.x_dim -> $x_i {
- for 0..$.y_dim -> $y_i {
- print "$x_i - $y_i\n";
- @t_map[$x_i][$y_i] = 0;
- }
- }
- @!map = @t_map;
- }
- }
- # ERROR: 0 - 0
- # 0 - 1
- # 0 - 2
- # 0 - 3
- # 0 - 4
- # 0 - 5
- # 1 - 0
- # Type check failed in assignment to @t_map[1]; expected Array[Int] but got Array ($[])
- # in block at puzzle.p6 line 17
- # in method generate_new_empty_map at puzzle.p6 line 14
- # in block <unit> at puzzle.p6 line 90
Add Comment
Please, Sign In to add comment