In C#, write a simulator that models the popular ‘Snap’ card game. Your simulator should model a game between several players and output information about the state of the game to the console. No significant user interaction or user interface is required. It’s beyond the scope of this work to write a fully interactive snap game!
A definition of the Snap game follows:
A standard pack of 52 cards is shuffled and then dealt out equally among the players in face-down stacks (any remaining cards are discarded). Play proceeds with the players taking it in turns to remove a card from the top of their stack and place it face-up on a central pile. If two cards placed consecutively on the pile have the same number value (e.g. 2 queens) then players must shout "Snap!" and place their hand on the top of the central pile. The first player who "snaps" the cards takes the cards from the central pile and adds them to the bottom of their own stack. The player who accumulates all of the cards in this way wins the game.
- should follow good design and coding best practices. Be aware that these will be discussed in the next stage of the interview process.
- should include a couple of unit tests. Some good candidates could be the shuffling of cards and the dealing of cards to the players. The aim here isn’t to provide a full test suite, but to demonstrate your ability to write tests. You can pick whichever unit testing framework you are comfortable with (NUnit, XUnit, MSpec...).
- should, if possible, target
.NET 4.5.1 and build in Visual Studio 2013.NET Core 3.1 and build in Visual Studio 2019*
. If it doesn’t, please indicate which version of .NET and Visual Studio you used.
- can include third-party libraries from NuGet. You can submit your solution via a repository of your choice (GitHub, Bitbucket, etc) or send it to us via email in a .zip file. We will provide you with feedback on your solution and where appropriate will invite you to a further face to face interview. At this interview we will ask you to discuss your design choices and the coding practices you followed. We appreciate that this exercise will take up some of your time and thank you for making time for us. Good luck! The IGI Team