Commit fbd9b108 authored by Chingiz's avatar Chingiz 💻

Hand class has been added

parent b0a99ce2
import {Card} from "./Card";
class Hand {
private limit: number = 5;
private holdingCards: Card[] = [];
receiveCard(card: Card) {
if (this.holdingCards.length <= this.limit) {
this.holdingCards.push(card)
} else {
console.log("Hand is full!")
}
}
showCards(){
for (let i = 0; i < this.holdingCards.length; i++){
console.log(`Card# ${i}) `)
this.holdingCards[i].show();
}
}
changeCard(newCard: Card, i: number){
this.holdingCards[i] = newCard;
}
}
\ 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