SlideShare a Scribd company logo
1 of 22
• The main menu has three options
   • New Game – Starts a new game
   • Rules – Shows instructions on how to
      play the game
   • Quit – Closes the application

• This is the page where the user goes if he
  clicks “Main Menu” button which is available
  on the game board
• Number is disabled when
  clicked to have a code with
  non repeating digits

• Enter will be enabled when
  all for digits in the code are
  ready to be entered
MVC architecture used for
     Mastermind
Controller
• The Controller is responsible for the flow of the data transmission
• It consists of the „main‟ method which is responsible for starting the game
• It is responsible for creating the View classes and Model classes
• It maintains instances of the Model classes and invokes various business methods in them;
  in response to user‟s actions which could be either inputting the data or controlling the
  Graphical User Interface (GUI) for displaying the data using View classes

View
• View classes handle the GUI for the user
• The data to be represented will be received from Controller whenever the user inputs new
  information or performs specific actions.
• The received data from Controller will be presented in different elements such as
  Textbox, Label, Button, Table etc. (Some of these widgets can accept input from the user)
• The View is independent from the Model classes; thus, it does not maintain any information
  about the existing classes in the Model.
Model
• The Model is the main component and the heart of the application
• It has classes that will perform majority of the game functionality part
• The contained objects will have different business methods which are related to different business
  events and scenarios that take place in the context of the application
• The master class is the Game class which is a concrete class that will keep track of the player’s turn
  and the outcome of the game
• Display and Processing are separated

• Future enhancements and other maintenance of the code base made very easy and reusable

• Attach multiple views to a model to provide different presentations (view/model decoupling)

• Change the way a view responds to user input without changing its visual presentation”
  (view/controller decoupling)

• All this combined gives GREAT FLEXIBILITY
User enters his secret code
User guesses computer‟s secret code
Computer guesses user‟s secret code
• Used to have flexibility and maintainability
• We can increase the difficulty level in the future by adding concrete classes that use a better version
  of the algorithm for guessing
• New checker functionality can be added when we decide to have a different method of checking for
  feedback (Eg: Giving only feedback when the position as well as the number match and not for
  number only)
• The controller component handles the entire application and the game starts by running the main
  method in the controller component(singleton pattern)
• Only instance of the controller should be used to handle the game application
• Using a singleton pattern to control the creation of Controller class instances helps us in this case
• The algorithm used to play the computer‟s chance is based on the famous five-guess
  algorithm which was developed by Donald Knuth in 1977. The steps involved in
  guessing a code given by the user is as follows:
    1. Create a set S of remaining possibilities (Which is initially 10*9*8*7). Select the first
       possibility from this set and use it as the first guess and get the feedback for this
       guess
    2. Remove all possibilities from S that would not give the same score of black and
       white pegs in the feedback if they were the answer
    3. Select the first possible code from S and use it as the next guess and get the
       feedback.
    4. Go back to step 2 until you have got it right

           This is the only algorithm being used right
          now but we can add various difficulty levels,
         as we are using strategy pattern to implement
                          the algorithm.
1) MVC Pattern:
http://msdn.microsoft.com/en-us/library/ff649643.aspx

2) Mastermind algorithm:
http://en.wikipedia.org/wiki/Mastermind_(board_game)
Mastermind design walkthrough

More Related Content

What's hot

Programming Without Coding Technology (PWCT) - Simple GUI Application
Programming Without Coding Technology (PWCT) - Simple GUI ApplicationProgramming Without Coding Technology (PWCT) - Simple GUI Application
Programming Without Coding Technology (PWCT) - Simple GUI ApplicationMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Label Control
Programming Without Coding Technology (PWCT) - Label ControlProgramming Without Coding Technology (PWCT) - Label Control
Programming Without Coding Technology (PWCT) - Label ControlMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Checkbox control
Programming Without Coding Technology (PWCT) - Checkbox controlProgramming Without Coding Technology (PWCT) - Checkbox control
Programming Without Coding Technology (PWCT) - Checkbox controlMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Date Picker control
Programming Without Coding Technology (PWCT) - Date Picker controlProgramming Without Coding Technology (PWCT) - Date Picker control
Programming Without Coding Technology (PWCT) - Date Picker controlMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Progressbar control
Programming Without Coding Technology (PWCT) - Progressbar controlProgramming Without Coding Technology (PWCT) - Progressbar control
Programming Without Coding Technology (PWCT) - Progressbar controlMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Editbox control
Programming Without Coding Technology (PWCT) - Editbox controlProgramming Without Coding Technology (PWCT) - Editbox control
Programming Without Coding Technology (PWCT) - Editbox controlMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Error Handling (Try/Catch)
Programming Without Coding Technology (PWCT) - Error Handling (Try/Catch)Programming Without Coding Technology (PWCT) - Error Handling (Try/Catch)
Programming Without Coding Technology (PWCT) - Error Handling (Try/Catch)Mahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Textbox Control
Programming Without Coding Technology (PWCT) - Textbox ControlProgramming Without Coding Technology (PWCT) - Textbox Control
Programming Without Coding Technology (PWCT) - Textbox ControlMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Hyperlink control
Programming Without Coding Technology (PWCT) - Hyperlink controlProgramming Without Coding Technology (PWCT) - Hyperlink control
Programming Without Coding Technology (PWCT) - Hyperlink controlMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Timer control
Programming Without Coding Technology (PWCT) - Timer controlProgramming Without Coding Technology (PWCT) - Timer control
Programming Without Coding Technology (PWCT) - Timer controlMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.
Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.
Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.Mahmoud Samir Fayed
 
