-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
getters and setters for player, card, structuring
- Loading branch information
Pratham Gupta
committed
Aug 21, 2020
1 parent
e33237d
commit 2bd4c64
Showing
10 changed files
with
81 additions
and
51 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,24 @@ | ||
/* eslint-disable no-unused-vars */ | ||
/* | ||
* Card class whose objects are used inside Game Decks. | ||
*/ | ||
|
||
class Card { | ||
constructor (cardSuit, cardValue, cardId) { | ||
this._suit = cardSuit | ||
this._value = cardValue | ||
this._id = cardId | ||
} | ||
|
||
get suit () { | ||
return this._suit | ||
} | ||
|
||
get value () { | ||
return this._value | ||
} | ||
|
||
get id () { | ||
return this._id | ||
} | ||
} |
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
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,32 @@ | ||
/* eslint-disable no-unused-vars */ | ||
// Creating the player containing the name of the player, | ||
// number of cards of the player and cards that the player has | ||
// and the cards he has selected | ||
|
||
class Player { | ||
constructor (name) { | ||
this._name = name | ||
this._cards = [] | ||
this._selectedCards = [] | ||
} | ||
|
||
get name () { | ||
return this._name | ||
} | ||
|
||
get cards () { | ||
return this._cards | ||
} | ||
|
||
set cards (cards) { | ||
this._cards = cards | ||
} | ||
|
||
get selectedCards () { | ||
return this._selectedCards | ||
} | ||
|
||
set selectedCards (cards) { | ||
this._selectedCards = cards | ||
} | ||
} |
File renamed without changes.
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
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,15 @@ | ||
/* eslint-disable no-unused-vars */ | ||
/* | ||
* To add 'dummy' flipped cards to the rendered Central Deck | ||
* This is different from the CentralDeck array that actually stores the cards moved to the central deck | ||
*/ | ||
|
||
function renderStackCard () { | ||
const card = document.createElement('div') | ||
card.className = 'Card' | ||
const cardText = document.createElement('div') | ||
cardText.innerHTML = 'BLUFF!?' | ||
cardText.className = 'cardRank' | ||
card.appendChild(cardText) | ||
document.getElementById('CentralStack').appendChild(card) | ||
} |