Skip to content
Snippets Groups Projects
Commit 4533fcd7 authored by HUONG THOMAS's avatar HUONG THOMAS
Browse files

genererMots

parent ae38d5a8
No related merge requests found
using System; using fichier1.Data;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
namespace fichier1.Model namespace fichier1.Model
{ {
class Partie public class Partie : IObservable<MainForm>
{ {
private List<string[]> correction; private List<string[]> correction;
private List<string[]> decoupage; private List<string[]> decoupage;
private int motCourant; private int motCourant;
private readonly BddContext context;
public Partie(int nbMots, float complexite) public Partie(int nbMots, float complexite, BddContext context)
{ {
this.context = context;
} }
public List<string[]> genererMots(int nb, float complexite) public void genererMots(int nb, float complexite)
{ {
return null; correction = new List<string[]>();
Random rnd = new Random();
Prefixe[] prefixe = context.Set<Prefixe>().ToArray();
Radical[] radical = context.Set<Radical>().ToArray();
Suffixe[] suffixe = context.Set<Suffixe>().ToArray();
for(int i = 0; i < nb; i++)
{
string[] mot = new string[3];
mot[0] = prefixe[rnd.Next(0, prefixe.Length)].Pre;
mot[1] = radical[rnd.Next(0, radical.Length)].Rad;
mot[2] = suffixe[rnd.Next(0, suffixe.Length)].Suf;
correction.Add(mot);
}
} }
public void formaterPropositions() public void formaterPropositions()
...@@ -54,5 +73,10 @@ namespace fichier1.Model ...@@ -54,5 +73,10 @@ namespace fichier1.Model
{ {
} }
public IDisposable Subscribe(IObserver<MainForm> observer)
{
throw new NotImplementedException();
}
} }
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment