danicat / pacgo

A Pac Man clone written in Go (with emojis!)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

redundant cursor moving op

EtoDemerzel0427 opened this issue · comments

in step 02, you clear screen and move the cursor to (0, 0):

func clearScreen() {
    fmt.Printf("\x1b[2J")
    moveCursor(0, 0)
}

But the escape sequence ^[2J should move the cursor to (0, 0) itself, so we don't have to explicitly move the cursor.
Check here.

Seems I misunderstood the usage.

Another problem:
should step 03 line 115:

	case "DOWN":
		newRow = newRow + 1
		if newRow == len(maze)-1 {
			newRow = 0
		}

be if newRow == len(maze)?