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