Skip to content

Commit 79ee376

Browse files
committed
examples: remove repeat() usages from tetris.v
1 parent 940f2c5 commit 79ee376

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/tetris/tetris.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ fn (mut g Game) init_game() {
180180
g.field = []
181181
// Generate the field, fill it with 0's, add -1's on each edge
182182
for _ in 0 .. field_height + 2 {
183-
mut row := [0].repeat(field_width + 2)
183+
mut row := []int{len: field_width + 2}
184184
row[0] = -1
185185
row[field_width + 1] = -1
186186
g.field << row.clone()
@@ -392,10 +392,10 @@ fn (mut g Game) draw_scene() {
392392

393393
fn parse_binary_tetro(t_ int) []Block {
394394
mut t := t_
395-
mut res := [Block{}].repeat(4)
395+
mut res := []Block{len: 4}
396396
mut cnt := 0
397397
horizontal := t == 9 // special case for the horizontal line
398-
ten_powers := [1000, 100, 10, 1]
398+
ten_powers := [1000, 100, 10, 1]!
399399
for i := 0; i <= 3; i++ {
400400
// Get ith digit of t
401401
p := ten_powers[i]

0 commit comments

Comments
 (0)