pacgo
pacgo copied to clipboard
When redrawing in full screen, it may cause the screen to flicker
func updatePlayerPosition(newRow, newCol int) { // 移动玩家位置前,先清除当前位置 simpleansi.MoveCursor(player.row, player.col) fmt.Print(" ")
// 更新玩家位置
player.row = newRow
player.col = newCol
// 打印新的玩家位置
simpleansi.MoveCursor(player.row, player.col)
fmt.Print("P")
// 移动光标到迷宫绘制区域之外
simpleansi.MoveCursor(len(maze)+1, 0)
}