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
module.exports = { | |
//Tamaño del tablero, este caso es de 3x3 | |
GAME_SIZE: 3, | |
//Una posición sin marcar | |
UNSELECTED_POSITION: ' ', | |
//Identificador del jugador 1 | |
PLAYER_INDEX_1: 1, | |
//Identificador del jugador 2 | |
PLAYER_INDEX_2: 2, | |
//Caracteres de los jugadores: |
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
const bookshelf = require('bookshelf'); | |
const db = require('../knex/db'); | |
module.exports = bookshelf(db.getPoolConnection()); |
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
const knex = require('knex'); | |
let pool; | |
module.exports = { | |
getPoolConnection | |
} | |
function getPoolConnection() { | |
if(!pool) { | |
pool = knex({ |
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
const mysql = require('mysql2'); | |
let pool; | |
module.exports = { | |
getPoolConnection | |
} | |
function getPoolConnection() { | |
if(!pool) { | |
pool = mysql.createPool({ |
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
docker pull mysql/mysql-server | |
docker images | |
docker run --name=mysql1 -p 3306:3306 -d mysql/mysql-server | |
docker start mysql1 | |
docker logs mysql1 |
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
const readline = require('readline'); | |
const Constants = require('../helpers/constants'); | |
module.exports = function(GameBoardScreen) { | |
function initKeypressEvents() { | |
readline.emitKeypressEvents(process.stdin); | |
process.stdin.setRawMode(true); | |
process.stdin.on('keypress', (str, key) => { | |
console.log('key', key); | |
if(key.ctrl && key.name === 'c') { |
NewerOlder