Clean up of redundant code.

This commit is contained in:
Sacha Ligthert 2023-12-01 23:07:57 +01:00
parent 2543cd8e55
commit ee47329732

View File

@ -5,18 +5,12 @@ import "strconv"
// drawBox Draw the outline of the box the snake can move in // drawBox Draw the outline of the box the snake can move in
func (g *Game) drawBox(game *Game) { func (g *Game) drawBox(game *Game) {
// Assuming we will always have this
x1 := 0 x1 := 0
y1 := 0 y1 := 0
x2 := 79 x2 := 79
y2 := 23 y2 := 23
if y2 < y1 {
y1, y2 = y2, y1
}
if x2 < x1 {
x1, x2 = x2, x1
}
// Fill background // Fill background
for row := y1; row <= y2; row++ { for row := y1; row <= y2; row++ {
for col := x1; col <= x2; col++ { for col := x1; col <= x2; col++ {