Commit 6117d857 authored by Chingiz's avatar Chingiz 💻

Made some changes in the Card and Deck classes

parent fbd9b108
export class Card { export class Card {
private _rank: string; private _rank: string;
private _suite: string; private _suite: string;
constructor(rank: string, suit: string) { constructor(rank: string, suit: string) {
this._rank = rank; this._rank = rank;
this._suite = suit; this._suite = suit;
} }
show(){ show(){
return(` _____\n| ${this._rank} ${this._suite} |\n -----`) return(` _____\n| ${this._rank} ${this._suite} |\n -----`)
} }
......
...@@ -21,12 +21,12 @@ export class Deck { ...@@ -21,12 +21,12 @@ export class Deck {
[this._cards[i], this._cards[j]] = [this._cards[j], this._cards[i]]; [this._cards[i], this._cards[j]] = [this._cards[j], this._cards[i]];
} }
} }
takeACard(){ takeACardFromDeck(){
const ranNum: number = getRandomNumber(0, this._cards.length + 1); const ranNum: number = getRandomNumber(0, this._cards.length + 1);
if(!this.tookedCardIndexes.includes(ranNum)){ if(!this.tookedCardIndexes.includes(ranNum)){
return this._cards[ranNum]; return this._cards[ranNum];
this.tookedCardIndexes.push(ranNum); this.tookedCardIndexes.push(ranNum);
} }
this.takeACard(); this.takeACardFromDeck();
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment