-
Notifications
You must be signed in to change notification settings - Fork 1
/
BoardCell.snap
53 lines (44 loc) · 960 Bytes
/
BoardCell.snap
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
import awt.Point;
import awt.Point;
import awt.Point;
import awt.event.KeyEvent;
import awt.event.KeyListener;
import awt.Canvas;
import awt.Color;
import awt.Dimension;
import awt.Font;
import awt.Graphics;
import awt.Graphics2D;
import awt.Point;
import awt.event.WindowAdapter;
import awt.event.WindowEvent;
import awt.image.BufferStrategy;
import swing.JFrame;
import swing.JPanel;
import util.Arrays;
import util.Map;
import util.concurrent.ConcurrentHashMap;
import util.Random;
class BoardCell {
var pieceType;
new() {
pieceType = null;
}
new(type) {
pieceType = type;
}
isEmpty() {
return pieceType == null;
}
getPieceType() {
return pieceType;
}
static getCell(pieceType) {
return new BoardCell(pieceType);
}
static getEmptyArray(size) {
var cells = new BoardCell[size];
Arrays.fill(cells, new BoardCell());
return cells;
}
}