From 8047eb02e260be580e03b09c9d6cdbda587f4551 Mon Sep 17 00:00:00 2001 From: Fabrizzio Rivera Date: Wed, 7 Nov 2018 08:49:21 -0600 Subject: [PATCH 1/3] changes --- client/index.html | 2 +- src/App.ts | 3 ++- src/components/Game.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/index.html b/client/index.html index 16f863d..5652b25 100644 --- a/client/index.html +++ b/client/index.html @@ -2,7 +2,7 @@ - Cliente UNO + Node UNO diff --git a/src/App.ts b/src/App.ts index 4596980..aaaa46c 100644 --- a/src/App.ts +++ b/src/App.ts @@ -34,6 +34,7 @@ class App { } fillDeck(): Array{ + this.cards = [] // LLenar el deck // Llenar cada color for (let c = 0; c < 4; c++){ @@ -55,7 +56,7 @@ class App { // Esta funcion crea un nuevo juego public createGame(gameCode: string): Array{ // Empuja un nuevo juego al arreglo de juegos - this.games.push({'gameCode': gameCode, 'players': [], 'topCard': this.dealCards(1)[0], 'turn': -1}) + this.games.push({'gameCode': gameCode, 'players': [], 'topCard': this.dealCards(1)[0], 'turn': -1, 'deck': this.fillDeck()}) console.log(this.games) return this.games } diff --git a/src/components/Game.ts b/src/components/Game.ts index 58f99d0..f1d870a 100644 --- a/src/components/Game.ts +++ b/src/components/Game.ts @@ -5,4 +5,5 @@ export class Game { players: Array; topCard: Card; turn: number; + deck: Array } \ No newline at end of file From ec21f9ba9cb6b41849a7ba4d372dae07aa8427f3 Mon Sep 17 00:00:00 2001 From: Fabrizzio Rivera Date: Tue, 13 Nov 2018 21:08:11 -0600 Subject: [PATCH 2/3] changes --- src/App.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/App.ts b/src/App.ts index aaaa46c..8668d4d 100644 --- a/src/App.ts +++ b/src/App.ts @@ -4,7 +4,7 @@ import { Card } from './components/Card' import * as express from 'express' import * as socketIo from 'socket.io' import * as path from 'path' -import { Result } from 'range-parser'; +//import { Result } from 'range-parser'; class App { // Variables publicas @@ -34,7 +34,7 @@ class App { } fillDeck(): Array{ - this.cards = [] + let deck: Array = [] // LLenar el deck // Llenar cada color for (let c = 0; c < 4; c++){ @@ -47,8 +47,9 @@ class App { newCard.color = 4 } - this.cards.push(newCard) + deck.push(newCard) } + this.cards = deck } return this.cards } From dc979c3eb63dbd767fc4e924543e2e62eb220a2b Mon Sep 17 00:00:00 2001 From: Fabrizzio Rivera Date: Tue, 13 Nov 2018 21:24:43 -0600 Subject: [PATCH 3/3] Infinite Deck --- src/App.ts | 8 +++----- src/components/Game.ts | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/App.ts b/src/App.ts index 8668d4d..ec92424 100644 --- a/src/App.ts +++ b/src/App.ts @@ -34,7 +34,6 @@ class App { } fillDeck(): Array{ - let deck: Array = [] // LLenar el deck // Llenar cada color for (let c = 0; c < 4; c++){ @@ -47,9 +46,8 @@ class App { newCard.color = 4 } - deck.push(newCard) + this.cards.push(newCard) } - this.cards = deck } return this.cards } @@ -57,7 +55,7 @@ class App { // Esta funcion crea un nuevo juego public createGame(gameCode: string): Array{ // Empuja un nuevo juego al arreglo de juegos - this.games.push({'gameCode': gameCode, 'players': [], 'topCard': this.dealCards(1)[0], 'turn': -1, 'deck': this.fillDeck()}) + this.games.push({'gameCode': gameCode, 'players': [], 'topCard': this.dealCards(1)[0], 'turn': -1}) console.log(this.games) return this.games } @@ -97,7 +95,7 @@ class App { let randomCards: Array = [] for (let i = 0; i < cardsToDeal; i++){ if (this.cards.length == 0){ - this.cards == this.usedCards; + this.fillDeck(); } // Va a elegir un numero aleatorio de 0 a la cantidad de cartas que esten en el maso randomCardIndex = Math.floor(Math.random()*this.cards.length) diff --git a/src/components/Game.ts b/src/components/Game.ts index f1d870a..ffc02bd 100644 --- a/src/components/Game.ts +++ b/src/components/Game.ts @@ -4,6 +4,5 @@ export class Game { gameCode: string; players: Array; topCard: Card; - turn: number; - deck: Array + turn: number } \ No newline at end of file