Starting implementation of the bowling game algorithm
continuous-integration/drone/push Build is failing Details

Arthur_BowlingAlgo
Arthur VALIN 2 years ago
parent 09adc10a76
commit 25d036cc63

@ -66,8 +66,8 @@ abstract class AbstractRound {
previousRound?.update(val);
}
void unsubscribe(){
previousRound?.unsubscribe();
void unsubscribePreviousRound(){
previousRound?.unsubscribePreviousRound();
previousRound=null;
}

@ -1,3 +1,5 @@
import 'package:bowl_in/model/AbstractRound.dart';
import 'Player.dart';
import 'Round.dart';
@ -7,9 +9,8 @@ class GameDetail {
int _winner;
int _nbPoints;
bool _isFinished;
Round? _currentRound;
int _host;
List<Round> _rounds = [];
List<AbstractRound> _rounds = [];
List<Player> _players = [];
// Constructor
@ -19,7 +20,6 @@ class GameDetail {
this._winner,
this._nbPoints,
this._isFinished,
this._currentRound,
this._host,
this._rounds,
this._players);
@ -55,21 +55,15 @@ class GameDetail {
_isFinished = value;
}
Round? get currentRound => _currentRound;
set currentRound(Round? value) {
_currentRound = value;
}
int get host => _host;
set host(int value) {
_host = value;
}
List<Round> get rounds => _rounds;
List<AbstractRound> get rounds => _rounds;
set rounds(List<Round> value) {
set rounds(List<AbstractRound> value) {
_rounds = value;
}

@ -41,7 +41,7 @@ class LastRound extends AbstractRound{
if(previousRound?.isStrike()??false){
update(points??0);
}
unsubscribe();
unsubscribePreviousRound();
}

@ -13,7 +13,7 @@ class Round extends AbstractRound{
firstThrow=val;
if(previousRound?.isSpare() ?? false){
previousRound?.update(val);
unsubscribe();
unsubscribePreviousRound();
}
return false; //Le round n'est pas fini
}else if(firstThrow==10){
@ -35,7 +35,7 @@ class Round extends AbstractRound{
if(isSpareOrStrike()){
gamePlayer.onSpareOrStrike();
}
unsubscribe();
unsubscribePreviousRound();
}

@ -128,13 +128,11 @@ class StubData extends IManager {
List<GameDetail> _gameDetails = [];
void _initGameDetails() {
gameDetails.add(GameDetail(1, DateTime.now(), players[7].id, 123, true,
null, players[7].id, rounds, [players[0], players[1]]));
gameDetails.add(GameDetail(2, DateTime.now(), players[0].id, 113, true,
null, players[7].id, rounds, [players[0], players[1], players[7]]));
gameDetails.add(GameDetail(3, DateTime.now(), players[7].id, 93, true, null,
gameDetails.add(GameDetail(1, DateTime.now(), players[7].id, 123, true, players[7].id, rounds, [players[0], players[1]]));
gameDetails.add(GameDetail(2, DateTime.now(), players[0].id, 113, true, players[7].id, rounds, [players[0], players[1], players[7]]));
gameDetails.add(GameDetail(3, DateTime.now(), players[7].id, 93, true,
players[7].id, [], [players[0], players[7]]));
gameDetails.add(GameDetail(4, DateTime.now(), players[7].id, 93, true, null,
gameDetails.add(GameDetail(4, DateTime.now(), players[7].id, 93, true,
players[7].id, [], [players[1], players[7]]));
}

Loading…
Cancel
Save