Merge remote-tracking branch 'origin/bug001' into Test_Partie001

pull/27/head
victor perez ngounou 3 years ago
commit 375f5db65a

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -10,6 +11,11 @@ namespace BowlingLib.Model
public class Equipe
{
private string nom;
public ReadOnlyCollection<Joueur> Joueurs
{
get;
private set;
}
private List<Joueur> joueurs;
public string Nom
@ -17,17 +23,12 @@ namespace BowlingLib.Model
get { return nom; }
set { nom = value; }
}
public List<Joueur> Joueurs
{
get { return joueurs; }
set { joueurs = value; }
}
private int numero;
public Equipe(string nom)
{
this.nom = nom;
joueurs = new List<Joueur>();
Joueurs = new ReadOnlyCollection<Joueur>(joueurs);
}
public void AjouterJoueur(Joueur joueur)

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -8,29 +9,111 @@ namespace BowlingLib.Model
{
public class Frame
{
public int Numero { get; set; }
const int MAX_QUILLE = 10;
public int Numero {
get
{ return numero; }
set
{
this.numero = value;
}
}
private int numero;
public int QuillesRestantes { get; set; }
public int QuillesTombees { get; set; }
public int QuillesRestantes
{ get
{
return quillesRestantes;
}
set
{
this.quillesRestantes = value;
}
}
private int quillesRestantes;
public bool IsStrike { get; set; }
public int QuillesTombees
{
get
{
return QuillesTombees;
}
set
{
this.QuillesTombees = value;
}
}
private int quillesTombees;
public bool IsStrike {
get {
return isStrike;
}
set{
this.isStrike = value;
}
}
private bool isStrike;
public bool IsSpare { get; set; }
public bool IsSpare
{
get
{
return isPark;
}
set
{
this.isPark = value;
}
}
private bool isPark;
public bool IsFinished { get; set; }
public bool IsFinished
{
get
{
return isFinished;
}
set
{
this.isFinished = value;
}
public Lancer Lancer1 { get; set; }
}
private bool isFinished;
public Lancer Lancer2 { get; set; }
public Lancer Lancer1
{
get
{
return lancer1;
}
set
{
this.lancer1 = value;
}
}
private Lancer lancer1;
public Lancer Lancer3 { get; set; }
public Lancer Lancer2
{
get { return lancer2; }
set { this.lancer2 = value; }
}
private Lancer lancer2;
public Lancer Lancer3
{
get { return lancer3; }
set { this.lancer3 = value; }
}
private Lancer lancer3;
public Frame(int numero)
{
this.Numero = numero;
this.QuillesRestantes = 10;
this.QuillesRestantes = MAX_QUILLE;
this.IsFinished = false;
this.IsStrike = false;
this.IsSpare = false;
@ -59,7 +142,7 @@ namespace BowlingLib.Model
this.Lancer1 = new Lancer(quillesTombees);
this.QuillesRestantes -= quillesTombees;
this.QuillesTombees += quillesTombees;
if (quillesTombees == 10)
if (quillesTombees == MAX_QUILLE)
{
this.IsStrike = true;
}
@ -71,7 +154,7 @@ namespace BowlingLib.Model
this.QuillesTombees += quillesTombees;
if (this.IsStrike)
{
if (quillesTombees == 10)
if (quillesTombees == MAX_QUILLE)
{
this.IsStrike = true;
}
@ -82,7 +165,7 @@ namespace BowlingLib.Model
}
else
{
if (quillesTombees + this.Lancer1.QuillesTombees == 10)
if (quillesTombees + this.Lancer1.QuillesTombees == MAX_QUILLE)
{
this.IsSpare = true;
QuillesRestantes = 10;
@ -96,7 +179,7 @@ namespace BowlingLib.Model
this.QuillesTombees += quillesTombees;
if (this.IsStrike)
{
if (quillesTombees == 10)
if (quillesTombees == MAX_QUILLE)
{
this.IsStrike = true;
}
@ -107,7 +190,7 @@ namespace BowlingLib.Model
}
else if (this.IsSpare)
{
if (quillesTombees + this.Lancer2.QuillesTombees == 10)
if (quillesTombees + this.Lancer2.QuillesTombees == MAX_QUILLE)
{
this.IsSpare = true;
}
@ -118,7 +201,7 @@ namespace BowlingLib.Model
}
else
{
if (quillesTombees + this.Lancer2.QuillesTombees == 10)
if (quillesTombees + this.Lancer2.QuillesTombees == MAX_QUILLE)
{
this.IsSpare = true;
}
@ -145,7 +228,7 @@ namespace BowlingLib.Model
}
this.QuillesRestantes -= quillesTombees;
this.QuillesTombees += quillesTombees;
if (quillesTombees == 10)
if (quillesTombees == MAX_QUILLE)
{
this.IsStrike = true;
}

@ -25,6 +25,7 @@ namespace BowlingLib.Model
get { return pseudo; }
private set { pseudo = value; }
}
}
}

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -10,10 +11,10 @@ namespace BowlingLib.Model
{
private int quillesTombees;
public int QuillesTombees
public int QuillesTombees
{
get { return quillesTombees; }
set
private set
{
if (value < 0 || value > 10)
{

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -8,10 +9,10 @@ namespace BowlingLib.Model
{
public class Partie
{
public ReadOnlyCollection<Frame> Frames;
public Joueur Joueur { get; private set; }
public Joueur Joueur { get; set; }
public List<Frame> Frames { get; set; }
private List<Frame> frames;
/// <summary>
/// Constructeur
@ -20,7 +21,7 @@ namespace BowlingLib.Model
public Partie(Joueur joueur)
{
this.Joueur = joueur;
Frames = new List<Frame>();
Frames = new ReadOnlyCollection<Frame>(frames);
}
/// <summary>
@ -29,7 +30,7 @@ namespace BowlingLib.Model
/// <param name="frame"></param>
public void AddFrame(Frame frame)
{
Frames.Add(frame);
frames.Add(frame);
}

Loading…
Cancel
Save