Using macros in microsoft excel part 2
Using macros in microsoft excel   part 2Using macros in microsoft excel   part 2
Using macros in microsoft excel part 2Er. Nawaraj Bhandari
 
Programming Without Coding Technology (PWCT) - IF Statement Component
Programming Without Coding Technology (PWCT) - IF Statement ComponentProgramming Without Coding Technology (PWCT) - IF Statement Component
Programming Without Coding Technology (PWCT) - IF Statement ComponentMahmoud Samir Fayed
 
Microsoft mathematicsrevised
Microsoft mathematicsrevisedMicrosoft mathematicsrevised
Microsoft mathematicsrevisedClaudsclaudz
 
Programming Without Coding Technology (PWCT) - The Macro Operator
Programming Without Coding Technology (PWCT) - The Macro OperatorProgramming Without Coding Technology (PWCT) - The Macro Operator
Programming Without Coding Technology (PWCT) - The Macro OperatorMahmoud Samir Fayed
 
Programming Without Coding Technology (PWCT) - Tab control
Programming Without Coding Technology (PWCT) - Tab controlProgramming Without Coding Technology (PWCT) - Tab control
Programming Without Coding Technology (PWCT) - Tab controlMahmoud Samir Fayed
 

What's hot (18)

Programming Without Coding Technology (PWCT) - Simple GUI Application
Programming Without Coding Technology (PWCT) - Simple GUI ApplicationProgramming Without Coding Technology (PWCT) - Simple GUI Application
Programming Without Coding Technology (PWCT) - Simple GUI Application
 
Programming Without Coding Technology (PWCT) - Label Control
Programming Without Coding Technology (PWCT) - Label ControlProgramming Without Coding Technology (PWCT) - Label Control
Programming Without Coding Technology (PWCT) - Label Control
 
Programming Without Coding Technology (PWCT) - Checkbox control
Programming Without Coding Technology (PWCT) - Checkbox controlProgramming Without Coding Technology (PWCT) - Checkbox control
Programming Without Coding Technology (PWCT) - Checkbox control
 
Programming Without Coding Technology (PWCT) - Date Picker control
Programming Without Coding Technology (PWCT) - Date Picker controlProgramming Without Coding Technology (PWCT) - Date Picker control
Programming Without Coding Technology (PWCT) - Date Picker control
 
Programming Without Coding Technology (PWCT) - Progressbar control
Programming Without Coding Technology (PWCT) - Progressbar controlProgramming Without Coding Technology (PWCT) - Progressbar control
Programming Without Coding Technology (PWCT) - Progressbar control
 
Programming Without Coding Technology (PWCT) - Editbox control
Programming Without Coding Technology (PWCT) - Editbox controlProgramming Without Coding Technology (PWCT) - Editbox control
Programming Without Coding Technology (PWCT) - Editbox control
 
Software Development
Software DevelopmentSoftware Development
Software Development
 
Programming Without Coding Technology (PWCT) - Error Handling (Try/Catch)
Programming Without Coding Technology (PWCT) - Error Handling (Try/Catch)Programming Without Coding Technology (PWCT) - Error Handling (Try/Catch)
Programming Without Coding Technology (PWCT) - Error Handling (Try/Catch)
 
Programming Without Coding Technology (PWCT) - Textbox Control
Programming Without Coding Technology (PWCT) - Textbox ControlProgramming Without Coding Technology (PWCT) - Textbox Control
Programming Without Coding Technology (PWCT) - Textbox Control
 
Programming Without Coding Technology (PWCT) - Hyperlink control
Programming Without Coding Technology (PWCT) - Hyperlink controlProgramming Without Coding Technology (PWCT) - Hyperlink control
Programming Without Coding Technology (PWCT) - Hyperlink control
 
Programming Without Coding Technology (PWCT) - Timer control
Programming Without Coding Technology (PWCT) - Timer controlProgramming Without Coding Technology (PWCT) - Timer control
Programming Without Coding Technology (PWCT) - Timer control
 
Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.
Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.
Programming Without Coding Technology (PWCT) - How to deal with Memo Variables.
 
