Mastermind Game with Drag and Drop Functionality

There as nice article some time ago on this site for creating mastermind game by Mike Gold. I am rewriting complete game from scratch to implement Drag and Drop feature and presentable User interface.  

MasterMindGameLogic: I have Implemented Game logic in separate Class Board which handles all Game.

frmMasterMind.cs: Is a form containing user interface for mastermind game

I have used off-Screen drawing combined with opaque background by overriding OnPaintBackground method of form to Produce flicker free and smooth rendering of User interface. 

For Dragging I have used combination of mouse down mouse Move and mouse up events. 

For purpose of speeding up Drawing I have created all images in memory  like pegs, Result pegs , peg hole and  result hole so that I do not have to create this images during every screen refresh, other purpose of doing so was to allow in future to use Skin for such objects. 

I have also used AntiAlias effect so show smooth edges wherever required however I will recommend caution while using that because it will reduce drawing speed considerably.

I have also tested this application on Compact framework beta1 pocket pc (after removing some parts like gradient peg, Inset circle, AntiAlias effects etc) it works in same manner except some thing messes up in menu (may be its bug of beta1) 

Drawing Utility:  I have written some useful methods for drawing various object of games like pegs, Hole on board raised string etc in this class.

Up Next
    Ebook Download
    View all
    View all