If you're allowed to, you should implement the toString()
method of the Marker
enum to return the correct value. (Return " "
if this == EMPTY
, "X"
if this == X
, and so on.) To implement methods on enumerations, put a semicolon after the last member, then implement the method just as usual:
public enum Marker
{
EMPTY, X, O;
public String toString() { /* code here */ }
};
If you can't, then for each position you can check if the Marker
is EMPTY
, and if so print a space, and otherwise print the Marker
.