.
continuous-integration/drone/push Build is passing Details

pull/70/head
victor perez ngounou 3 years ago
commit 38e296367b

@ -30,7 +30,7 @@ namespace BowlingApp
List<Equipe> equipes = new List<Equipe>();
for (int i = 0; i < nbrE; i++)
{
Afficheur.InviteNom($"Equipe {i+1}");//Recuperer le nom de l'equipe
Afficheur.InviteNom($"Equipe {i + 1}");//Recuperer le nom de l'equipe
string Nom = saissiseur.CollecteNom();
Equipe equipe = new Equipe(Nom);
for (int j = 0; j < nbrJ; j++)
@ -65,7 +65,7 @@ namespace BowlingApp
public static void JeuIndividuel(Saissiseur saissiseur)
{
// Création des parties pour chaque joueur
Manager manager = new Manager(new EquipeDbDataManager(), new PartieDbDataManager(), new JoueurDbDataManager());
@ -74,24 +74,22 @@ namespace BowlingApp
List<Joueur> joueurs = new List<Joueur>();
List<Partie> partiees = new List<Partie>();
int nbPartie = 1; // Nombre de partie pour chaque joueur
// Création des joueurs et leur partie
for (int j = 0; j < nbrj; j++)
{
Afficheur.InviteNom($"Joueur {j + 1}");
string nomJoueur = saissiseur.CollecteNom();
string nomJoueur = saissiseur.CollecteNom(); // Nom d'un joueur
Joueur joueur = new Joueur(nomJoueur);
Partie partie = new Partie(joueur);
joueurs.Add(joueur);
partiees.Add(partie);
}
// Lancement pour chaque partie avce 10 frames
for (int j = 0; j < 10; j++) //
{
for (int i = 0; i < partiees.Count; i++) // on lance les parties à tour de rôle
{
Frame frame = new Frame(j + 1);
@ -106,9 +104,6 @@ namespace BowlingApp
joueurs[i].AddPartie(partiees[i]);
manager.AddJoueur(joueurs[i]);
}
}
@ -127,13 +122,13 @@ namespace BowlingApp
joueur.AddPartie(partie);
manager.AddJoueur(joueur);
}
/// <summary>
/// Faire des lancers
/// </summary>
/// <param name="partie"></param>
/// <param name="saissiseur"></param"""
private static void LancerBoulle(Partie partie,Saissiseur saissiseur)
private static void LancerBoulle(Partie partie, Saissiseur saissiseur)
{
//Création des Frames pour la Partie
for (int i = 0; i < 10; i++)
@ -181,17 +176,18 @@ namespace BowlingApp
Afficheur.InviteQuilleTombe(2);
frame.Lancer(saissiseur.CollectQuilleTomber());
}
//Faire le troisième du dernier frame lancer si le premier est un strike ou le deuxième est un spare
//Faire le troisième lancé si et seulement si il s'agit d'un strike ou spare
if (frame.Numero == 10 && (frame.IsStrike || frame.IsSpare))
{
Afficheur.InviteQuilleTombe(3);
frame.Lancer(saissiseur.CollectQuilleTomber());
}
partie.AddFrame(frame);//ajout du frame à la partie
partie.AddFrame(frame);
Console.WriteLine(partie.GetScore());//affichage du score à la fin de chaque frame
}
#endregion
}
}
}

@ -1,154 +0,0 @@
// <auto-generated />
using System;
using BowlingEF.Context;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BowlingEF.Migrations
{
[DbContext(typeof(BowlingContext))]
[Migration("20221025144845_myMigration")]
partial class myMigration
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.10");
modelBuilder.Entity("BowlingEF.Entities.EquipeEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Nom")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Equipes");
});
modelBuilder.Entity("BowlingEF.Entities.FrameEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Lancer1")
.HasColumnType("INTEGER");
b.Property<int>("Lancer2")
.HasColumnType("INTEGER");
b.Property<int>("Lancer3")
.HasColumnType("INTEGER");
b.Property<int>("Numero")
.HasColumnType("INTEGER");
b.Property<long>("PartieId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PartieId");
b.ToTable("Frames");
});
modelBuilder.Entity("BowlingEF.Entities.JoueurEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long?>("EquipeEntityId")
.HasColumnType("INTEGER");
b.Property<string>("Pseudo")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("EquipeEntityId");
b.ToTable("Joueurs");
});
modelBuilder.Entity("BowlingEF.Entities.PartieEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("Date")
.HasColumnType("TEXT");
b.Property<long>("JoueurForeignKey")
.HasColumnType("INTEGER");
b.Property<int?>("Score")
.IsRequired()
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("JoueurForeignKey");
b.ToTable("Parties");
});
modelBuilder.Entity("BowlingEF.Entities.FrameEntity", b =>
{
b.HasOne("BowlingEF.Entities.PartieEntity", "Partie")
.WithMany("Frames")
.HasForeignKey("PartieId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Partie");
});
modelBuilder.Entity("BowlingEF.Entities.JoueurEntity", b =>
{
b.HasOne("BowlingEF.Entities.EquipeEntity", null)
.WithMany("Joueurs")
.HasForeignKey("EquipeEntityId");
});
modelBuilder.Entity("BowlingEF.Entities.PartieEntity", b =>
{
b.HasOne("BowlingEF.Entities.JoueurEntity", "Joueur")
.WithMany("PartieEntities")
.HasForeignKey("JoueurForeignKey")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Joueur");
});
modelBuilder.Entity("BowlingEF.Entities.EquipeEntity", b =>
{
b.Navigation("Joueurs");
});
modelBuilder.Entity("BowlingEF.Entities.JoueurEntity", b =>
{
b.Navigation("PartieEntities");
});
modelBuilder.Entity("BowlingEF.Entities.PartieEntity", b =>
{
b.Navigation("Frames");
});
#pragma warning restore 612, 618
}
}
}

