@ -2,16 +2,19 @@ import '../lib/model/Player.dart';
import ' ../lib/model/Guest.dart ' ;
import ' ../lib/model/User.dart ' ;
import ' ../lib/model/Stat.dart ' ;
import ' ../lib/model/Round.dart ' ;
import ' ../lib/model/GameDetail.dart ' ;
import ' ../lib/model/StubManager/StubData.dart ' ;
import ' dart:math ' ;
import ' ../lib/model/Achievement.dart ' ;
import ' package:uuid/uuid.dart ' ;
void main ( ) {
List < Stat > stats = [ ] ;
Random random = new Random ( ) ;
Random random = Random ( ) ;
for ( int i = 0 ; i < 10 ; i + + ) {
Stat stat = new Stat (
Stat stat = Stat (
random . nextInt ( 50 ) + 1 , / / valeur al é atoire entre 1 et 50
random . nextInt ( 20 ) + 1 , / / valeur al é atoire entre 1 et 20
random . nextInt ( 30 ) + 1 , / / valeur al é atoire entre 1 et 30
@ -25,28 +28,33 @@ void main() {
stats . add ( stat ) ;
}
User ami = new User ( Uuid ( ) , " Lucas " , " https://fastly.picsum.photos/id/288/2000/2000.jpg?hmac=AUboE-jzAzofYj_O3w_EqtZU3JHzcg7HR1IQd1Ce7lY " , " Lucas.delanier@etu.uca.fr " , [ ] , [ ] , [ ] ) ;
print ( " Stats: " ) ;
for ( var stat in stats ) {
print ( " \t Victoires: ${ stat . nbVictory } , Défaites: ${ stat . nbDefeat } , Parties jouées: ${ stat . nbGames } , Meilleur score: ${ stat . highscore } , Nombre de strikes: ${ stat . nbStrikes } , Nom de spares: ${ stat . nbStrikes } , Moyenne score: ${ stat . avgScore } , Moyenne score par round: ${ stat . avgPinsPerRound } " ) ;
}
User ami = User ( Uuid ( ) , " Lucas " , " https://fastly.picsum.photos/id/288/2000/2000.jpg?hmac=AUboE-jzAzofYj_O3w_EqtZU3JHzcg7HR1IQd1Ce7lY " , " Lucas.delanier@etu.uca.fr " , [ ] , [ ] , stats [ 1 ] ) ;
List < Player > players = [
new Player ( Uuid ( ) , " Rami " , " https://fastly.picsum.photos/id/1060/2000/2000.jpg?hmac=_RrU8GpkCDUlVKfgyWE-GcX-GS5TKNyUzdFbJAGXHV4 " ) ,
new Player ( Uuid ( ) , " Emre " , " https://fastly.picsum.photos/id/670/2000/2000.jpg?hmac=zWqTr_vDEab3dBtp7JZgJP8TRCPNanJ4tYwDDd-jGYA " ) ,
new Guest ( Uuid ( ) , " Bot1 " , " https://fastly.picsum.photos/id/820/2000/2000.jpg?hmac=Ctxx2feJNZnG1S7UPx_YrWcEw89tKb7fR8i1W-VTOz4 " ) ,
new Guest ( Uuid ( ) , " Bot2 " , " https://fastly.picsum.photos/id/288/2000/2000.jpg?hmac=AUboE-jzAzofYj_O3w_EqtZU3JHzcg7HR1IQd1Ce7lY " ) ,
Player ( Uuid ( ) , " Rami " , " https://fastly.picsum.photos/id/1060/2000/2000.jpg?hmac=_RrU8GpkCDUlVKfgyWE-GcX-GS5TKNyUzdFbJAGXHV4 " ) ,
Player ( Uuid ( ) , " Emre " , " https://fastly.picsum.photos/id/670/2000/2000.jpg?hmac=zWqTr_vDEab3dBtp7JZgJP8TRCPNanJ4tYwDDd-jGYA " ) ,
Guest ( Uuid ( ) , " Bot1 " , " https://fastly.picsum.photos/id/820/2000/2000.jpg?hmac=Ctxx2feJNZnG1S7UPx_YrWcEw89tKb7fR8i1W-VTOz4 " ) ,
Guest ( Uuid ( ) , " Bot2 " , " https://fastly.picsum.photos/id/288/2000/2000.jpg?hmac=AUboE-jzAzofYj_O3w_EqtZU3JHzcg7HR1IQd1Ce7lY " ) ,
ami ,
new User (
User (
Uuid ( ) ,
" Louison " ,
" https://fastly.picsum.photos/id/1029/2000/2000.jpg?hmac=_K3pMobVk00dfNR7rsj1NLnEBB5Gf88SvGPbbjoH-Uc " ,
" louison.parant@etu.uca.fr " ,
[
new Achievement ( " 5 games " ) ,
new Achievement ( " 2 strikes in a row " ) ,
new Achievement ( " Win a game " )
Achievement ( " 5 games " ) ,
Achievement ( " 2 strikes in a row " ) ,
Achievement ( " Win a game " )
] ,
[
ami
] ,
stats
stats [ 0 ]
)
] ;
@ -62,22 +70,57 @@ void main() {
for ( var achievement in player . achievements ) {
print ( " \t \t Nom: ${ achievement . name } " ) ;
}
print ( " \t Stats: " ) ;
for ( var stat in player . stats ) {
print ( " \t \t Victoires: ${ stat . nbVictory } , Défaites: ${ stat . nbDefeat } , Parties jouées: ${ stat . nbGames } , Meilleur score: ${ stat . highscore } , Nombre de strikes: ${ stat . nbStrikes } , Nom de spares: ${ stat . nbStrikes } , Moyenne score: ${ stat . avgScore } , Moyenne score par round: ${ stat . avgPinsPerRound } " ) ;
}
print ( " \t Amis: " ) ;
for ( var amis in player . friends ) {
print ( " \t \t Nom: ${ amis . name } , Mail: ${ amis . mail } " ) ;
}
print ( " \t Victoires: ${ player . stat . nbVictory } , Défaites: ${ player . stat . nbDefeat } , Parties jouées: ${ player . stat . nbGames } , Meilleur score: ${ player . stat . highscore } , Nombre de strikes: ${ player . stat . nbStrikes } , Nom de spares: ${ player . stat . nbStrikes } , Moyenne score: ${ player . stat . avgScore } , Moyenne score par round: ${ player . stat . avgPinsPerRound } " ) ;
} else {
print ( " \t ID: ${ player . id } , Nom: ${ player . name } , Image: ${ player . image } , Type: Player " ) ;
}
}
/ / GameDetail
List < GameDetail > games = [
GameDetail ( Uuid ( ) , DateTime . now ( ) , players [ 0 ] . id , 290 , true , null , players [ 0 ] , [ Round ( 10 , null , 10 , players [ 0 ] ) , Round ( 5 , 2 , 7 , players [ 1 ] ) , Round ( 5 , 2 , 7 , players [ 1 ] ) , Round ( 5 , 1 , 12 , players [ 0 ] ) ] , [ players [ 0 ] , players [ 1 ] ] ) ,
GameDetail ( Uuid ( ) , DateTime . now ( ) . subtract ( Duration ( days: 2 ) ) , players [ 1 ] . id , 250 , true , null , players [ 1 ] , [ Round ( 7 , null , 7 , players [ 1 ] ) , Round ( 3 , 3 , 9 , players [ 0 ] ) , Round ( 5 , 2 , 7 , players [ 1 ] ) , Round ( 5 , 1 , 12 , players [ 0 ] ) ] , [ players [ 0 ] , players [ 1 ] ] ) ,
GameDetail ( Uuid ( ) , DateTime . now ( ) . subtract ( Duration ( days: 4 ) ) , players [ 2 ] . id , 210 , false , null , players [ 2 ] , [ Round ( 8 , 2 , 10 , players [ 2 ] ) , Round ( 6 , 2 , 8 , players [ 1 ] ) , Round ( 4 , 2 , 6 , players [ 2 ] ) , Round ( 2 , 2 , 4 , players [ 1 ] ) ] , [ players [ 1 ] , players [ 2 ] ] ) ,
GameDetail ( Uuid ( ) , DateTime . now ( ) . subtract ( Duration ( days: 7 ) ) , players [ 3 ] . id , 120 , true , Round ( 12 , null , 12 , players [ 3 ] ) , players [ 3 ] , [ Round ( 12 , null , 12 , players [ 3 ] ) , Round ( 7 , 3 , 10 , players [ 2 ] ) , Round ( 6 , 2 , 8 , players [ 1 ] ) , Round ( 5 , 1 , 12 , players [ 0 ] ) ] , [ players [ 0 ] , players [ 1 ] , players [ 2 ] , players [ 3 ] ] ) ,
GameDetail ( Uuid ( ) , DateTime . now ( ) . subtract ( Duration ( days: 10 ) ) , players [ 4 ] . id , 280 , true , null , players [ 4 ] , [ Round ( 9 , 1 , 10 , players [ 4 ] ) , Round ( 7 , 3 , 10 , players [ 2 ] ) , Round ( 8 , 2 , 10 , players [ 3 ] ) , Round ( 5 , 2 , 7 , players [ 1 ] ) ] , [ players [ 1 ] , players [ 2 ] , players [ 3 ] , players [ 4 ] ] ) ,
GameDetail ( Uuid ( ) , DateTime . now ( ) . subtract ( Duration ( days: 12 ) ) , players [ 1 ] . id , 240 , true , null , players [ 1 ] , [ Round ( 7 , null , 7 , players [ 1 ] ) , Round ( 5 , 2 , 7 , players [ 2 ] ) , Round ( 6 , 2 , 8 , players [ 1 ] ) , Round ( 5 , 1 , 12 , players [ 0 ] ) ] , [ players [ 0 ] , players [ 1 ] , players [ 2 ] , players [ 4 ] ] ) ,
GameDetail ( Uuid ( ) , DateTime . now ( ) . subtract ( Duration ( days: 15 ) ) , players [ 2 ] . id , 200 , true , null , players [ 2 ] , [ Round ( 8 , 2 , 10 , players [ 2 ] ) , Round ( 4 , 2 , 6 , players [ 1 ] ) , Round ( 7 , 3 , 10 , players [ 3 ] ) , Round ( 5 , 2 , 7 , players [ 0 ] ) ] , [ players [ 0 ] , players [ 1 ] , players [ 2 ] , players [ 3 ] ] )
] ;
print ( " GameDetail : " ) ;
for ( var game in games ) {
print ( " \t Game ID: ${ game . id } " ) ;
print ( " \t Time: ${ game . time } " ) ;
print ( " \t Winner: ${ game . winner } " ) ;
print ( " \t Number of Points: ${ game . nbPoints } " ) ;
print ( " \t Is Finished: ${ game . isFinished } " ) ;
print ( " \t Current Round: ${ game . currentRound } " ) ;
print ( " \t Host: ${ game . host } " ) ;
print ( " \t Rounds: " ) ;
for ( var round in game . rounds ) {
print ( " \t \t Round Score: ${ round . firstThrow } " ) ;
print ( " \t \t Round Bonus: ${ round . secondThrow } " ) ;
print ( " \t \t Round Total: ${ round . points } " ) ;
print ( " \t \t Round Player: ${ round . player . name } " ) ;
}
print ( " \t Players: " ) ;
for ( var player in game . players ) {
print ( " \t \t Player ID: ${ player . id } " ) ;
print ( " \t \t Player Name: ${ player . name } " ) ;
}
print ( " \t ----------------------------------------- " ) ;
print ( " StubManager: " ) ;
}
}