Skip to content

Commit

Permalink
commit all new change
Browse files Browse the repository at this point in the history
  • Loading branch information
kenny516 committed Jun 11, 2024
1 parent f968b14 commit e92bd78
Show file tree
Hide file tree
Showing 34 changed files with 1,238 additions and 192 deletions.
13 changes: 13 additions & 0 deletions .idea/.idea.Dechiffre/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.idea.Dechiffre/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.Dechiffre/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.Dechiffre/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.Dechiffre/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

997 changes: 997 additions & 0 deletions .idea/config/applicationhost.config

Large diffs are not rendered by default.

Binary file modified .vs/Dechiffre/v17/.suo
Binary file not shown.
36 changes: 16 additions & 20 deletions .vs/Dechiffre/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"AbsoluteMoniker": "D:0:0:{A3CDACDB-AD78-4F00-B75C-254020C2BAE2}|Dechiffre.csproj|d:\\s4\\mrtahina\\des-chiffres\\wwwroot\\js\\app.js||{14D17961-FE51-464D-9111-C4AF11D7D99A}",
"RelativeMoniker": "D:0:0:{A3CDACDB-AD78-4F00-B75C-254020C2BAE2}|Dechiffre.csproj|solutionrelative:wwwroot\\js\\app.js||{14D17961-FE51-464D-9111-C4AF11D7D99A}"
},
{
"AbsoluteMoniker": "D:0:0:{A3CDACDB-AD78-4F00-B75C-254020C2BAE2}|Dechiffre.csproj|d:\\s4\\mrtahina\\des-chiffres\\views\\game\\game.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A3CDACDB-AD78-4F00-B75C-254020C2BAE2}|Dechiffre.csproj|solutionrelative:views\\game\\game.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}"
},
{
"AbsoluteMoniker": "D:0:0:{A3CDACDB-AD78-4F00-B75C-254020C2BAE2}|Dechiffre.csproj|d:\\s4\\mrtahina\\des-chiffres\\views\\shared\\_layout.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A3CDACDB-AD78-4F00-B75C-254020C2BAE2}|Dechiffre.csproj|solutionrelative:views\\shared\\_layout.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}"
Expand All @@ -18,10 +22,6 @@
"AbsoluteMoniker": "D:0:0:{A3CDACDB-AD78-4F00-B75C-254020C2BAE2}|Dechiffre.csproj|d:\\s4\\mrtahina\\des-chiffres\\models\\gamemodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A3CDACDB-AD78-4F00-B75C-254020C2BAE2}|Dechiffre.csproj|solutionrelative:models\\gamemodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A3CDACDB-AD78-4F00-B75C-254020C2BAE2}|Dechiffre.csproj|d:\\s4\\mrtahina\\des-chiffres\\views\\game\\game.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}",
"RelativeMoniker": "D:0:0:{A3CDACDB-AD78-4F00-B75C-254020C2BAE2}|Dechiffre.csproj|solutionrelative:views\\game\\game.cshtml||{40D31677-CBC0-4297-A9EF-89D907823A98}"
},
{
"AbsoluteMoniker": "D:0:0:{A3CDACDB-AD78-4F00-B75C-254020C2BAE2}|Dechiffre.csproj|d:\\s4\\mrtahina\\des-chiffres\\models\\player.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A3CDACDB-AD78-4F00-B75C-254020C2BAE2}|Dechiffre.csproj|solutionrelative:models\\player.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
Expand Down Expand Up @@ -49,7 +49,7 @@
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 259,
"DockedWidth": 298,
"SelectedChildIndex": 5,
"Children": [
{
Expand All @@ -70,42 +70,39 @@
},
{
"$type": "Document",
"DocumentIndex": 3,
"DocumentIndex": 4,
"Title": "GameModel.cs",
"DocumentMoniker": "D:\\S4\\MrTahina\\Des-Chiffres\\Models\\GameModel.cs",
"RelativeDocumentMoniker": "Models\\GameModel.cs",
"ToolTip": "D:\\S4\\MrTahina\\Des-Chiffres\\Models\\GameModel.cs",
"RelativeToolTip": "Models\\GameModel.cs",
"ViewState": "AQIAACsAAAAAAAAAAADwvzsAAAAnAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-06-09T06:48:03.892Z",
"EditorCaption": ""
"WhenOpened": "2024-06-09T06:48:03.892Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"DocumentIndex": 3,
"Title": "Index.cshtml",
"DocumentMoniker": "D:\\S4\\MrTahina\\Des-Chiffres\\Views\\Home\\Index.cshtml",
"RelativeDocumentMoniker": "Views\\Home\\Index.cshtml",
"ToolTip": "D:\\S4\\MrTahina\\Des-Chiffres\\Views\\Home\\Index.cshtml",
"RelativeToolTip": "Views\\Home\\Index.cshtml",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAcAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000759|",
"WhenOpened": "2024-06-10T09:34:33.052Z",
"EditorCaption": ""
"WhenOpened": "2024-06-10T09:34:33.052Z"
},
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 2,
"Title": "_Layout.cshtml",
"DocumentMoniker": "D:\\S4\\MrTahina\\Des-Chiffres\\Views\\Shared\\_Layout.cshtml",
"RelativeDocumentMoniker": "Views\\Shared\\_Layout.cshtml",
"ToolTip": "D:\\S4\\MrTahina\\Des-Chiffres\\Views\\Shared\\_Layout.cshtml",
"RelativeToolTip": "Views\\Shared\\_Layout.cshtml",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABoAAAAHAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000759|",
"WhenOpened": "2024-06-10T09:34:15.114Z",
"EditorCaption": ""
"WhenOpened": "2024-06-10T09:34:15.114Z"
},
{
"$type": "Document",
Expand All @@ -115,7 +112,7 @@
"RelativeDocumentMoniker": "wwwroot\\js\\app.js",
"ToolTip": "D:\\S4\\MrTahina\\Des-Chiffres\\wwwroot\\js\\app.js",
"RelativeToolTip": "wwwroot\\js\\app.js",
"ViewState": "AQIAADAAAAAAAAAAAAAkwEkAAAAcAAAA",
"ViewState": "AQIAABYAAAAAAAAAAAAuwEAAAAACAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001646|",
"WhenOpened": "2024-06-07T19:02:33.829Z",
"EditorCaption": ""
Expand All @@ -130,8 +127,7 @@
"RelativeToolTip": "Models\\Player.cs",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAYAAAAcAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-06-10T09:40:35.643Z",
"EditorCaption": ""
"WhenOpened": "2024-06-10T09:40:35.643Z"
},
{
"$type": "Document",
Expand All @@ -148,7 +144,7 @@
]
},
{
"DockedWidth": 329,
"DockedWidth": 290,
"SelectedChildIndex": 1,
"Children": [
{
Expand All @@ -165,13 +161,13 @@
},
{
"$type": "Document",
"DocumentIndex": 4,
"DocumentIndex": 1,
"Title": "Game.cshtml",
"DocumentMoniker": "D:\\S4\\MrTahina\\Des-Chiffres\\Views\\Game\\Game.cshtml",
"RelativeDocumentMoniker": "Views\\Game\\Game.cshtml",
"ToolTip": "D:\\S4\\MrTahina\\Des-Chiffres\\Views\\Game\\Game.cshtml",
"RelativeToolTip": "Views\\Game\\Game.cshtml",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAUAAAAbAAAA",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABAAAAATAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000759|",
"WhenOpened": "2024-06-09T10:37:42.103Z",
"EditorCaption": ""
Expand Down
Binary file modified .vs/ProjectEvaluation/dechiffre.metadata.v7.bin
Binary file not shown.
Binary file modified .vs/ProjectEvaluation/dechiffre.projects.v7.bin
Binary file not shown.
20 changes: 16 additions & 4 deletions Controllers/GameController .cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using Dechiffre.Models;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;

namespace DesChiffres.Controllers
{
Expand All @@ -14,8 +12,8 @@ public JsonResult Index(int minNbr = 1, int maxNbr = 1001, int nbrChoice = 7)
{
List<Player> players = new List<Player>
{
new Player { name = "player 1", temps = 0, nbrChoice = -1 },
new Player { name = "player 2", temps = 0, nbrChoice = -1 }
new Player { name = "player 1", temps = 0, nbrChoice = -1 ,point = 0},
new Player { name = "player 2", temps = 0, nbrChoice = -1 ,point = 0}
};

GameModel? game = new GameModel
Expand All @@ -29,6 +27,20 @@ public JsonResult Index(int minNbr = 1, int maxNbr = 1001, int nbrChoice = 7)
return Json(game);
}

[HttpPost("api/game/newGame")]
public JsonResult NewGame([FromBody] GameModel game)
{
game.TargetNumber = _random.Next(100, 1000);
game.players[0].nbrChoice = -1;
game.players[1].nbrChoice = -1;

game.winner_not_verify = 10;
game.value_verify = 0;
game.Numbers = GenerateNumbers(7, 1, 101);
return Json(game);
}


[HttpPost("api/game/submitresults")]
public JsonResult SubmitResults([FromBody] GameModel game)
{
Expand Down
20 changes: 10 additions & 10 deletions Models/GameModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Microsoft.AspNetCore.Mvc;

namespace Dechiffre.Models
namespace Dechiffre.Models
{

public class GameModel
Expand All @@ -10,25 +8,27 @@ public class GameModel
public List<Player> players { get; set; }
// id du winner pas encore verifier
public int winner_not_verify { get; set; }
//valeur a verifier
//valeur a verifier dans le formulaire de verification
public int value_verify { get; set; }


// verification

public Player VerifyWinner()
{
int IDwinner_not_verify = this.winner_not_verify;
Console.WriteLine("verify nbr " + this.value_verify);
int IDwinner_not_verify = winner_not_verify;
Console.WriteLine("verify nbr " + value_verify);

if (this.players[IDwinner_not_verify].nbrChoice == this.value_verify)
if (players[IDwinner_not_verify].nbrChoice == value_verify)
{
return this.players[IDwinner_not_verify];
players[IDwinner_not_verify].point++;
return players[IDwinner_not_verify];
}
else
{
int otherPlayerID = (IDwinner_not_verify + 1) % this.players.Count;
return this.players[otherPlayerID];
int otherPlayerID = (IDwinner_not_verify + 1) % players.Count;
players[otherPlayerID].point++;
return players[otherPlayerID];
}
}

Expand Down
2 changes: 2 additions & 0 deletions Models/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ public class Player
public string name { get; set; }
public double temps { get; set; }
public int nbrChoice { get; set; }

public int point { get; set; }
}
}
10 changes: 8 additions & 2 deletions Views/Game/Game.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<h1 class="text-center text-5xl text-black">
DECHIFFRE CE NOMBRE
</h1>
<div class="flex w-full justify-center" ng-click="newGame()">
<button class="flex h-10 w-60 items-center justify-center rounded-2xl border border-sky-500 bg-sky-500 text-white">
Generer un nouveau nombre
</button>
</div>
<div class="mt-5 flex h-10 w-60 items-center justify-center rounded-xl border border-sky-500 text-2xl">
{{game.targetNumber}}
</div>
Expand All @@ -22,7 +27,8 @@
<section class="grid-cols-2 grid gap-8">
<div class="rounded-2xl bg-sky-800" ng-repeat="player in game.players" ng-init="submit = true">
<form class="flex h-80 w-80 flex-col items-center gap-10 rounded-2xl pb-8 pt-8" ng-submit="submitResults($index); submit = false">
<label class="underline-offset-8 text-xl text-white underline">{{player.name}}</label>
<label class="underline-offset-8 text-xl text-white underline">Name :{{player.name}}</label>
<label class="underline-offset-8 text-xl text-white">Point : {{player.point}}</label>
<input class="w-50 border-2 h-10 rounded-xl border-sky-500 text-center placeholder:text-2xl" type="number" ng-model="player.NbrChoice">
<div class="flex w-full justify-center" ng-show="submit">
<button class="h-10 w-1/2 rounded-2xl border border-sky-500 bg-sky-500 text-white" type="submit">
Expand Down Expand Up @@ -91,7 +97,7 @@

</div>
<div ng-if="game.winner_not_verify < 0">
<h1 class="text-2xl font-bold"">
<h1 class="text-2xl font-bold">
AUCUN JOUEUR A GAGNER
</h1>
</div>
Expand Down
Binary file modified bin/Debug/net8.0/Dechiffre.dll
Binary file not shown.
Binary file modified bin/Debug/net8.0/Dechiffre.exe
Binary file not shown.
Binary file modified bin/Debug/net8.0/Dechiffre.pdb
Binary file not shown.
9 changes: 4 additions & 5 deletions obj/Debug/net8.0/Dechiffre.AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
// This code was generated by a tool.
//
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

Expand All @@ -14,7 +13,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("Dechiffre")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+902b142a20a818f77ba860733012b61be13a0126")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f968b14d89f49361c893c9fa9ef590668b3e0a8a")]
[assembly: System.Reflection.AssemblyProductAttribute("Dechiffre")]
[assembly: System.Reflection.AssemblyTitleAttribute("Dechiffre")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Expand Down
2 changes: 1 addition & 1 deletion obj/Debug/net8.0/Dechiffre.AssemblyInfoInputs.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
92d4b6b9b8d4d79d85139dab16d6d28f5c9fddc19cff28840033e2d8a28a3241
acc327071ecbe4ebf779df47f75eae3ec19c07d79e5a0810e77d6dbee4cda695
Binary file modified obj/Debug/net8.0/Dechiffre.dll
Binary file not shown.
Binary file modified obj/Debug/net8.0/Dechiffre.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion obj/Debug/net8.0/Dechiffre.sourcelink.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documents":{"D:\\S4\\MrTahina\\Des-Chiffres\\*":"https://raw.githubusercontent.com/kenny516/Des-Chiffres/902b142a20a818f77ba860733012b61be13a0126/*"}}
{"documents":{"D:\\S4\\MrTahina\\Des-Chiffres\\*":"https://raw.githubusercontent.com/kenny516/Des-Chiffres/f968b14d89f49361c893c9fa9ef590668b3e0a8a/*"}}
Binary file modified obj/Debug/net8.0/apphost.exe
Binary file not shown.
Binary file modified obj/Debug/net8.0/ref/Dechiffre.dll
Binary file not shown.
Binary file modified obj/Debug/net8.0/refint/Dechiffre.dll
Binary file not shown.
Loading

0 comments on commit e92bd78

Please sign in to comment.