Posted on: 16/09/2018
Updated on: 17/09/2018
Task done/total: 8/10
This is a desktop application running on Windows OS. The app reflects my research on Windows Forms and OO-Programming.
Github: https://github.com/jaynguyen89/AutoJack
AutoJack is a simple Black Jack casino-styled game running on desktop Windows platform. This application is developed in Windows Forms using .NET framework with Object Oriented C#. I develop this game to learn about Windows Forms, and review as well as consolidate my knowledge of algorithms and design pattern. The game does not simulate exactly the same as real Black Jack casino game since I never played it before (I only read the rules while implementing the algorithms), but for the behaviors of the functions in the app itself, all logics with user interactions are validated to cope with the specific rules of the game.
Introduction: AutoJack allows players to select one of their saved game to play. While selecting a saved game, players can view its details and update player information, or delete a saved game. It is an offline application so data are saved and accessed locally. As a Black Jack game, AutoJack provides Stand, Hit, Double, Split hand options. Players get reward points if they win, loose points if they loose, and get nothing if it’s a draw. Players’ longest win streak and current win streak are recorded to provide a small statictic in player details. However, current win streak is taken into account when calculating reward points, the longer it get, the bigger the reward will be.
The below description gives more details on AutoJack’s features:
While developing this application, working with Windows Forms is not the challenging part since I have prior experience in Java Swing and AWT so customizing the views programmatically is quite straightforward. In fact, the most difficult part is to write the algorithms for the machine to deal with the real players. To develop such complex algorithms while also ensuring the proper level of coupling of the source code, the design pattern I have implemented is Mediator Pattern
. I also utilize object oriented programming with Interface and Inheritance to make a clear structure and maintain cohesion for the source code.
With Mediator Pattern
, I have a Callback
class, which will execute the required functions based on user interaction events. To make the program behave more like real game, I develop both synchronous and asynchronous callback functions to visualize machine round more human-like. The GameController class is also implemented with a design pattern called Front Controller
so whenever an user-interaction event is sent to GameController from GameView, the GameController will displatch this event and send it to an appropriate Callback to handle the event.
Please have a look at the Class Diagram in the attachment section to understand the design of AutoJack. By completing this application, I have learnt a lot about Windows Forms in .NET framework. I can also review my knowledge in software design and practice to consolidate my programming skills with algorithms and data structure in OO-C#. Beside that, by reflecting the designs with UML disagrams, I have reviewed the essential concepts and stages in documentation.
The next step in this application, I will extend it with the feature that allows 2 players to play with each other. I have prior knowledge and skills in Socket programming and Multithreading in Java when doing university assignments. However, with this application being a real game, I need to do some researches to connect players over the network. I already have in mind some ideas of how to implement this feature. I will update it soon with another post.
Thank you for browsing my blog! If you have any ideas to suggest, please click the button in the overview section.