Imports EvolutionaryComputingFramework '\\ --[MastermindGuessGene]-------------------------------------------------- '\\ Represents the IGene implementation that is a single guess in the game '\\ of mastermind '\\ ------------------------------------------------------------------------- Public Class MastermindGuessGene Inherits IGene Public Enum Peg_Colours White_Peg Black_Peg Green_Peg Blue_Peg Yellow_Peg Red_Peg Orange_Peg Brown_Peg End Enum #Region "Private members" Private _PegColour As Peg_Colours #End Region Public Overrides Property Value() As Object Get Return _PegColour End Get Set(ByVal Value As Object) If TypeOf (Value) Is Peg_Colours Then _PegColour = Value Else Throw New ArgumentException("Only acceptable value is one of the defined peg colours") End If End Set End Property #Region "Public constructors" Public Sub New() '\\ Start with a peg colour chosen at random Randomize() _PegColour = CType(CInt(Int((7 * Rnd()))), Peg_Colours) End Sub Public Sub New(ByVal PegColour As Peg_Colours) _PegColour = PegColour End Sub #End Region End Class
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)