Using macros in microsoft excel part 2
Using macros in microsoft excel   part 2Using macros in microsoft excel   part 2
Using macros in microsoft excel part 2
 
Programming Without Coding Technology (PWCT) - IF Statement Component
Programming Without Coding Technology (PWCT) - IF Statement ComponentProgramming Without Coding Technology (PWCT) - IF Statement Component
Programming Without Coding Technology (PWCT) - IF Statement Component
 
Microsoft mathematicsrevised
Microsoft mathematicsrevisedMicrosoft mathematicsrevised
Microsoft mathematicsrevised
 
Programming Without Coding Technology (PWCT) - The Macro Operator
Programming Without Coding Technology (PWCT) - The Macro OperatorProgramming Without Coding Technology (PWCT) - The Macro Operator
Programming Without Coding Technology (PWCT) - The Macro Operator
 
Using macros in microsoft access
Using macros in microsoft accessUsing macros in microsoft access
Using macros in microsoft access
 
Programming Without Coding Technology (PWCT) - Tab control
Programming Without Coding Technology (PWCT) - Tab controlProgramming Without Coding Technology (PWCT) - Tab control
Programming Without Coding Technology (PWCT) - Tab control
 

Similar to Mastermind design walkthrough

IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksIBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksSenturus
 
Simulation and modeling introduction.pptx
Simulation and modeling introduction.pptxSimulation and modeling introduction.pptx
Simulation and modeling introduction.pptxShamasRehman4
 
SELECT21.pptx
SELECT21.pptxSELECT21.pptx
SELECT21.pptxdevnasra1
 
GDF: A Gamification Design Framework powered by Model-Driven Engineering
GDF: A Gamification Design Framework powered by Model-Driven EngineeringGDF: A Gamification Design Framework powered by Model-Driven Engineering
GDF: A Gamification Design Framework powered by Model-Driven Engineeringantbucc
 
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelCHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelmohamed khalaf alla mohamedain
 
RTDesignWithUMLUseCase.ppt
RTDesignWithUMLUseCase.pptRTDesignWithUMLUseCase.ppt
RTDesignWithUMLUseCase.pptShashikanth
 
MODEL-DRIVEN ENGINEERING (MDE) in Practice
MODEL-DRIVEN ENGINEERING (MDE) in PracticeMODEL-DRIVEN ENGINEERING (MDE) in Practice
MODEL-DRIVEN ENGINEERING (MDE) in PracticeHussein Alshkhir
 
XMetaL Macros for Non-Programmers
XMetaL Macros for Non-ProgrammersXMetaL Macros for Non-Programmers
XMetaL Macros for Non-ProgrammersXMetaL
 
Cis 115 Education Redefined-snaptutorial.com
Cis 115 Education Redefined-snaptutorial.comCis 115 Education Redefined-snaptutorial.com
Cis 115 Education Redefined-snaptutorial.comrobertledwes38
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)praveena p
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI TestingShai Raiten
 
Automatic Code Generator 2.pptx_20240306_140049_0000.pptx
Automatic Code Generator 2.pptx_20240306_140049_0000.pptxAutomatic Code Generator 2.pptx_20240306_140049_0000.pptx
Automatic Code Generator 2.pptx_20240306_140049_0000.pptxvashishtajadhav44
 
Educational courses/tutorialoutlet.com
Educational courses/tutorialoutlet.comEducational courses/tutorialoutlet.com
Educational courses/tutorialoutlet.comCrookstonz
 
C++ programming program design including data structures
C++ programming program design including data structures C++ programming program design including data structures
C++ programming program design including data structures Ahmad Idrees
 

Similar to Mastermind design walkthrough (20)

IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksIBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
 
Simulation and modeling introduction.pptx
Simulation and modeling introduction.pptxSimulation and modeling introduction.pptx
Simulation and modeling introduction.pptx
 
Promostat original
Promostat originalPromostat original
Promostat original
 
SELECT21.pptx
SELECT21.pptxSELECT21.pptx
SELECT21.pptx
 
GDF: A Gamification Design Framework powered by Model-Driven Engineering
GDF: A Gamification Design Framework powered by Model-Driven EngineeringGDF: A Gamification Design Framework powered by Model-Driven Engineering
GDF: A Gamification Design Framework powered by Model-Driven Engineering
 
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddelCHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
 
Model based development(MBD)
Model based development(MBD) Model based development(MBD)
Model based development(MBD)
 
RTDesignWithUMLUseCase.ppt
RTDesignWithUMLUseCase.pptRTDesignWithUMLUseCase.ppt
RTDesignWithUMLUseCase.ppt
 
