This repository has been archived by the owner on Aug 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SplendorInstance.cgs
75 lines (57 loc) · 1.69 KB
/
SplendorInstance.cgs
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* SplendorPosition.cgs
*
* Created by crism on Oct 23, 2019
*/
// Class that saves a position and returns a game when called
class SplendorInstance
var cPJ;
var oPJ;
var js;
var cPPts;
var oPPts;
var tP;
var cPProp;
var oPProp;
var player;
// Class constructor
method SplendorInstance(cPJ, oPJ, js, cPPts, oPPts, tP, cPProp, oPProp, player)
end
// Gets a position in SplendorCombinatorial with those values
property getPosition.get
// Returns position with updated values depending on what player's turn it is
if player == Player.Left then return SplendorCombinatorial(cPJ, oPJ, js, cPPts, oPPts, tP, cPProp, oPProp);
elseif player == Player.Right then return SplendorCombinatorial(oPJ, cPJ, js, oPPts, cPPts, tP, oPProp, cPProp);
end
end
property getCurrentPlayerJewels.get
return cPJ;
end
property getOppositePlayerJewels.get
return oPJ;
end
property getTotalJewels.get
return js;
end
property getCurrentPlayer.get
return player;
end
property getCurrentPlayerProperties.get
return cPProp;
end
property getTotalProperties.get
return tP;
end
property getCurrentPlayerPoints.get
return cPPts;
end
property getOppositePlayerPoints.get
return oPPts;
end
method update(newCPJ ? this.cPJ, newOPJ ? this.oPJ, newJS ? this.js, newCPPts ? this.cPPts, newOPPts ? this.oPPts, newTP ? this.tP, newCPProp ? this.cPProp, newOPProp ? this.oPProp, newPlayer ? this.player);
return SplendorInstance(newCPJ, newOPJ, newJS, newCPPts, newOPPts, newTP, newCPProp, newOPProp, newPlayer);
end
method updateCurrentPlayerJewels(newCPJ)
return SplendorInstance(newCPJ, this.oPJ, this.js, this.cPPts, this.oPPts, this.tP, this.cPProp, this.oPProp, this.player);
end
end