質問編集履歴
2
訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -86,6 +86,134 @@
|
|
86
86
|
|
87
87
|
|
88
88
|
|
89
|
+
public abstract class Player{
|
90
|
+
|
91
|
+
/** 名前 */
|
92
|
+
|
93
|
+
protected String name_;
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
/** テーブル */
|
98
|
+
|
99
|
+
protected Table table_;
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
/** 手札 */
|
104
|
+
|
105
|
+
protected Hand myHand_ = new Hand();
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
/** 進行役 */
|
110
|
+
|
111
|
+
protected Master master_;
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
/** ルール */
|
116
|
+
|
117
|
+
protected Rule rule_;
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
/**
|
122
|
+
|
123
|
+
* コンストラクタ。
|
124
|
+
|
125
|
+
*
|
126
|
+
|
127
|
+
* @param name 名前
|
128
|
+
|
129
|
+
* @param master 進行役
|
130
|
+
|
131
|
+
* @param table テーブル
|
132
|
+
|
133
|
+
* @param rule ルール
|
134
|
+
|
135
|
+
*/
|
136
|
+
|
137
|
+
public Player(String name, Master master, Table table, Rule rule){
|
138
|
+
|
139
|
+
this.name_ = name;
|
140
|
+
|
141
|
+
this.master_ = master;
|
142
|
+
|
143
|
+
this.table_ = table;
|
144
|
+
|
145
|
+
this.rule_ = rule;
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
/**
|
150
|
+
|
151
|
+
* 順番を指名する。
|
152
|
+
|
153
|
+
* 実際の処理はサブクラスで記述すること。
|
154
|
+
|
155
|
+
*
|
156
|
+
|
157
|
+
* @param nextPlayer 次のプレイヤー
|
158
|
+
|
159
|
+
*/
|
160
|
+
|
161
|
+
public abstract void play(Player nextPlayer);
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
/**
|
166
|
+
|
167
|
+
* カードを配る。
|
168
|
+
|
169
|
+
* カードを受け取った時の処理を拡張したい場合は、
|
170
|
+
|
171
|
+
* 本メソッドをサブクラスでオーバーライドすること。
|
172
|
+
|
173
|
+
* @param card 受け取ったカード
|
174
|
+
|
175
|
+
*/
|
176
|
+
|
177
|
+
public void receiveCard(Card card){ // 該当メソッド
|
178
|
+
|
179
|
+
// 受け取ったカードを手札に加える
|
180
|
+
|
181
|
+
myHand_.addCard(card);
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
public class Hand{
|
190
|
+
|
191
|
+
/** 手札にあるカードを保持するためのリスト */
|
192
|
+
|
193
|
+
private ArrayList hand_ = new ArrayList();
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
/**
|
198
|
+
|
199
|
+
* カードを加える。
|
200
|
+
|
201
|
+
*
|
202
|
+
|
203
|
+
* @param card 加えるカード
|
204
|
+
|
205
|
+
*/
|
206
|
+
|
207
|
+
public void addCard(Card card){
|
208
|
+
|
209
|
+
// カードをリストの最後に追加する
|
210
|
+
|
211
|
+
hand_.add(card); //該当箇所
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
|
89
217
|
```
|
90
218
|
|
91
219
|
|
1
訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -98,7 +98,7 @@
|
|
98
98
|
|
99
99
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
100
100
|
|
101
|
-
|
101
|
+
'''Java
|
102
102
|
|
103
103
|
public abstract class Player{
|
104
104
|
|