-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Game board represented as an array of strings, one string per line | ||
// Example board: | ||
/* | ||
<! . . . . . . . . . .!> SCORE | ||
<! . . . . . . . . . .!> 1,000,000 | ||
<! . . . . . . . . . .!> | ||
<! . . . . . . . . . .!> LEFT/RIGHT: Move piece | ||
<! . . . . . . . . . .!> X: Rotate clockwise | ||
<! . . . . . . . . . .!> Z: Rotate counterclockwise | ||
NEXT <! . . . . . . . . . .!> Down: Soft drop | ||
[][][][] <! . . . . . . . . . .!> Space: Hard drop | ||
<! . . . . . . . . . .!> Shift: Hold piece | ||
<! . . . . . . . . . .!> | ||
<! . . . . . . . . . .!> | ||
<! . . . . . . . . . .!> | ||
HOLD <! . . . . . . . . . .!> | ||
[] <! . . . . . . . . . .!> | ||
[][][] <! . . . . . . . . . .!> | ||
<! . . . . . . . . . .!> | ||
<! . . . . . . . . . .!> | ||
<! . . . . . . . . . .!> | ||
<! . . . . . . . . . .!> | ||
<! . . . . . . . . . .!> | ||
<! . . . . . . . . . .!> | ||
\/\/\/\/\/\/\/\/\/\/ | ||
*/ | ||
var board = []; | ||
board[0] = "\n\r"; | ||
board[1] = " <! . . . . . . . . . .!> SCORE\n\r"; | ||
board[2] = " <! . . . . . . . . . .!> \n\r"; | ||
board[3] = " <! . . . . . . . . . .!>\n\r"; | ||
board[4] = " <! . . . . . . . . . .!> LEFT/RIGHT: Move piece\n\r"; | ||
board[5] = " <! . . . . . . . . . .!> X: Rotate clockwise\n\r"; | ||
board[6] = " <! . . . . . . . . . .!> Z: Rotate counterclockwise\n\r"; | ||
board[7] = " NEXT <! . . . . . . . . . .!> Down: Soft drop\n\r"; | ||
board[8] = " <! . . . . . . . . . .!> Space: Hard drop\n\r"; | ||
board[9] = " <! . . . . . . . . . .!> Shift: Hold piece\n\r"; | ||
board[10] = " <! . . . . . . . . . .!>\n\r"; | ||
board[11] = " <! . . . . . . . . . .!>\n\r"; | ||
board[12] = " <! . . . . . . . . . .!>\n\r"; | ||
board[13] = " HOLD <! . . . . . . . . . .!>\n\r"; | ||
board[14] = " <! . . . . . . . . . .!>\n\r"; | ||
board[15] = " <! . . . . . . . . . .!>\n\r"; | ||
board[16] = " <! . . . . . . . . . .!>\n\r"; | ||
board[17] = " <! . . . . . . . . . .!>\n\r"; | ||
board[18] = " <! . . . . . . . . . .!>\n\r"; | ||
board[19] = " <! . . . . . . . . . .!>\n\r"; | ||
board[20] = " <! . . . . . . . . . .!>\n\r"; | ||
board[21] = " <! . . . . . . . . . .!>\n\r"; | ||
board[22] = " \\/\\/\\/\\/\\/\\/\\/\\/\\/\\/"; | ||
|
||
function main(xterm) { | ||
updateScreen(xterm, board); | ||
} | ||
|
||
/** | ||
* | ||
* @param {*} xterm | ||
* @param {*} board | ||
*/ | ||
function updateScreen(xterm, board) { | ||
for (let i = 0; i < board.length; i++) { | ||
xterm.write(board[i]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters