diff --git a/index.js b/index.js index 8a21ee1..d9d8070 100644 --- a/index.js +++ b/index.js @@ -1,116 +1,7 @@ const inquirer = require('inquirer') const colors = require('colors') -const messagesList = { - - welcome: { - - english: 'Welcome to the Rock Paper and Scissors CLI game!', - spanish: '¡Bienvenido al juego de Piedra Papel o Tijeras desde la consola!' - }, - - gameTitle: { - - english: 'Rock Paper and Scissors CLI game', - spanish: 'Piedra Papel o Tijeras desde la consola' - }, - - play: { - - english: 'Select one option:', - spanish: 'Selecciona una opción' - }, - - options: { - - english: ['Rock', 'Paper', 'Scissors'], - spanish: ['Piedra', 'Papel', 'Tijeras'] - }, - - resultTitle: { - - english: 'Results:', - spanish: 'Resultados:' - }, - - tie: { - - english: ' - The result is a draw! GG', - spanish: ' - Empate! Bien Jugado.' - }, - - victory: { - - english: ' - You win!', - spanish: ' - Ganaste!' - }, - - defeat: { - - english: ' - You lost...', - spanish: ' - Perdiste...' - }, - - computerSelectionTitle: { - - english: 'Computer selection:', - spanish: 'Selección de la computadora:' - }, - - computerSelection: { - - english: ' - Computer selection is ', - spanish: ' - La selección de la computadora es ' - }, - - stats: { - - title: { - - english: 'Stats:', - spanish: 'Estadisticas:' - }, - - victory: { - - english: ' - Victory count: ', - spanish: ' - Victorias: ' - }, - - consecutiveVictory: { - - english: ' - Consecutive victory count: ', - spanish: ' - Victorias consecutivas: ', - }, - - defeat: { - - english: ' - Defeat count: ', - spanish: ' - Derrotas: ', - }, - }, - - playAgain: { - - title: { - - english: 'Do you wanna play again?', - spanish: '¿Quieres jugar otra vez?' - }, - - options: { - - english: ['Yes', 'No'], - spanish: ['Sí', 'No'] - } - }, - - thanksForPlay: { - - english: 'Thanks for playing! Francisco Pessano', - spanish: 'Gracias por jugar! Francisco Pessano' - } -} +const messagesList = require('./scripts/messagesList.js') victoryCount = 0 consecutiveVictoryCount = 0 @@ -184,57 +75,6 @@ function gameLogic(languageSelection) { console.log(messagesList.tie[languageSelection].bold.yellow) } - // if (computerSelection === 'Rock') { - - // if (userSelection === 'Paper') { - - // victoryMessage() - // return - // } - - // if (userSelection === 'Scissors') { - - // defeatMessage() - // return - // } - - // return - // } - - // if (computerSelection === 'Paper') { - - // if (userSelection === 'Rock') { - - // defeatMessage() - // return - // } - - // if (userSelection === 'Scissors') { - - // victoryMessage() - // return - // } - - // return - // } - - // if (computerSelection === 'Scissors') { - - // if (userSelection === 'Rock') { - - // victoryMessage() - // return - // } - - // if (userSelection === 'Paper') { - - // defeatMessage() - // return - // } - - // return - // } - switch (computerSelection) { case 'Rock': diff --git a/scripts/messagesList.js b/scripts/messagesList.js new file mode 100644 index 0000000..31041a3 --- /dev/null +++ b/scripts/messagesList.js @@ -0,0 +1,112 @@ +const messagesList = { + + welcome: { + + english: 'Welcome to the Rock Paper and Scissors CLI game!', + spanish: '¡Bienvenido al juego de Piedra Papel o Tijeras desde la consola!' + }, + + gameTitle: { + + english: 'Rock Paper and Scissors CLI game', + spanish: 'Piedra Papel o Tijeras desde la consola' + }, + + play: { + + english: 'Select one option:', + spanish: 'Selecciona una opción' + }, + + options: { + + english: ['Rock', 'Paper', 'Scissors'], + spanish: ['Piedra', 'Papel', 'Tijeras'] + }, + + resultTitle: { + + english: 'Results:', + spanish: 'Resultados:' + }, + + tie: { + + english: ' - The result is a draw! GG', + spanish: ' - Empate! Bien Jugado.' + }, + + victory: { + + english: ' - You win!', + spanish: ' - Ganaste!' + }, + + defeat: { + + english: ' - You lost...', + spanish: ' - Perdiste...' + }, + + computerSelectionTitle: { + + english: 'Computer selection:', + spanish: 'Selección de la computadora:' + }, + + computerSelection: { + + english: ' - Computer selection is ', + spanish: ' - La selección de la computadora es ' + }, + + stats: { + + title: { + + english: 'Stats:', + spanish: 'Estadisticas:' + }, + + victory: { + + english: ' - Victory count: ', + spanish: ' - Victorias: ' + }, + + consecutiveVictory: { + + english: ' - Consecutive victory count: ', + spanish: ' - Victorias consecutivas: ', + }, + + defeat: { + + english: ' - Defeat count: ', + spanish: ' - Derrotas: ', + }, + }, + + playAgain: { + + title: { + + english: 'Do you wanna play again?', + spanish: '¿Quieres jugar otra vez?' + }, + + options: { + + english: ['Yes', 'No'], + spanish: ['Sí', 'No'] + } + }, + + thanksForPlay: { + + english: 'Thanks for playing! Francisco Pessano', + spanish: 'Gracias por jugar! Francisco Pessano' + } +} + +module.exports = messagesList \ No newline at end of file