28 lines
517 B
Dart
28 lines
517 B
Dart
import 'dart:math';
|
|
import '../../enums/Color.dart';
|
|
|
|
/// Class to represent a stone on the board.
|
|
class Stone {
|
|
/// Color of the stone
|
|
late Color color;
|
|
|
|
Stone() {
|
|
setRandomColor();
|
|
}
|
|
|
|
/// Getter for the color.
|
|
/// \return color
|
|
Color getColor() => color;
|
|
|
|
/// Setter for the color
|
|
/// \param color
|
|
void setColor(Color color) {
|
|
this.color = color;
|
|
}
|
|
|
|
/// method that sets a random color
|
|
void setRandomColor() {
|
|
color = Color.values[Random().nextInt(Color.values.length)];
|
|
}
|
|
}
|