Conversation
|
|
||
| namespace TechnicalAssesment | ||
| { | ||
| public enum GameResult |
There was a problem hiding this comment.
Please add Enums to its own file. Away from the game logic. EG: Enums/GameResult.cs
|
|
||
| public class ScoreBoard | ||
| { | ||
| public byte playerWins; |
There was a problem hiding this comment.
Please use int type, there will be limitations on larger values being stored in bytes.
Also there are inconsistencies in first letter casing. EG: public byte playerWins --> public byte PlayerWins
| { | ||
| public byte playerWins; | ||
| public int DealerWins; | ||
| public byte Ties { get; set; } |
There was a problem hiding this comment.
Please use int type, there will be limitations on larger values beeing stored in bytes.
| public void Shuffle() | ||
| { | ||
| for (int i = 0; i < MaxCards; i++) | ||
| { | ||
| cards.Add(i); | ||
| } | ||
| } |
There was a problem hiding this comment.
The shuffle method does not cater for any card type Eg: Hearts, Clubs etc.
The value of the cards will not represent the face value of the card Eg: King = 13, Queen = 12 etc.
| public byte Ties { get; set; } | ||
| } | ||
|
|
||
| public class Deck |
There was a problem hiding this comment.
Please add Deck to its own file. Under services. EG EG: Services/DeckService.cs
|
|
||
| internal void Play(int numGames) | ||
| { | ||
| deck = new Deck(); |
There was a problem hiding this comment.
You can new up the Deck class in the game class on construction.
| internal void Play(int numGames) | ||
| { | ||
| deck = new Deck(); | ||
| ShuffleDevk(); |
There was a problem hiding this comment.
Spelling error. This may not compile/build.
| case GameResult.DealerWon: | ||
| ScoreBoard.DealerWins++; | ||
| Console.WriteLine($"{numGames}: Dealer"); | ||
|
|
||
| break; | ||
|
|
||
| case GameResult.PlayerWon: | ||
| ScoreBoard.playerWins++; | ||
| Console.WriteLine($"{numGames}: Player"); | ||
| break; | ||
|
|
||
| case GameResult.Tie: | ||
| ScoreBoard.Ties++; | ||
| Console.WriteLine($"{numGames}: Tie"); | ||
| break; |
There was a problem hiding this comment.
The console output does not show the results of any drawn card value, only the number of games/rounds played.
|
|
||
| } | ||
|
|
||
| private void ShuffleDeck() |
There was a problem hiding this comment.
No use for "ShuffleDeck" method in game class simply call the deck class from the main game.
| private byte DealerCard; | ||
| private byte PlayerCard; |
There was a problem hiding this comment.
No need to for class declaration as the values are changed each time a draw takes place and can be a local variable within the method.
No description provided.