MODEL-DRIVEN ENGINEERING (MDE) in Practice
MODEL-DRIVEN ENGINEERING (MDE) in PracticeMODEL-DRIVEN ENGINEERING (MDE) in Practice
MODEL-DRIVEN ENGINEERING (MDE) in Practice
 
XMetaL Macros for Non-Programmers
XMetaL Macros for Non-ProgrammersXMetaL Macros for Non-Programmers
XMetaL Macros for Non-Programmers
 
Cis 115 Education Redefined-snaptutorial.com
Cis 115 Education Redefined-snaptutorial.comCis 115 Education Redefined-snaptutorial.com
Cis 115 Education Redefined-snaptutorial.com
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
 
Climberreport
ClimberreportClimberreport
Climberreport
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI Testing
 
Automatic Code Generator 2.pptx_20240306_140049_0000.pptx
Automatic Code Generator 2.pptx_20240306_140049_0000.pptxAutomatic Code Generator 2.pptx_20240306_140049_0000.pptx
Automatic Code Generator 2.pptx_20240306_140049_0000.pptx
 
pccf unit 1 _VP.pptx
pccf unit 1 _VP.pptxpccf unit 1 _VP.pptx
pccf unit 1 _VP.pptx
 
Educational courses/tutorialoutlet.com
Educational courses/tutorialoutlet.comEducational courses/tutorialoutlet.com
Educational courses/tutorialoutlet.com
 
C++ programming program design including data structures
C++ programming program design including data structures C++ programming program design including data structures
C++ programming program design including data structures
 
Developing Digital Twins
Developing Digital TwinsDeveloping Digital Twins
Developing Digital Twins
 
Endless runner
Endless runnerEndless runner
Endless runner
 

Mastermind design walkthrough

  • 1.
  • 2.
  • 3. • The main menu has three options • New Game – Starts a new game • Rules – Shows instructions on how to play the game • Quit – Closes the application • This is the page where the user goes if he clicks “Main Menu” button which is available on the game board
  • 4. • Number is disabled when clicked to have a code with non repeating digits • Enter will be enabled when all for digits in the code are ready to be entered
  • 5.
  • 6. MVC architecture used for Mastermind
  • 7. Controller • The Controller is responsible for the flow of the data transmission • It consists of the „main‟ method which is responsible for starting the game • It is responsible for creating the View classes and Model classes • It maintains instances of the Model classes and invokes various business methods in them; in response to user‟s actions which could be either inputting the data or controlling the Graphical User Interface (GUI) for displaying the data using View classes View • View classes handle the GUI for the user • The data to be represented will be received from Controller whenever the user inputs new information or performs specific actions. • The received data from Controller will be presented in different elements such as Textbox, Label, Button, Table etc. (Some of these widgets can accept input from the user) • The View is independent from the Model classes; thus, it does not maintain any information about the existing classes in the Model.
  • 8. Model • The Model is the main component and the heart of the application • It has classes that will perform majority of the game functionality part • The contained objects will have different business methods which are related to different business events and scenarios that take place in the context of the application • The master class is the Game class which is a concrete class that will keep track of the player’s turn and the outcome of the game
  • 9. • Display and Processing are separated • Future enhancements and other maintenance of the code base made very easy and reusable • Attach multiple views to a model to provide different presentations (view/model decoupling) • Change the way a view responds to user input without changing its visual presentation” (view/controller decoupling) • All this combined gives GREAT FLEXIBILITY
  • 10. User enters his secret code
  • 13.
  • 14.
  • 15. • Used to have flexibility and maintainability • We can increase the difficulty level in the future by adding concrete classes that use a better version of the algorithm for guessing • New checker functionality can be added when we decide to have a different method of checking for feedback (Eg: Giving only feedback when the position as well as the number match and not for number only)
  • 16. • The controller component handles the entire application and the game starts by running the main method in the controller component(singleton pattern) • Only instance of the controller should be used to handle the game application • Using a singleton pattern to control the creation of Controller class instances helps us in this case
  • 17.
  • 18.
  • 19.
  • 20. • The algorithm used to play the computer‟s chance is based on the famous five-guess algorithm which was developed by Donald Knuth in 1977. The steps involved in guessing a code given by the user is as follows: 1. Create a set S of remaining possibilities (Which is initially 10*9*8*7). Select the first possibility from this set and use it as the first guess and get the feedback for this guess 2. Remove all possibilities from S that would not give the same score of black and white pegs in the feedback if they were the answer 3. Select the first possible code from S and use it as the next guess and get the feedback. 4. Go back to step 2 until you have got it right This is the only algorithm being used right now but we can add various difficulty levels, as we are using strategy pattern to implement the algorithm.
  • 21. 1) MVC Pattern: http://msdn.microsoft.com/en-us/library/ff649643.aspx 2) Mastermind algorithm: http://en.wikipedia.org/wiki/Mastermind_(board_game)