diff --git a/README.md b/README.md index 7cee32e..da95338 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,16 @@ Golang Tetris for console window with optional AI +## Features include + +- AI (use i key to toggle) +- Lock delay +- Next piece +- Ghost piece +- Top scores +- Board choices +- Edit boards + ## Compile ``` @@ -13,21 +23,6 @@ go install github.com/MichaelS11/go-tetris Then run the binary created, go-tetris or go-tetris.exe -## Keys during game - -| Key | Action | -| --- | --- | -| ← | left move | -| z | left rotate | -| x | right rotate | -| → | right move | -| ↓ | soft drop | -| ↑ | hard drop | -| spacebar | hard drop | -| p | pause | -| q | quit | -| i | toggle AI | - ## Keys start screen | Key | Action | @@ -35,26 +30,58 @@ Then run the binary created, go-tetris or go-tetris.exe | ← | previous board | | → | next board | | spacebar | start game | +| ctrl e | edit board | | q | quit | -## Features include +## Keys during game -- AI (use i key to toggle) -- Lock delay -- Next piece -- Ghost piece -- Top scores -- Board choices +| Key | Action | +| --- | --- | +| ← | left move | +| → | right move | +| ↓ | soft drop | +| ↑ | hard drop | +| spacebar | hard drop | +| z | left rotate | +| x | right rotate | +| p | pause | +| q | quit | +| i | toggle AI | + +## Keys edit mode + +| Key | Action | +| --- | --- | +| ← | move cursor left | +| → | move cursor right | +| ↓ | move cursor down | +| ↑ | move cursor up | +| z | rotate left | +| x | rotate right | +| c | cyan block - I | +| b | blue block - J | +| w | white block - L | +| e | yellow block - O | +| g | green block - S | +| a | magenta block - T | +| r | red block - Z | +| f | free block | +| ctrl b | change board size | +| ctrl s | save board | +| ctrl n | save board as new | +| ctrl k | delete board | +| ctrl o | empty board | +| ctrl q | quit edit mode | ## Screenshots -![alt text](https://raw.githubusercontent.com/MichaelS11/tetris/master/screenshots/screenshot1.png "Go Tetris") +![alt text](https://raw.githubusercontent.com/MichaelS11/tetris/master/screenshots/tetris.png "Go Tetris") -![alt text](https://raw.githubusercontent.com/MichaelS11/tetris/master/screenshots/screenshot2.png "Golang Tetris") +![alt text](https://raw.githubusercontent.com/MichaelS11/tetris/master/screenshots/heart.png "Golang Tetris Heart") -![alt text](https://raw.githubusercontent.com/MichaelS11/tetris/master/screenshots/screenshot3.png "Golang Tetris Heart") +![alt text](https://raw.githubusercontent.com/MichaelS11/tetris/master/screenshots/editmode.png "Edit Mode Peace Symbol") -![alt text](https://raw.githubusercontent.com/MichaelS11/tetris/master/screenshots/screenshot4.png "Tetris High Scores") +![alt text](https://raw.githubusercontent.com/MichaelS11/tetris/master/screenshots/highscores.png "Tetris High Scores") ## To do diff --git a/board.go b/board.go index 43b53c6..50340ac 100644 --- a/board.go +++ b/board.go @@ -13,24 +13,73 @@ func NewBoard() { board.Clear() } -// Clear clears the board +// ChangeBoardSize changes board size +func ChangeBoardSize(width int, height int) { + if board.width == width && board.height == height { + return + } + + newBoard := &Board{width: width, height: height, boardsIndex: board.boardsIndex} + newBoard.colors = make([][]termbox.Attribute, width) + for i := 0; i < width; i++ { + newBoard.colors[i] = make([]termbox.Attribute, height) + for j := 0; j < height; j++ { + if i < board.width && j < board.height { + newBoard.colors[i][j] = board.colors[i][j] + } else { + newBoard.colors[i][j] = blankColor + } + } + } + newBoard.rotation = make([][]int, width) + for i := 0; i < width; i++ { + newBoard.rotation[i] = make([]int, height) + for j := 0; j < height; j++ { + if i < board.width && j < board.height { + newBoard.rotation[i][j] = board.rotation[i][j] + } else { + break + } + } + } + + board = newBoard + board.previewMino = NewMino() + board.currentMino = NewMino() +} + +// Clear clears the board to orginal state func (board *Board) Clear() { board.width = len(boards[board.boardsIndex].colors) board.height = len(boards[board.boardsIndex].colors[0]) - board.colors = make([][]termbox.Attribute, len(boards[board.boardsIndex].colors)) - for i := 0; i < len(boards[board.boardsIndex].colors); i++ { - board.colors[i] = make([]termbox.Attribute, len(boards[board.boardsIndex].colors[i])) + board.colors = make([][]termbox.Attribute, board.width) + for i := 0; i < board.width; i++ { + board.colors[i] = make([]termbox.Attribute, board.height) copy(board.colors[i], boards[board.boardsIndex].colors[i]) } - board.rotation = make([][]int, len(boards[board.boardsIndex].rotation)) - for i := 0; i < len(boards[board.boardsIndex].rotation); i++ { - board.rotation[i] = make([]int, len(boards[board.boardsIndex].rotation[i])) + board.rotation = make([][]int, board.width) + for i := 0; i < board.width; i++ { + board.rotation[i] = make([]int, board.height) copy(board.rotation[i], boards[board.boardsIndex].rotation[i]) } board.previewMino = NewMino() board.currentMino = NewMino() } +// EmptyBoard removes all blocks/colors from the board +func (board *Board) EmptyBoard() { + for i := 0; i < board.width; i++ { + for j := 0; j < board.height; j++ { + board.colors[i][j] = blankColor + } + } + for i := 0; i < board.width; i++ { + for j := 0; j < board.height; j++ { + board.rotation[i][j] = 0 + } + } +} + // PreviousBoard switches to previous board func (board *Board) PreviousBoard() { board.boardsIndex-- @@ -247,9 +296,30 @@ func (board *Board) deleteLine(line int) { // SetColor sets the color and rotation of board location func (board *Board) SetColor(x int, y int, color termbox.Attribute, rotation int) { board.colors[x][y] = color + if rotation < 0 { + return + } board.rotation[x][y] = rotation } +// RotateLeft rotates cell left +func (board *Board) RotateLeft(x int, y int) { + if board.rotation[x][y] == 0 { + board.rotation[x][y] = 3 + return + } + board.rotation[x][y]-- +} + +// RotateRight rotates cell right +func (board *Board) RotateRight(x int, y int) { + if board.rotation[x][y] == 3 { + board.rotation[x][y] = 0 + return + } + board.rotation[x][y]++ +} + // ValidBlockLocation checks if block location is vaild func (board *Board) ValidBlockLocation(x int, y int, mustBeOnBoard bool) bool { if x < 0 || x >= board.width || y >= board.height { @@ -311,6 +381,11 @@ func (board *Board) DrawDropMino() { mino.DrawMino(MinoDrop) } +// DrawCursor draws the edit cursor +func (board *Board) DrawCursor(x int, y int) { + view.DrawCursor(x, y, board.colors[x][y]) +} + // printDebugBoard is for printing board in text for debuging func (board *Board) printDebugBoard() { for j := 0; j < board.height; j++ { diff --git a/boards.go b/boards.go index 9341ea8..6663120 100644 --- a/boards.go +++ b/boards.go @@ -1,1086 +1,715 @@ package main import ( + "encoding/json" + "fmt" + "io/ioutil" + "os" + "github.com/nsf/termbox-go" ) -func init() { - boards = []Boards{ +// loadBoards loads the internal boards +func loadBoards() error { + logger.Println("loadBoards start") - // 10 x 20 blank - { - colors: [][]termbox.Attribute{ - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - }, - rotation: [][]int{ - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - }}, - - // 10 x 20 checkerboard double - { - colors: [][]termbox.Attribute{ - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - }, - rotation: [][]int{ - {0, 0, 0, 0, 0, 0, 2, 2, 0, 0, - 2, 2, 0, 0, 2, 2, 0, 0, 2, 2}, - {0, 0, 0, 0, 0, 0, 2, 2, 0, 0, - 2, 2, 0, 0, 2, 2, 0, 0, 2, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 2, 2, 0, 0, - 2, 2, 0, 0, 2, 2, 0, 0, 2, 2}, - {0, 0, 0, 0, 0, 0, 2, 2, 0, 0, - 2, 2, 0, 0, 2, 2, 0, 0, 2, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 2, 2, 0, 0, - 2, 2, 0, 0, 2, 2, 0, 0, 2, 2}, - {0, 0, 0, 0, 0, 0, 2, 2, 0, 0, - 2, 2, 0, 0, 2, 2, 0, 0, 2, 2}, - }}, - - // 10 x 20 checkerboard single - { - colors: [][]termbox.Attribute{ - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - }, - rotation: [][]int{ - {0, 0, 0, 2, 0, 2, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 2, 0, 2, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 2, 0, 2, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 2, 0, 2, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 2, 0, 2, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - }}, - - // 20 x 20 blank - { - colors: [][]termbox.Attribute{ - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - }, - rotation: [][]int{ - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - }}, - - // 20 x 20 heart - { - colors: [][]termbox.Attribute{ - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorWhite, - termbox.ColorWhite, termbox.ColorWhite, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - termbox.ColorMagenta, termbox.ColorWhite, termbox.ColorYellow, termbox.ColorYellow, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, termbox.ColorMagenta, - termbox.ColorMagenta, termbox.ColorMagenta, termbox.ColorYellow, termbox.ColorYellow, termbox.ColorBlue, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorWhite, termbox.ColorWhite, termbox.ColorWhite, - termbox.ColorCyan, termbox.ColorCyan, termbox.ColorCyan, termbox.ColorCyan, termbox.ColorBlue, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorGreen, termbox.ColorGreen, termbox.ColorWhite, - termbox.ColorWhite, termbox.ColorWhite, termbox.ColorRed, termbox.ColorRed, termbox.ColorBlue, termbox.ColorBlue, blankColor, blankColor, blankColor, blankColor}, - - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorGreen, termbox.ColorGreen, - termbox.ColorWhite, termbox.ColorRed, termbox.ColorRed, termbox.ColorCyan, termbox.ColorCyan, termbox.ColorCyan, termbox.ColorCyan, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorBlue, termbox.ColorBlue, - termbox.ColorWhite, termbox.ColorGreen, termbox.ColorGreen, termbox.ColorMagenta, termbox.ColorMagenta, termbox.ColorMagenta, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorGreen, termbox.ColorBlue, - termbox.ColorYellow, termbox.ColorYellow, termbox.ColorGreen, termbox.ColorGreen, termbox.ColorMagenta, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, blankColor}, - - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorGreen, termbox.ColorGreen, termbox.ColorBlue, - termbox.ColorYellow, termbox.ColorYellow, termbox.ColorYellow, termbox.ColorYellow, termbox.ColorWhite, termbox.ColorWhite, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorGreen, termbox.ColorRed, termbox.ColorRed, - termbox.ColorGreen, termbox.ColorGreen, termbox.ColorYellow, termbox.ColorYellow, termbox.ColorWhite, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, termbox.ColorMagenta, - termbox.ColorBlue, termbox.ColorGreen, termbox.ColorGreen, termbox.ColorBlue, termbox.ColorWhite, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorMagenta, termbox.ColorMagenta, - termbox.ColorBlue, termbox.ColorBlue, termbox.ColorBlue, termbox.ColorBlue, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorMagenta, - termbox.ColorBlue, termbox.ColorBlue, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - }, - rotation: [][]int{ - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - }}, - - // 20 x 20 checkerboard double - { - colors: [][]termbox.Attribute{ - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - }, - rotation: [][]int{ - {0, 0, 0, 0, 0, 0, 2, 2, 0, 0, - 2, 2, 0, 0, 2, 2, 0, 0, 2, 2}, - {0, 0, 0, 0, 0, 0, 2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2, 0, 0, 2, 2, 0, 0, 2, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - }}, - - // 20 x 20 checkerboard single - { - colors: [][]termbox.Attribute{ - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}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- {0, 0, 0, 2, 0, 2, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 2, 0, 2, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - }}, - - // 30 x 30 blank - { - colors: [][]termbox.Attribute{ - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, - blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor}, - }, - rotation: [][]int{ - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 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0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - }}, - - // 30 x 30 checkerboard double - { - colors: [][]termbox.Attribute{ - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, - blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, - termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed, blankColor, blankColor, termbox.ColorRed, termbox.ColorRed}, - }, - rotation: [][]int{ - {0, 0, 0, 0, 0, 0, 0, 0, 2, 2, - 0, 0, 2, 2, 0, 0, 2, 2,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 2, 2, - 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, - 2, 2, 0, 0, 2, 2, 0, 0, 2, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 2, 2, - 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, - 2, 2, 0, 0, 2, 2, 0, 0, 2, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 0, 2, 2, - 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, - 2, 2, 0, 0, 2, 2, 0, 0, 2, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 2, 2, - 0, 0, 2, 2, 0, 0, 2, 2, 0, 0, - 2, 2, 0, 0, 2, 2, 0, 0, 2, 2}, - }}, - - // 30 x 30 checkerboard single - { - colors: [][]termbox.Attribute{ - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, - blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed}, - {blankColor, blankColor, blankColor, blankColor, blankColor, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, - termbox.ColorRed, blankColor, termbox.ColorRed, blankColor, termbox.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0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, - 0, 2, 0, 2, 0, 2, 0, 2, 0, 2}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - }}, + var boardsJSON []BoardsJSON + err := json.Unmarshal(boardsInternal, &boardsJSON) + if err != nil { + return fmt.Errorf("unmarshal error: %v", err) } + + numInternalBoards = len(boardsJSON) + boards = make([]Boards, numInternalBoards) + + for boardNum, boardLoad := range boardsJSON { + aBoards := Boards{name: boardLoad.Name} + aBoards.colors = make([][]termbox.Attribute, len(boardLoad.Mino)) + aBoards.rotation = boardLoad.Rotation + + for i := 0; i < len(boardLoad.Mino); i++ { + aBoards.colors[i] = make([]termbox.Attribute, len(boardLoad.Mino[i])) + for j := 0; j < len(boardLoad.Mino[i]); j++ { + switch boardLoad.Mino[i][j] { + case "b": + aBoards.colors[i][j] = blankColor + case "i": + aBoards.colors[i][j] = termbox.ColorCyan + case "j": + aBoards.colors[i][j] = termbox.ColorBlue + case "l": + aBoards.colors[i][j] = termbox.ColorWhite + case "o": + aBoards.colors[i][j] = termbox.ColorYellow + case "s": + aBoards.colors[i][j] = termbox.ColorGreen + case "t": + aBoards.colors[i][j] = termbox.ColorMagenta + case "z": + aBoards.colors[i][j] = termbox.ColorRed + } + } + } + boards[boardNum] = aBoards + } + + boardsJSON = nil + + logger.Println("loadBoards end") + + return nil } + +// loadUserBoards loads the user boards from file +func loadUserBoards() error { + _, err := os.Stat(baseDir + settingsFileName) + if os.IsNotExist(err) { + return nil + } + + logger.Println("loadUserBoards start") + + if err != nil { + return fmt.Errorf("stat error: %v", err) + } + + var settingsJSON []byte + settingsJSON, err = ioutil.ReadFile(baseDir + settingsFileName) + if err != nil { + return fmt.Errorf("read file error: %v", err) + } + if len(settingsJSON) < 2 { + return nil + } + + var settings Settings + err = json.Unmarshal(settingsJSON, &settings) + if err != nil { + return fmt.Errorf("unmarshal error: %v", err) + } + + for _, boardLoad := range settings.Boards { + aBoards := Boards{name: boardLoad.Name} + aBoards.colors = make([][]termbox.Attribute, len(boardLoad.Mino)) + aBoards.rotation = boardLoad.Rotation + + for i := 0; i < len(boardLoad.Mino); i++ { + aBoards.colors[i] = make([]termbox.Attribute, len(boardLoad.Mino[i])) + for j := 0; j < len(boardLoad.Mino[i]); j++ { + switch boardLoad.Mino[i][j] { + case "b": + aBoards.colors[i][j] = blankColor + case "i": + aBoards.colors[i][j] = termbox.ColorCyan + case "j": + aBoards.colors[i][j] = termbox.ColorBlue + case "l": + aBoards.colors[i][j] = termbox.ColorWhite + case "o": + aBoards.colors[i][j] = termbox.ColorYellow + case "s": + aBoards.colors[i][j] = termbox.ColorGreen + case "t": + aBoards.colors[i][j] = termbox.ColorMagenta + case "z": + aBoards.colors[i][j] = termbox.ColorRed + } + } + } + + boards = append(boards, aBoards) + } + + logger.Println("loadUserBoards end") + + return nil +} + +// saveUserBoards saves the user boards to file +func saveUserBoards() error { + logger.Println("saveUserBoards start") + + boardsJSON := make([]BoardsJSON, len(boards)-numInternalBoards) + + for x := numInternalBoards; x < len(boards); x++ { + aBoards := BoardsJSON{Name: boards[x].name} + aBoards.Mino = make([][]string, len(boards[x].colors)) + aBoards.Rotation = boards[x].rotation + + for i := 0; i < len(boards[x].colors); i++ { + aBoards.Mino[i] = make([]string, len(boards[x].colors[i])) + for j := 0; j < len(boards[x].colors[i]); j++ { + switch boards[x].colors[i][j] { + case blankColor: + aBoards.Mino[i][j] = "b" + case termbox.ColorCyan: + aBoards.Mino[i][j] = "i" + case termbox.ColorBlue: + aBoards.Mino[i][j] = "j" + case termbox.ColorWhite: + aBoards.Mino[i][j] = "l" + case termbox.ColorYellow: + aBoards.Mino[i][j] = "o" + case termbox.ColorGreen: + aBoards.Mino[i][j] = "s" + case termbox.ColorMagenta: + aBoards.Mino[i][j] = "t" + case termbox.ColorRed: + aBoards.Mino[i][j] = "z" + } + } + } + + boardsJSON[x-numInternalBoards] = aBoards + } + + settings := Settings{Boards: boardsJSON} + + settingsJSON, err := json.Marshal(settings) + if err != nil { + return fmt.Errorf("marshal error: %v", err) + } + + err = ioutil.WriteFile(baseDir+settingsFileName, settingsJSON, 0644) + if err != nil { + return fmt.Errorf("write file error: %v", err) + } + + logger.Println("saveUserBoards end") + + return nil +} + +var boardsInternal = []byte(` +[ + { + "name":"10 x 20 blank", + "mino":[ + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"] + ], + "rotation":[ + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + ] + }, + { + "name":"10 x 20 checkerboard double", + "mino":[ + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"] + ], + "rotation":[ + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + ] + }, + { + "name":"10 x 20 checkerboard single", + "mino":[ + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"] + ], + "rotation":[ + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + ] + }, + { + "name":"20 x 20 blank", + "mino":[ + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"] + ], + "rotation":[ + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + ] + }, + { + "name":"20 x 20 heart", + "mino":[ + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","l","l","l","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","z","z","t","l","o","o","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","z","z","t","t","t","o","o","j","b","b","b","b","b"], + ["b","b","b","b","b","b","b","l","l","l","i","i","i","i","j","b","b","b","b","b"], + ["b","b","b","b","b","b","b","s","s","l","l","l","z","z","j","j","b","b","b","b"], + ["b","b","b","b","b","b","b","b","s","s","l","z","z","i","i","i","i","b","b","b"], + ["b","b","b","b","b","b","b","b","j","j","l","s","s","t","t","t","z","z","b","b"], + ["b","b","b","b","b","b","b","b","s","j","o","o","s","s","t","z","z","b","b","b"], + ["b","b","b","b","b","b","b","s","s","j","o","o","o","o","l","l","b","b","b","b"], + ["b","b","b","b","b","b","b","s","z","z","s","s","o","o","l","b","b","b","b","b"], + ["b","b","b","b","b","b","b","z","z","t","j","s","s","j","l","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","t","t","j","j","j","j","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","t","j","j","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"] + ], + "rotation":[ + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,1,1,3,1,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,1,1,3,3,3,0,0,2,0,0,0,0,0], + [0,0,0,0,0,0,0,1,1,1,3,3,3,3,2,0,0,0,0,0], + [0,0,0,0,0,0,0,1,1,1,2,2,1,1,2,2,0,0,0,0], + [0,0,0,0,0,0,0,0,1,1,2,1,1,1,1,1,1,0,0,0], + [0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,0,0], + [0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0], + [0,0,0,0,0,0,0,0,0,0,1,1,3,3,2,2,0,0,0,0], + [0,0,0,0,0,0,0,0,1,1,1,1,3,3,2,0,0,0,0,0], + [0,0,0,0,0,0,0,1,1,0,2,1,1,1,2,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,2,3,3,3,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + ] + }, + { + "name":"20 x 20 checkerboard double", + "mino":[ + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"] + ], + "rotation":[ + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + ] + }, + { + "name":"20 x 20 checkerboard single", + "mino":[ + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"] + ], + "rotation":[ + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + ] + }, + { + "name":"26 x 28 peace symbol", + "Mino":[ + ["b","b","b","b","b","b","b","b","b","b","b","b","j","i","i","i","i","o","o","l","l","j","j","j","z","j","j","i"], + ["b","b","b","b","b","b","b","b","j","l","j","j","j","s","j","j","j","o","o","l","z","j","l","l","z","z","j","i"], + ["b","b","b","b","b","b","b","b","j","l","l","l","s","s","j","b","b","b","b","l","z","z","l","o","o","z","j","i"], + ["b","b","b","b","b","b","b","t","j","j","z","z","s","b","b","b","j","l","b","b","b","z","l","o","o","j","z","i"], + ["b","b","b","b","b","b","t","t","t","z","z","b","b","b","j","j","j","l","l","l","b","b","b","j","j","j","z","z"], + ["b","b","b","b","b","b","i","i","i","i","b","b","j","z","s","s","t","t","t","z","z","s","b","b","t","t","t","z"], + ["b","b","b","b","b","b","t","t","t","b","b","s","j","z","z","s","s","t","z","z","s","s","b","b","b","t","l","l"], + ["b","b","b","b","b","b","b","t","b","b","s","s","j","j","z","j","j","j","o","o","s","b","b","s","b","b","l","i"], + ["b","b","b","b","b","b","z","z","b","l","s","i","i","i","i","j","s","s","o","o","b","b","s","s","j","b","l","i"], + ["b","b","b","b","b","z","z","b","b","l","o","o","l","l","t","t","t","s","s","b","b","z","s","b","j","b","b","i"], + ["b","b","b","b","b","l","l","b","l","l","o","o","l","o","o","t","z","z","b","b","t","z","z","l","j","j","b","i"], + ["b","b","b","b","b","l","b","b","i","i","i","i","l","o","o","z","z","b","b","t","t","t","z","l","l","l","b","b"], + ["b","b","b","b","b","l","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","j","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","j","b","b","o","o","l","l","t","t","t","z","z","b","b","i","i","i","i","j","o","o","b","b"], + ["b","b","b","b","b","j","j","b","o","o","l","s","s","t","z","z","s","s","b","b","s","s","b","j","o","o","b","l"], + ["b","b","b","b","b","b","z","b","b","z","l","i","s","s","l","l","l","s","s","b","b","s","s","j","j","b","b","l"], + ["b","b","b","b","b","b","z","z","b","z","z","i","j","j","j","i","l","j","j","j","b","b","t","t","t","b","l","l"], + ["b","b","b","b","b","b","l","z","b","b","z","i","j","o","o","i","s","j","o","o","z","b","b","t","b","b","j","j"], + ["b","b","b","b","b","b","l","l","l","b","b","i","l","o","o","i","s","s","o","o","z","z","b","b","b","o","o","j"], + ["b","b","b","b","b","b","i","i","i","i","b","b","l","l","l","i","j","s","t","t","t","z","b","b","t","o","o","j"], + ["b","b","b","b","b","b","b","b","t","s","s","b","b","b","j","j","j","z","z","t","b","b","b","t","t","t","z","z"], + ["b","b","b","b","b","b","b","b","t","t","s","s","l","b","b","b","z","z","b","b","b","i","i","i","i","z","z","i"], + ["b","b","b","b","b","b","b","b","t","o","o","z","l","l","l","b","b","b","b","j","j","j","t","t","t","j","j","i"], + ["b","b","b","b","b","b","b","b","b","o","o","z","z","j","j","j","l","l","l","j","t","s","s","t","o","o","j","i"], + ["b","b","b","b","b","b","b","b","i","i","i","i","z","j","i","i","i","i","l","t","t","t","s","s","o","o","j","i"] + ], + "Rotation":[ + [0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,0,0,2,2,1,1,1,0,0,0,2], + [0,0,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0,0,1,0,0,0,0], + [0,0,0,0,0,0,3,3,3,0,0,2,3,3,3,0,0,0,0,0,2,2,0,0,0,2,2,0], + [0,0,0,0,0,0,1,1,1,1,0,0,3,3,3,0,3,0,1,1,1,2,0,0,3,2,2,0], + [0,0,0,0,0,0,0,0,2,3,3,0,0,0,3,3,3,3,3,1,0,0,0,3,3,3,1,1], + [0,0,0,0,0,0,0,0,2,2,3,3,3,0,0,0,3,3,0,0,0,3,3,3,3,1,1,2], + [0,0,0,0,0,0,0,0,2,1,1,2,3,3,3,0,0,0,0,1,1,1,1,1,1,0,0,2], + [0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,1,1,1,1,1,3,3,3,1,3,3,0,2], + [0,0,0,0,0,0,0,0,3,3,3,3,2,1,3,3,3,3,1,3,3,3,3,3,3,3,0,2] + ] + }, + { + "name":"30 x 30 blank", + "mino":[ + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"], + ["b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b","b"] + ], + "rotation":[ + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,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0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + ] + }, + { + "name":"30 x 30 checkerboard double", + "mino":[ + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b"], + ["b","b","b","b","b","b","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z","b","b","z","z"], + ["b","b","b","b","b","b","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0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + ] + }, + { + "name":"30 x 30 checkerboard single", + "mino":[ + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"], + ["b","b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z"], + ["b","b","b","b","b","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b","z","b"] + ], + "rotation":[ + [0,0,0,0,0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,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0,0], + [0,0,0,0,0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + [0,0,0,0,0,0,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2], + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] + ] + } +] +`) diff --git a/edit.go b/edit.go new file mode 100644 index 0000000..7392021 --- /dev/null +++ b/edit.go @@ -0,0 +1,207 @@ +package main + +import ( + "time" + + "github.com/nsf/termbox-go" +) + +// NewEdit creates a new edit mode +func NewEdit() { + edit = &Edit{moved: true} +} + +// EnabledEditMode enable edit mode +func (edit *Edit) EnabledEditMode() { + if edit.y > board.height-1 { + edit.y = board.height - 1 + } + if edit.x > board.width-1 { + edit.x = board.width - 1 + } + edit.moved = true +} + +// DisableEditMode disable edit mode +func (edit *Edit) DisableEditMode() { + err := saveUserBoards() + if err != nil { + logger.Fatal("error saving user boards:", err) + } +} + +// BoardSizeMode changed to board size edit mode +func (edit *Edit) BoardSizeMode() { + edit.width = board.width + edit.height = board.height + edit.boardSize = true +} + +// BoardWidthIncrement board width increment +func (edit *Edit) BoardWidthIncrement() { + if edit.width > 39 { + return + } + edit.width++ +} + +// BoardWidthDecrement board width decrement +func (edit *Edit) BoardWidthDecrement() { + if edit.width < 9 { + return + } + edit.width-- +} + +// BoardHeightIncrement board height increment +func (edit *Edit) BoardHeightIncrement() { + if edit.height > 39 { + return + } + edit.height++ +} + +// BoardHeightDecrement board height decrement +func (edit *Edit) BoardHeightDecrement() { + if edit.height < 9 { + return + } + edit.height-- +} + +// ChangeBoardSize create new board +func (edit *Edit) ChangeBoardSize() { + ChangeBoardSize(edit.width, edit.height) + edit.boardSize = false +} + +// EmptyBoard removes all blocks/colors from the board +func (edit *Edit) EmptyBoard() { + board.EmptyBoard() +} + +// CursorUp move cursor up +func (edit *Edit) CursorUp() { + if !edit.moved { + edit.moved = true + } + if edit.y < 1 { + return + } + edit.y-- +} + +// CursorDown move cursor down +func (edit *Edit) CursorDown() { + if !edit.moved { + edit.moved = true + } + if edit.y == board.height-1 { + return + } + edit.y++ +} + +// CursorRight move cursor right +func (edit *Edit) CursorRight() { + if !edit.moved { + edit.moved = true + } + if edit.x == board.width-1 { + return + } + edit.x++ +} + +// CursorLeft move cursor left +func (edit *Edit) CursorLeft() { + if !edit.moved { + edit.moved = true + } + if edit.x < 1 { + return + } + edit.x-- +} + +// SetColor sets the board color +func (edit *Edit) SetColor(color termbox.Attribute) { + if edit.moved { + edit.moved = false + } + if edit.saved { + edit.saved = false + } + board.SetColor(edit.x, edit.y, color, -1) +} + +// RotateLeft rotates cell left +func (edit *Edit) RotateLeft() { + if edit.moved { + edit.moved = false + } + if edit.saved { + edit.saved = false + } + board.RotateLeft(edit.x, edit.y) +} + +// RotateRight rotates cell right +func (edit *Edit) RotateRight() { + if edit.moved { + edit.moved = false + } + if edit.saved { + edit.saved = false + } + board.RotateRight(edit.x, edit.y) +} + +// DrawCursor draws the cursor location when cursor moves +func (edit *Edit) DrawCursor() { + if !edit.moved { + return + } + board.DrawCursor(edit.x, edit.y) +} + +// SaveBoard save board +func (edit *Edit) SaveBoard() { + if board.boardsIndex < numInternalBoards { + edit.SaveBoardNew() + return + } + boards[board.boardsIndex].colors = board.colors + boards[board.boardsIndex].rotation = board.rotation + if !edit.saved { + edit.saved = true + } +} + +// SaveBoardNew save board as new board +func (edit *Edit) SaveBoardNew() { + aBoards := Boards{name: time.Now().Format("Jan 2 3:4:5")} + aBoards.colors = make([][]termbox.Attribute, len(board.colors)) + for i := 0; i < len(board.colors); i++ { + aBoards.colors[i] = append(aBoards.colors[i], board.colors[i]...) + } + aBoards.rotation = make([][]int, len(board.rotation)) + for i := 0; i < len(board.rotation); i++ { + aBoards.rotation[i] = append(aBoards.rotation[i], board.rotation[i]...) + } + boards = append(boards, aBoards) + board.boardsIndex = len(boards) - 1 + if !edit.saved { + edit.saved = true + } +} + +// DeleteBoard deletes a board +func (edit *Edit) DeleteBoard() { + if board.boardsIndex < numInternalBoards { + return + } + boards = append(boards[:board.boardsIndex], boards[board.boardsIndex+1:]...) + board.boardsIndex-- + board.Clear() +} diff --git a/engine.go b/engine.go index d435260..0682cd7 100644 --- a/engine.go +++ b/engine.go @@ -48,7 +48,7 @@ loop: engine.tick() case <-engine.aiTimer.C: engine.ai.ProcessQueue() - engine.aiTimer.Reset(engine.tickTime / 6) + engine.aiTimer.Reset(engine.tickTime / aiTickDivider) case <-engine.chanStop: break loop } @@ -93,7 +93,7 @@ func (engine *Engine) Pause() { func (engine *Engine) UnPause() { engine.timer.Reset(engine.tickTime) if engine.aiEnabled { - engine.aiTimer.Reset(engine.tickTime / 6) + engine.aiTimer.Reset(engine.tickTime / aiTickDivider) } engine.paused = false } @@ -246,7 +246,7 @@ loop: func (engine *Engine) EnabledAi() { engine.aiEnabled = true go engine.ai.GetBestQueue() - engine.aiTimer.Reset(engine.tickTime / 6) + engine.aiTimer.Reset(engine.tickTime / aiTickDivider) } // DisableAi disables the AI @@ -259,3 +259,15 @@ func (engine *Engine) DisableAi() { } } } + +// EnabledEditMode enables edit mode +func (engine *Engine) EnabledEditMode() { + edit.EnabledEditMode() + engine.editMode = true +} + +// DisableEditMode disables edit mode +func (engine *Engine) DisableEditMode() { + edit.DisableEditMode() + engine.editMode = false +} diff --git a/globals.go b/globals.go index 4e97770..befc3c6 100644 --- a/globals.go +++ b/globals.go @@ -8,10 +8,12 @@ import ( ) const ( - blankColor = termbox.ColorBlack - boardXOffset = 4 - boardYOffset = 2 - rankingFileName = "/tetris.db" + blankColor = termbox.ColorBlack + boardXOffset = 4 + boardYOffset = 2 + aiTickDivider = 8 + rankingFileName = "/go-tetris.db" + settingsFileName = "/go-tetris.json" // MinoPreview is for the preview mino MinoPreview MinoType = iota @@ -57,12 +59,20 @@ type ( dropDistance int } - // Boards holds all the premade boards + // Boards holds all the boards Boards struct { + name string colors [][]termbox.Attribute rotation [][]int } + // BoardsJSON is for JSON format of boards + BoardsJSON struct { + Name string + Mino [][]string + Rotation [][]int + } + // KeyInput is the key input engine KeyInput struct { stopped bool @@ -103,16 +113,35 @@ type ( ai *Ai aiEnabled bool aiTimer *time.Timer + editMode bool + } + + // Edit is the board edit mode + Edit struct { + x int + y int + moved bool + boardSize bool + width int + height int + saved bool + } + + // Settings is the JSON load/save file + Settings struct { + Boards []BoardsJSON } ) var ( - boards []Boards - baseDir string logger *log.Logger minos *Minos board *Board view *View engine *Engine + edit *Edit + + boards []Boards + numInternalBoards int ) diff --git a/keyInput.go b/keyInput.go index 12bd0d4..f76f6a5 100644 --- a/keyInput.go +++ b/keyInput.go @@ -40,7 +40,7 @@ loop: // ProcessEvent process the key input event func (keyInput *KeyInput) ProcessEvent(event *termbox.Event) { - if event.Key == termbox.KeyCtrlI { + if event.Key == termbox.KeyCtrlL { // Ctrl l (lower case L) to log stack trace buffer := make([]byte, 1<<16) length := runtime.Stack(buffer, true) @@ -49,6 +49,73 @@ func (keyInput *KeyInput) ProcessEvent(event *termbox.Event) { return } + if engine.editMode { + if edit.boardSize { + switch event.Ch { + case 0: + switch event.Key { + case termbox.KeyArrowUp: + edit.BoardHeightIncrement() + case termbox.KeyArrowDown: + edit.BoardHeightDecrement() + case termbox.KeyArrowLeft: + edit.BoardWidthDecrement() + case termbox.KeyArrowRight: + edit.BoardWidthIncrement() + } + case 'q': + edit.ChangeBoardSize() + } + } else { + switch event.Ch { + case 0: + switch event.Key { + case termbox.KeyArrowUp: + edit.CursorUp() + case termbox.KeyArrowDown: + edit.CursorDown() + case termbox.KeyArrowLeft: + edit.CursorLeft() + case termbox.KeyArrowRight: + edit.CursorRight() + case termbox.KeyCtrlB: + edit.BoardSizeMode() + case termbox.KeyCtrlS: + edit.SaveBoard() + case termbox.KeyCtrlN: + edit.SaveBoardNew() + case termbox.KeyCtrlK: + edit.DeleteBoard() + case termbox.KeyCtrlO: + edit.EmptyBoard() + case termbox.KeyCtrlQ, termbox.KeyCtrlC: + engine.DisableEditMode() + } + case 'c': + edit.SetColor(termbox.ColorCyan) + case 'b': + edit.SetColor(termbox.ColorBlue) + case 'w': + edit.SetColor(termbox.ColorWhite) + case 'e': + edit.SetColor(termbox.ColorYellow) + case 'g': + edit.SetColor(termbox.ColorGreen) + case 'a': + edit.SetColor(termbox.ColorMagenta) + case 'r': + edit.SetColor(termbox.ColorRed) + case 'f': + edit.SetColor(blankColor) + case 'z': + edit.RotateLeft() + case 'x': + edit.RotateRight() + } + } + return + } + if event.Ch == 'q' || event.Key == termbox.KeyCtrlC { if !keyInput.stopped { keyInput.stopped = true @@ -67,6 +134,8 @@ func (keyInput *KeyInput) ProcessEvent(event *termbox.Event) { board.PreviousBoard() case termbox.KeyArrowRight: board.NextBoard() + case termbox.KeyCtrlE: + engine.EnabledEditMode() } } return @@ -89,7 +158,8 @@ func (keyInput *KeyInput) ProcessEvent(event *termbox.Event) { return } - if event.Ch == 0 { + switch event.Ch { + case 0: switch event.Key { case termbox.KeySpace: board.MinoDrop() @@ -102,17 +172,14 @@ func (keyInput *KeyInput) ProcessEvent(event *termbox.Event) { case termbox.KeyArrowRight: board.MinoMoveRight() } - } else { - switch event.Ch { - case 'z': - board.MinoRotateLeft() - case 'x': - board.MinoRotateRight() - case 'p': - engine.Pause() - case 'i': - engine.EnabledAi() - } + case 'z': + board.MinoRotateLeft() + case 'x': + board.MinoRotateRight() + case 'p': + engine.Pause() + case 'i': + engine.EnabledAi() } } diff --git a/mino_test.go b/mino_test.go index 3e17b1d..0c495ea 100644 --- a/mino_test.go +++ b/mino_test.go @@ -24,6 +24,11 @@ func setupForTesting() { rand.Seed(1) + err := loadBoards() + if err != nil { + log.Fatal("error loading boards:", err) + } + NewMinos() NewBoard() NewEngine() diff --git a/screenshots/editmode.png b/screenshots/editmode.png new file mode 100644 index 0000000..670fc09 Binary files /dev/null and b/screenshots/editmode.png differ diff --git a/screenshots/heart.png b/screenshots/heart.png new file mode 100644 index 0000000..572690b Binary files /dev/null and b/screenshots/heart.png differ diff --git a/screenshots/highscores.png b/screenshots/highscores.png new file mode 100644 index 0000000..9b6043f Binary files /dev/null and b/screenshots/highscores.png differ diff --git a/screenshots/screenshot1.png b/screenshots/screenshot1.png deleted file mode 100644 index daddf01..0000000 Binary files a/screenshots/screenshot1.png and /dev/null differ diff --git a/screenshots/screenshot2.png b/screenshots/screenshot2.png deleted file mode 100644 index 6356c2f..0000000 Binary files a/screenshots/screenshot2.png and /dev/null differ diff --git a/screenshots/screenshot3.png b/screenshots/screenshot3.png deleted file mode 100644 index a9f4016..0000000 Binary files a/screenshots/screenshot3.png and /dev/null differ diff --git a/screenshots/screenshot4.png b/screenshots/screenshot4.png deleted file mode 100644 index 67e62b9..0000000 Binary files a/screenshots/screenshot4.png and /dev/null differ diff --git a/screenshots/tetris.png b/screenshots/tetris.png new file mode 100644 index 0000000..cb0cb38 Binary files /dev/null and b/screenshots/tetris.png differ diff --git a/tetris.go b/tetris.go index 0d0a0b3..8553dd2 100644 --- a/tetris.go +++ b/tetris.go @@ -13,20 +13,30 @@ func main() { logger = log.New(os.Stderr, "", log.Ldate|log.Ltime|log.LUTC|log.Llongfile) logFile, err := os.OpenFile(baseDir+"/go-tetris.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644) if err != nil { - log.Fatal("error opening logFile:", err) + logger.Fatal("error opening log file:", err) } defer logFile.Close() logger.SetOutput(logFile) rand.Seed(time.Now().UnixNano()) + err = loadBoards() + if err != nil { + logger.Fatal("error loading internal boards:", err) + } + + err = loadUserBoards() + if err != nil { + logger.Fatal("error loading user boards:", err) + } + NewMinos() NewBoard() NewView() NewEngine() + NewEdit() engine.Run() view.Stop() - } diff --git a/view.go b/view.go index 2670838..7804b83 100644 --- a/view.go +++ b/view.go @@ -32,29 +32,53 @@ func (view *View) Stop() { func (view *View) RefreshScreen() { termbox.Clear(termbox.ColorDefault, termbox.ColorDefault) - view.drawBackground() + view.drawBoardBoarder() + + if engine.editMode { + if edit.boardSize { + board.DrawBoard() + view.drawEditTextsBoardSize() + } else { + board.DrawBoard() + edit.DrawCursor() + view.drawEditTexts() + } + termbox.Flush() + return + } + + view.drawPreviewBoarder() view.drawTexts() if engine.previewBoard { board.DrawBoard() view.drawGameOver() - } else if engine.gameOver { - view.drawGameOver() - view.drawRankingScores() - } else if engine.paused { - view.drawPaused() - } else { - board.DrawBoard() - board.DrawPreviewMino() - board.DrawDropMino() - board.DrawCurrentMino() + termbox.Flush() + return } + if engine.gameOver { + view.drawGameOver() + view.drawRankingScores() + termbox.Flush() + return + } + + if engine.paused { + view.drawPaused() + termbox.Flush() + return + } + + board.DrawBoard() + board.DrawPreviewMino() + board.DrawDropMino() + board.DrawCurrentMino() termbox.Flush() } -// drawBackground draws the background -func (view *View) drawBackground() { +// drawBoard draws the board boarder +func (view *View) drawBoardBoarder() { // playing board xOffset := boardXOffset yOffset := boardYOffset @@ -70,12 +94,14 @@ func (view *View) drawBackground() { } } } +} - // piece preview - xOffset = boardXOffset + board.width*2 + 8 - yOffset = boardYOffset - xEnd = xOffset + 14 - yEnd = yOffset + 6 +// drawPreviewBoarder draws the preview boarder +func (view *View) drawPreviewBoarder() { + xOffset := boardXOffset + board.width*2 + 8 + yOffset := boardYOffset + xEnd := xOffset + 14 + yEnd := yOffset + 6 for x := xOffset; x < xEnd; x++ { for y := yOffset; y < yEnd; y++ { if x == xOffset || x == xOffset+1 || x == xEnd-1 || x == xEnd-2 || @@ -112,10 +138,6 @@ func (view *View) drawTexts() { // ascii arrow characters add extra two spaces view.drawText(xOffset, yOffset, "← - left", termbox.ColorWhite, termbox.ColorBlack) yOffset++ - view.drawText(xOffset, yOffset, "z - rotate left", termbox.ColorWhite, termbox.ColorBlack) - yOffset++ - view.drawText(xOffset, yOffset, "x - rotate right", termbox.ColorWhite, termbox.ColorBlack) - yOffset++ view.drawText(xOffset, yOffset, "→ - right", termbox.ColorWhite, termbox.ColorBlack) yOffset++ view.drawText(xOffset, yOffset, "↓ - soft drop", termbox.ColorWhite, termbox.ColorBlack) @@ -124,21 +146,116 @@ func (view *View) drawTexts() { yOffset++ view.drawText(xOffset, yOffset, "sbar - hard drop", termbox.ColorWhite, termbox.ColorBlack) yOffset++ + view.drawText(xOffset, yOffset, "z - rotate left", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "x - rotate right", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ view.drawText(xOffset, yOffset, "p - pause", termbox.ColorWhite, termbox.ColorBlack) yOffset++ view.drawText(xOffset, yOffset, "q - quit", termbox.ColorWhite, termbox.ColorBlack) } +// drawEditTexts draws the edit text +func (view *View) drawEditTexts() { + xOffset := boardXOffset + board.width*2 + 8 + yOffset := boardYOffset + + view.drawText(xOffset, yOffset, "Name:", termbox.ColorWhite, termbox.ColorBlue) + view.drawText(xOffset+7, yOffset, boards[board.boardsIndex].name, termbox.ColorBlack, termbox.ColorWhite) + yOffset++ + view.drawText(xOffset, yOffset, "Saved:", termbox.ColorWhite, termbox.ColorBlue) + if edit.saved { + view.drawText(xOffset+7, yOffset, "yes", termbox.ColorBlack, termbox.ColorWhite) + } else { + view.drawText(xOffset+7, yOffset, "no", termbox.ColorBlack, termbox.ColorWhite) + } + + yOffset += 2 + + // ascii arrow characters add extra two spaces + view.drawText(xOffset, yOffset, "← - left", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "→ - right", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "↓ - down", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "↑ - up", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "z - rotate left", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "x - rotate right", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "c - cyan", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "b - blue", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "w - white", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "e - yellow", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "g - green", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "a - magenta", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "r - red", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "f - free", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "ctrl b - change board size", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "ctrl s - save board", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "ctrl n - save board as new", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "ctrl k - delete board", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "ctrl o - empty board", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "ctrl q - quit", termbox.ColorWhite, termbox.ColorBlack) +} + +// drawEditTextsBoardSize draws the edit text for board size mode +func (view *View) drawEditTextsBoardSize() { + xOffset := boardXOffset + board.width*2 + 8 + yOffset := boardYOffset + + view.drawText(xOffset, yOffset, "Name:", termbox.ColorWhite, termbox.ColorBlue) + view.drawText(xOffset+7, yOffset, boards[board.boardsIndex].name, termbox.ColorBlack, termbox.ColorWhite) + + yOffset += 2 + + view.drawText(xOffset, yOffset, "Size:", termbox.ColorWhite, termbox.ColorBlue) + view.drawText(xOffset+7, yOffset, fmt.Sprintf("%2d X %2d", edit.width, edit.height), termbox.ColorBlack, termbox.ColorWhite) + + yOffset += 2 + + // ascii arrow characters add extra two spaces + view.drawText(xOffset, yOffset, "← - board width decrement", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "→ - board width increment", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "↓ - board height decrement", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "↑ - board height increment", termbox.ColorWhite, termbox.ColorBlack) + yOffset++ + view.drawText(xOffset, yOffset, "q - done", termbox.ColorWhite, termbox.ColorBlack) +} + // DrawPreviewMinoBlock draws the preview mino func (view *View) DrawPreviewMinoBlock(x int, y int, color termbox.Attribute, rotation int, length int) { - var char1 rune - var char2 rune - if rotation < 2 { - char1 = '▓' - char2 = ' ' - } else { - char1 = ' ' - char2 = '▓' + char1 := ' ' + char2 := ' ' + switch rotation { + case 0: + char1 = '▄' + char2 = '▄' + case 1: + char1 = '█' + case 2: + char1 = '▀' + char2 = '▀' + case 3: + char2 = '█' } xOffset := 2*x + 2*board.width + boardXOffset + 11 + (4 - length) termbox.SetCell(xOffset, y+boardYOffset+2, char1, color, color^termbox.AttrBold) @@ -147,14 +264,19 @@ func (view *View) DrawPreviewMinoBlock(x int, y int, color termbox.Attribute, ro // DrawBlock draws a block func (view *View) DrawBlock(x int, y int, color termbox.Attribute, rotation int) { - var char1 rune - var char2 rune - if rotation < 2 { - char1 = '▓' - char2 = ' ' - } else { - char1 = ' ' - char2 = '▓' + char1 := ' ' + char2 := ' ' + switch rotation { + case 0: + char1 = '▄' + char2 = '▄' + case 1: + char1 = '█' + case 2: + char1 = '▀' + char2 = '▀' + case 3: + char2 = '█' } if color == blankColor { // blankColor means drop Mino @@ -304,3 +426,10 @@ func (view *View) colorizeLine(y int, color termbox.Attribute) { termbox.SetCell(x*2+boardXOffset+3, y+boardYOffset+1, ' ', termbox.ColorDefault, color) } } + +// DrawCursor draws current cursor location +func (view *View) DrawCursor(x int, y int, color termbox.Attribute) { + termbox.SetCell(x*2+boardXOffset+2, y+boardYOffset+1, '◄', color^termbox.AttrBold, termbox.ColorBlack^termbox.AttrBold) + termbox.SetCell(x*2+boardXOffset+3, y+boardYOffset+1, '►', color^termbox.AttrBold, termbox.ColorBlack^termbox.AttrBold) + termbox.Flush() +}