@ -1,119 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BowlingEF.Migrations
{
public partial class myMigration : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Equipes",
columns: table => new
{
Id = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Nom = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Equipes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Joueurs",
columns: table => new
{
Id = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Pseudo = table.Column<string>(type: "TEXT", nullable: false),
EquipeEntityId = table.Column<long>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Joueurs", x => x.Id);
table.ForeignKey(
name: "FK_Joueurs_Equipes_EquipeEntityId",
column: x => x.EquipeEntityId,
principalTable: "Equipes",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Parties",
columns: table => new
{
Id = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
JoueurForeignKey = table.Column<long>(type: "INTEGER", nullable: false),
Date = table.Column<DateTime>(type: "TEXT", nullable: false),
Score = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Parties", x => x.Id);
table.ForeignKey(
name: "FK_Parties_Joueurs_JoueurForeignKey",
column: x => x.JoueurForeignKey,
principalTable: "Joueurs",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Frames",
columns: table => new
{
Id = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Numero = table.Column<int>(type: "INTEGER", nullable: false),
Lancer1 = table.Column<int>(type: "INTEGER", nullable: false),
Lancer2 = table.Column<int>(type: "INTEGER", nullable: false),
Lancer3 = table.Column<int>(type: "INTEGER", nullable: false),
PartieId = table.Column<long>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Frames", x => x.Id);
table.ForeignKey(
name: "FK_Frames_Parties_PartieId",
column: x => x.PartieId,
principalTable: "Parties",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Frames_PartieId",
table: "Frames",
column: "PartieId");
migrationBuilder.CreateIndex(
name: "IX_Joueurs_EquipeEntityId",
table: "Joueurs",
column: "EquipeEntityId");
migrationBuilder.CreateIndex(
name: "IX_Parties_JoueurForeignKey",
table: "Parties",
column: "JoueurForeignKey");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Frames");
migrationBuilder.DropTable(
name: "Parties");
migrationBuilder.DropTable(
name: "Joueurs");
migrationBuilder.DropTable(
name: "Equipes");
}
}
}

@ -1,152 +0,0 @@
// <auto-generated />
using System;
using BowlingEF.Context;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BowlingEF.Migrations
{
[DbContext(typeof(BowlingContext))]
partial class BowlingContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.10");
modelBuilder.Entity("BowlingEF.Entities.EquipeEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Nom")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Equipes");
});
modelBuilder.Entity("BowlingEF.Entities.FrameEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Lancer1")
.HasColumnType("INTEGER");
b.Property<int>("Lancer2")
.HasColumnType("INTEGER");
b.Property<int>("Lancer3")
.HasColumnType("INTEGER");
b.Property<int>("Numero")
.HasColumnType("INTEGER");
b.Property<long>("PartieId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PartieId");
b.ToTable("Frames");
});
modelBuilder.Entity("BowlingEF.Entities.JoueurEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long?>("EquipeEntityId")
.HasColumnType("INTEGER");
b.Property<string>("Pseudo")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("EquipeEntityId");
b.ToTable("Joueurs");
});
modelBuilder.Entity("BowlingEF.Entities.PartieEntity", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("Date")
.HasColumnType("TEXT");
b.Property<long>("JoueurForeignKey")
.HasColumnType("INTEGER");
b.Property<int?>("Score")
.IsRequired()
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("JoueurForeignKey");
b.ToTable("Parties");
});
modelBuilder.Entity("BowlingEF.Entities.FrameEntity", b =>
{
b.HasOne("BowlingEF.Entities.PartieEntity", "Partie")
.WithMany("Frames")
.HasForeignKey("PartieId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Partie");
});
modelBuilder.Entity("BowlingEF.Entities.JoueurEntity", b =>
{
b.HasOne("BowlingEF.Entities.EquipeEntity", null)
.WithMany("Joueurs")
.HasForeignKey("EquipeEntityId");
});
modelBuilder.Entity("BowlingEF.Entities.PartieEntity", b =>
{
b.HasOne("BowlingEF.Entities.JoueurEntity", "Joueur")
.WithMany("PartieEntities")
.HasForeignKey("JoueurForeignKey")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Joueur");
});
modelBuilder.Entity("BowlingEF.Entities.EquipeEntity", b =>
{
b.Navigation("Joueurs");
});
modelBuilder.Entity("BowlingEF.Entities.JoueurEntity", b =>
{
b.Navigation("PartieEntities");
});
modelBuilder.Entity("BowlingEF.Entities.PartieEntity", b =>
{
b.Navigation("Frames");
});
#pragma warning restore 612, 618
}
}
}

Binary file not shown.
Loading…
Cancel
Save