-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProfile.ts
34 lines (31 loc) · 815 Bytes
/
Profile.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
export default class Profile {
id: number;
name: string;
gamesPlayed: number;
gamesWon: number;
cardDistribution: Array<number>;
constructor(
id: number,
name: string,
gamesPlayed: number,
gamesWon: number,
cardDistribution: Array<number>
) {
this.id = id;
this.name = name;
this.gamesPlayed = gamesPlayed;
this.gamesWon = gamesWon;
this.cardDistribution = cardDistribution;
}
update(
wins: number,
gamesPlayed: number,
currentCardDistribution: Array<number>
) {
this.gamesWon += wins;
this.gamesPlayed += gamesPlayed;
for (let i = 0; i < 14; i++) {
this.cardDistribution[i] += currentCardDistribution[i];
}
}
}