-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNimPlayer.java
More file actions
112 lines (82 loc) · 2.42 KB
/
Copy pathNimPlayer.java
File metadata and controls
112 lines (82 loc) · 2.42 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import java.io.Serializable;
/************************************************************
* Name:Yizhou ZHU
* login name:yizzhu@nutmeg.eng.unimelb.edu.au
* student number:1034676
*
* description: this is the main class to run the Nimsys and store the array of NimPlayer
*
* last updated:06/05/2019
*
*
*
************************************************************/
public abstract class NimPlayer implements Serializable {
private String username;
private String firstname;
private String lastname;
private int GamesPlayed;
private int GamesWon;
public NimPlayer() {
this.firstname ="no name";
this.lastname = "no name";
this.username = " ";
this.GamesPlayed = 0;
this.GamesWon = 0;
}
public NimPlayer (String username, String firstname, String lastname) {
setPlayer(username, firstname, lastname);
}
public void setPlayer(String username, String firstname, String lastname) {
this.firstname = firstname;
this.lastname = lastname;
this.username = username;
this.GamesPlayed = 0;
this.GamesWon = 0;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getUsername() {
return this.username;
}
public String getFirstname() {
return this.firstname;
}
public String getLastname() {
return this.lastname;
}
public int getGamesPlayed() {
return this.GamesPlayed;
}
public int getGamesWon() {
return this.GamesWon;
}
public NimPlayer getPlayer(NimPlayer theNimPlayer) {
return theNimPlayer;
}
public boolean UserNameequals(String otherusername) {
return this.getUsername().equals(otherusername);
}
public void winGame() {
this.GamesPlayed = this.GamesPlayed + 1;
this.GamesWon = this.GamesWon + 1;
}
public void loseGame() {
this.GamesPlayed = this.GamesPlayed +1;
}
public abstract int removeStone(int i,int maxremovestone,int stoneleft);
public String advancedMove(boolean[] available, String lastMove) {
return (" ");
}
public void copyNimPlayer(NimPlayer otherPlayer) {
this.firstname = otherPlayer.getFirstname();
this.lastname = otherPlayer.getLastname();
this.username = otherPlayer.getUsername();
this.GamesWon = otherPlayer.getGamesWon();
this.GamesPlayed = otherPlayer.getGamesPlayed();
}
}