diff --git a/TheGameExtreme.Android/TheGameExtreme.Android.csproj b/TheGameExtreme.Android/TheGameExtreme.Android.csproj
index 35b7f08..9d57912 100644
--- a/TheGameExtreme.Android/TheGameExtreme.Android.csproj
+++ b/TheGameExtreme.Android/TheGameExtreme.Android.csproj
@@ -60,15 +60,15 @@
-
- 1.68.1
-
1.1.0
6.4.1
+
+ 1.68.1
+
diff --git a/TheGameExtreme.iOS/OrderStacks.csproj b/TheGameExtreme.iOS/OrderStacks.csproj
index 4f6c4c4..372aeab 100644
--- a/TheGameExtreme.iOS/OrderStacks.csproj
+++ b/TheGameExtreme.iOS/OrderStacks.csproj
@@ -157,12 +157,12 @@
-
- 1.68.1
-
1.1.0
+
+ 1.68.1
+
diff --git a/TheGameExtreme/TheGameExtreme.csproj b/TheGameExtreme/TheGameExtreme.csproj
index 3b187fc..2f76724 100644
--- a/TheGameExtreme/TheGameExtreme.csproj
+++ b/TheGameExtreme/TheGameExtreme.csproj
@@ -11,8 +11,8 @@
-
+
diff --git a/TheGameExtreme/model/Fraction.cs b/TheGameExtreme/model/Fraction.cs
index 9bb2a10..238944b 100644
--- a/TheGameExtreme/model/Fraction.cs
+++ b/TheGameExtreme/model/Fraction.cs
@@ -17,7 +17,17 @@ namespace TheGameExtreme.model
public bool isMultiple(Fraction fraction)
{
- if (fraction.Numerateur == 1)
+ bool numIsZero = false;
+ bool denIsZero = false;
+ if (fraction.Numerateur == 0)
+ {
+ numIsZero = true;
+ }
+ if (fraction.Denominateur == 0)
+ {
+ denIsZero = true;
+ }
+ if (fraction.Numerateur == 1 && denIsZero)
{
if (fraction.Denominateur != 1
&& fraction.Denominateur != Denominateur
@@ -26,7 +36,7 @@ namespace TheGameExtreme.model
return true;
}
}
- else if (fraction.Denominateur == 1)
+ else if (fraction.Denominateur == 1 && !numIsZero)
{
if (fraction.Numerateur != 1
&& fraction.Numerateur != Numerateur
@@ -35,7 +45,7 @@ namespace TheGameExtreme.model
return true;
}
}
- else if (fraction.Numerateur == Numerateur)
+ else if (fraction.Numerateur == Numerateur && !denIsZero)
{
if (fraction.Denominateur != Denominateur
&& Denominateur % fraction.Denominateur == 0)
@@ -43,7 +53,7 @@ namespace TheGameExtreme.model
return true;
}
}
- else if (fraction.Denominateur == Denominateur)
+ else if (fraction.Denominateur == Denominateur && !numIsZero)
{
if (fraction.Numerateur != Numerateur
&& Numerateur % fraction.Numerateur == 0)
@@ -53,13 +63,19 @@ namespace TheGameExtreme.model
}
else
{
- if (Numerateur % fraction.Numerateur == 0)
+ if (!numIsZero)
{
- return true;
+ if (Numerateur % fraction.Numerateur == 0)
+ {
+ return true;
+ }
}
- if (Denominateur % fraction.Denominateur == 0)
+ if (denIsZero)
{
- return true;
+ if (Denominateur % fraction.Denominateur == 0)
+ {
+ return true;
+ }
}
}
return false;
diff --git a/TheGameExtreme/model/gameActions/classic/GameModeClassic.cs b/TheGameExtreme/model/gameActions/classic/GameModeClassic.cs
index c020abe..53abaa4 100644
--- a/TheGameExtreme/model/gameActions/classic/GameModeClassic.cs
+++ b/TheGameExtreme/model/gameActions/classic/GameModeClassic.cs
@@ -40,7 +40,6 @@ namespace TheGameExtreme.model.gameActions.classic
}
else
{
- TestEndGame(currentHand);
if (!end)
{
Message = ((JouerUneCarteClassic)gameActions[1]).ErrorMessage;
diff --git a/TheGameExtreme/model/gameActions/classic/TerminerSonTourClassic.cs b/TheGameExtreme/model/gameActions/classic/TerminerSonTourClassic.cs
index c474bb4..7e537c7 100644
--- a/TheGameExtreme/model/gameActions/classic/TerminerSonTourClassic.cs
+++ b/TheGameExtreme/model/gameActions/classic/TerminerSonTourClassic.cs
@@ -18,7 +18,6 @@ namespace TheGameExtreme.model.gameActions.classic
{
if (CurrentHand.Count == 0 || CurrentCardPlayed.Count >= 2)
{
- // Vérifier la fin du jeu
return true;
}
else
@@ -31,7 +30,80 @@ namespace TheGameExtreme.model.gameActions.classic
override protected void tryToFindSoluce(List playableCard, List CurrentHand)
{
- CurrentHand.ForEach(card =>
+ int findDownCard = 0;
+ int findUpCard = 0;
+ List hand = new List();
+ List playableDownCard = new List();
+ List playableUpCard = new List();
+
+ CurrentHand.ForEach(card => hand.Add(card));
+
+
+ hand.ForEach(card =>
+ {
+ for (int i = 0; i < ListOrderedStacks.Size; i++)
+ {
+ if (card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 10) == 0)
+ {
+ playableDownCard.Add(card);
+ }
+ else if (card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 10) == 0)
+ {
+ playableUpCard.Add(card);
+ }
+ }
+ });
+
+ playableDownCard.ForEach(card =>
+ {
+ hand.Remove(card);
+ });
+
+ playableUpCard.ForEach(card =>
+ {
+ hand.Remove(card);
+ });
+
+
+ while ((playableDownCard.Count > findDownCard || playableUpCard.Count > findUpCard) && hand.Count > 0)
+ {
+ findDownCard = playableDownCard.Count;
+ findUpCard = playableUpCard.Count;
+
+ hand.ForEach(card =>
+ {
+ for (int i = 0; i < playableDownCard.Count; i++)
+ {
+ if (card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 10) == 0)
+ {
+ playableDownCard.Add(card);
+ }
+ }
+ for (int i = 0; i < playableUpCard.Count; i++)
+ {
+ if (card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 10) == 0)
+ {
+ playableUpCard.Add(card);
+ }
+ }
+ });
+
+ for (int i = findDownCard; i < playableDownCard.Count; i++)
+ {
+ hand.Remove(playableDownCard[i]);
+ }
+
+ for (int i = findUpCard; i < playableUpCard.Count; i++)
+ {
+ hand.Remove(playableUpCard[i]);
+ }
+ }
+
+ playableDownCard.ForEach(card => playableCard.Add(card));
+ playableUpCard.ForEach(card => playableCard.Add(card));
+
+ bool played = false;
+ hand.ForEach(card =>
{
for (int i = 0; i < ListOrderedStacks.Size; i++)
{
@@ -40,17 +112,44 @@ namespace TheGameExtreme.model.gameActions.classic
if (card.Value > ListOrderedStacks.getStack(i).Peek().Value)
{
playableCard.Add(card);
+ played = true;
+ break;
}
}
else if (card.Value < ListOrderedStacks.getStack(i).Peek().Value)
{
playableCard.Add(card);
+ played = true;
+ break;
}
- else if (card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 10) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 10) == 0)
+ }
+
+ if (!played)
+ {
+ for (int i = 0; i < playableDownCard.Count; i++)
{
- playableCard.Add(card);
+ if (card.Value > playableDownCard[i].Value)
+ {
+ playableCard.Add(card);
+ played = true;
+ break;
+ }
+ }
+ }
+
+ if (!played)
+ {
+ for (int i = 0; i < playableUpCard.Count; i++)
+ {
+ if (card.Value < playableUpCard[i].Value)
+ {
+ playableCard.Add(card);
+ played = true;
+ break;
+ }
}
}
+ played = false;
});
}
diff --git a/TheGameExtreme/model/gameActions/decimals/GameModeDecimal.cs b/TheGameExtreme/model/gameActions/decimals/GameModeDecimal.cs
index e15b2e1..10bf318 100644
--- a/TheGameExtreme/model/gameActions/decimals/GameModeDecimal.cs
+++ b/TheGameExtreme/model/gameActions/decimals/GameModeDecimal.cs
@@ -40,7 +40,6 @@ namespace TheGameExtreme.model.gameActions.decimals
}
else
{
- TestEndGame(currentHand);
if (!end)
{
Message = ((JouerUneCarteDecimal)gameActions[1]).ErrorMessage;
diff --git a/TheGameExtreme/model/gameActions/decimals/TerminerSonTourDecimal.cs b/TheGameExtreme/model/gameActions/decimals/TerminerSonTourDecimal.cs
index 7322e75..78ad7c4 100644
--- a/TheGameExtreme/model/gameActions/decimals/TerminerSonTourDecimal.cs
+++ b/TheGameExtreme/model/gameActions/decimals/TerminerSonTourDecimal.cs
@@ -30,7 +30,80 @@ namespace TheGameExtreme.model.gameActions.decimals
override protected void tryToFindSoluce(List playableCard, List CurrentHand)
{
- CurrentHand.ForEach(card =>
+ int findDownCard = 0;
+ int findUpCard = 0;
+ List hand = new List();
+ List playableDownCard = new List();
+ List playableUpCard = new List();
+
+ CurrentHand.ForEach(card => hand.Add(card));
+
+
+ hand.ForEach(card =>
+ {
+ for (int i = 0; i < ListOrderedStacks.Size; i++)
+ {
+ if (card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 1m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 0.1m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 0.01m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 0.001m) == 0)
+ {
+ playableDownCard.Add(card);
+ }
+ else if (card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 1m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 0.1m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 0.01m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 0.001m) == 0)
+ {
+ playableUpCard.Add(card);
+ }
+ }
+ });
+
+ playableDownCard.ForEach(card =>
+ {
+ hand.Remove(card);
+ });
+
+ playableUpCard.ForEach(card =>
+ {
+ hand.Remove(card);
+ });
+
+
+ while ((playableDownCard.Count > findDownCard || playableUpCard.Count > findUpCard) && hand.Count > 0)
+ {
+ findDownCard = playableDownCard.Count;
+ findUpCard = playableUpCard.Count;
+
+ hand.ForEach(card =>
+ {
+ for (int i = 0; i < playableDownCard.Count; i++)
+ {
+ if (card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 1m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 0.1m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 0.01m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 0.001m) == 0)
+ {
+ playableDownCard.Add(card);
+ }
+ }
+ for (int i = 0; i < playableUpCard.Count; i++)
+ {
+ if (card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 1m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 0.1m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 0.01m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 0.001m) == 0)
+ {
+ playableUpCard.Add(card);
+ }
+ }
+ });
+
+ for (int i = findDownCard; i < playableDownCard.Count; i++)
+ {
+ hand.Remove(playableDownCard[i]);
+ }
+
+ for (int i = findUpCard; i < playableUpCard.Count; i++)
+ {
+ hand.Remove(playableUpCard[i]);
+ }
+ }
+
+ playableDownCard.ForEach(card => playableCard.Add(card));
+ playableUpCard.ForEach(card => playableCard.Add(card));
+
+ bool played = false;
+ hand.ForEach(card =>
{
for (int i = 0; i < ListOrderedStacks.Size; i++)
{
@@ -39,17 +112,44 @@ namespace TheGameExtreme.model.gameActions.decimals
if (card.Value > ListOrderedStacks.getStack(i).Peek().Value)
{
playableCard.Add(card);
+ played = true;
+ break;
}
}
else if (card.Value < ListOrderedStacks.getStack(i).Peek().Value)
{
playableCard.Add(card);
+ played = true;
+ break;
}
- else if (card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 0.1m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 0.1m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 0.01m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 0.01m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value - 0.001m) == 0 || card.Value.CompareTo(ListOrderedStacks.getStack(i).Peek().Value + 0.001m) == 0)
+ }
+
+ if (!played)
+ {
+ for (int i = 0; i < playableDownCard.Count; i++)
{
- playableCard.Add(card);
+ if (card.Value > playableDownCard[i].Value)
+ {
+ playableCard.Add(card);
+ played = true;
+ break;
+ }
+ }
+ }
+
+ if (!played)
+ {
+ for (int i = 0; i < playableUpCard.Count; i++)
+ {
+ if (card.Value < playableUpCard[i].Value)
+ {
+ playableCard.Add(card);
+ played = true;
+ break;
+ }
}
}
+ played = false;
});
}
diff --git a/TheGameExtreme/model/gameActions/fraction/GameModeFraction.cs b/TheGameExtreme/model/gameActions/fraction/GameModeFraction.cs
index ad4ee86..7f2295c 100644
--- a/TheGameExtreme/model/gameActions/fraction/GameModeFraction.cs
+++ b/TheGameExtreme/model/gameActions/fraction/GameModeFraction.cs
@@ -40,7 +40,6 @@ namespace TheGameExtreme.model.gameActions.fraction
}
else
{
- TestEndGame(currentHand);
if (!end)
{
Message = ((JouerUneCarteFraction)gameActions[1]).ErrorMessage;
diff --git a/TheGameExtreme/model/gameActions/fraction/TerminerSonTourFraction.cs b/TheGameExtreme/model/gameActions/fraction/TerminerSonTourFraction.cs
index d75dd26..068a503 100644
--- a/TheGameExtreme/model/gameActions/fraction/TerminerSonTourFraction.cs
+++ b/TheGameExtreme/model/gameActions/fraction/TerminerSonTourFraction.cs
@@ -39,7 +39,55 @@ namespace TheGameExtreme.model.gameActions.fraction
protected override void tryToFindSoluce(List playableCard, List CurrentHand)
{
- CurrentHand.ForEach(card =>
+ int findMultipleCard = 0;
+ List hand = new List();
+ List playableMultipleCard = new List();
+
+ CurrentHand.ForEach(card => hand.Add(card));
+
+
+ hand.ForEach(card =>
+ {
+ for (int i = 0; i < ListOrderedStacks.Size; i++)
+ {
+ if (((FractionCard)card).Fraction.isMultiple(((FractionCard)ListOrderedStacks.getStack(i).Peek()).Fraction))
+ {
+ playableMultipleCard.Add(card);
+ }
+ }
+ });
+
+ playableMultipleCard.ForEach(card =>
+ {
+ hand.Remove(card);
+ });
+
+
+ while (playableMultipleCard.Count > findMultipleCard && hand.Count > 0)
+ {
+ findMultipleCard = playableMultipleCard.Count;
+
+ hand.ForEach(card =>
+ {
+ for (int i = 0; i < playableMultipleCard.Count; i++)
+ {
+ if (((FractionCard)card).Fraction.isMultiple(((FractionCard)ListOrderedStacks.getStack(i).Peek()).Fraction))
+ {
+ playableMultipleCard.Add(card);
+ }
+ }
+ });
+
+ for (int i = findMultipleCard; i < playableMultipleCard.Count; i++)
+ {
+ hand.Remove(playableMultipleCard[i]);
+ }
+ }
+
+ playableMultipleCard.ForEach(card => playableCard.Add(card));
+
+ bool played = false;
+ hand.ForEach(card =>
{
for (int i = 0; i < ListOrderedStacks.Size; i++)
{
@@ -48,17 +96,32 @@ namespace TheGameExtreme.model.gameActions.fraction
if (card.Value > ListOrderedStacks.getStack(i).Peek().Value)
{
playableCard.Add(card);
+ played = true;
+ break;
}
}
else if (card.Value < ListOrderedStacks.getStack(i).Peek().Value)
{
playableCard.Add(card);
+ played = true;
+ break;
}
- else if (((FractionCard)card).Fraction.isMultiple(((FractionCard)ListOrderedStacks.getStack(i).Peek()).Fraction))
+ }
+
+ if (!played)
+ {
+ for (int i = 0; i < playableMultipleCard.Count; i++)
{
- playableCard.Add(card);
+ if (card.Value > playableMultipleCard[i].Value)
+ {
+ playableCard.Add(card);
+ played = true;
+ break;
+ }
}
}
+
+ played = false;
});
}
}
diff --git a/TheGameExtreme/model/manager/GameManager.cs b/TheGameExtreme/model/manager/GameManager.cs
index 03b6d3f..5c4abe1 100644
--- a/TheGameExtreme/model/manager/GameManager.cs
+++ b/TheGameExtreme/model/manager/GameManager.cs
@@ -109,7 +109,6 @@ namespace TheGameExtreme.model.manager
}
else
{
- parametreur.GameMode.TestEndGame(currentHand);
EndMessage = parametreur.GameMode.Message;
if (win)
{
diff --git a/TheGameExtreme/view/MainPage.xaml b/TheGameExtreme/view/MainPage.xaml
index 1e95ad1..6bdff1d 100644
--- a/TheGameExtreme/view/MainPage.xaml
+++ b/TheGameExtreme/view/MainPage.xaml
@@ -15,28 +15,16 @@
x:Name="Display"
Margin="10,10,10,10">
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
diff --git a/TheGameExtreme/view/MainPage.xaml.cs b/TheGameExtreme/view/MainPage.xaml.cs
index cd75803..65fe552 100644
--- a/TheGameExtreme/view/MainPage.xaml.cs
+++ b/TheGameExtreme/view/MainPage.xaml.cs
@@ -231,7 +231,7 @@ namespace TheGameExtreme.view
float inflateWidth = 0.024f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20);
- SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width * 0.92f - 20 - inflateWidth) / (viewmodel.getListOrderedStacks().Count * 2)) + 10f + (float)DeviceDisplay.MainDisplayInfo.Width * 0.04f, (float)((DeviceDisplay.MainDisplayInfo.Height * 0.1) + (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.01 + 2 * (0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("001"))));
+ SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width * 0.92f - 20 - inflateWidth) / (viewmodel.getListOrderedStacks().Count * 2)) + 10f + (float)DeviceDisplay.MainDisplayInfo.Width * 0.04f, (float)((DeviceDisplay.MainDisplayInfo.Height * 0.1) + (DeviceDisplay.MainDisplayInfo.Height * 0.85) * 0.01 + 2 * (0.05f * (float)DeviceDisplay.MainDisplayInfo.Width * textPaint.TextSize / textPaint.MeasureText("001"))));
position.X -= inflateWidth;
@@ -284,7 +284,7 @@ namespace TheGameExtreme.view
float inflateWidth = 0.024f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20);
- SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width * 0.92f - 20 - inflateWidth) / (viewmodel.CurrentHand.Count * 2)) + 10f + (float)DeviceDisplay.MainDisplayInfo.Width * 0.04f, (float)((DeviceDisplay.MainDisplayInfo.Height * 0.9) - (DeviceDisplay.MainDisplayInfo.Height * 0.9) * 0.1 - 2 * (0.05f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20) * textPaint.TextSize / textPaint.MeasureText("001"))));
+ SKPoint position = new SKPoint((float)((DeviceDisplay.MainDisplayInfo.Width * 0.92f - 20 - inflateWidth) / (viewmodel.CurrentHand.Count * 2)) + 10f + (float)DeviceDisplay.MainDisplayInfo.Width * 0.04f, (float)((DeviceDisplay.MainDisplayInfo.Height * 0.85) - (DeviceDisplay.MainDisplayInfo.Height * 0.85) * 0.1 - 2 * (0.05f * (float)(DeviceDisplay.MainDisplayInfo.Width - 20) * textPaint.TextSize / textPaint.MeasureText("001"))));
position.X -= inflateWidth;
@@ -346,6 +346,7 @@ namespace TheGameExtreme.view
{
return false;
}
+ progressBar.Progress -= ((100f / nbCard) / 100f);
return true;
}
@@ -371,6 +372,8 @@ namespace TheGameExtreme.view
InflateStack();
InflateHand();
+ progressBar.Progress = 1f;
+
gameOption.Children.Clear();
Button button = new Button();
button.Text = AppResources.StrEndTurn;