Can anyone teach me how to write mastermind in GUI??

This is a discussion on Can anyone teach me how to write mastermind in GUI?? within the C++ Programming forums, part of the General Programming Boards category; Can anyone teach me how to write mastermind in GUI?? My little son want to play it!!...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    9

    Can anyone teach me how to write mastermind in GUI??

    Can anyone teach me how to write mastermind in GUI??

    My little son want to play it!!

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Do you mean mastermind as in the "you have a set of coloured pegs in holes" and you get to know how many are in the right place and how many are the right colours, but not in the right place?

    Writing something like that wouldn't be VERY hard, but it'd probably be a few days of effort if you haven't got A LOT of experience in GUI coding.

    Where are you at right now?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    9
    So can you teach me the general comcept of how to do those things?

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Possibly - but depending on your current level of programming skills, it may be quite a lot of work.

    What part do you want to learn? There are clearly several problems to solve, here's a list of some of those:
    - the game-play strategy and logic (such as counting the number of correctly placed items, and counting the ones that are right colour but out of place)
    - visualizing the play on the GUI
    - user input to place new items

    Depending on how much you have programmed before, some of this may be easy, other parts will be harder.

    I haven't written this type of code before, and I'm not the right person for complicated GUI apps - but I have done a few simple GUI apps before now (a version of "Othello", "Soduko" and a image viewer & printer app).

    Of course, if the ENTIRE purpose of this is to have your son play mastermind, getting soemthing from the web is most likely much easier.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Apr 2009
    Posts
    9
    Basically, I would like to ask how to put the colour I choose to the guess box
    Last edited by prefectticky; 04-16-2009 at 08:03 AM.

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So, how far have you got so far [do you have a guess-box, for example]?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Apr 2009
    Posts
    9
    the guessbox is a groupbox which includes several pictureboxes.
    After selecting a radio button, let's say red. How can I turn a picturebox into red after clicking a picturebox?
    http://i80.photobucket.com/albums/j200/danny325/h.jpg
    This is a capture of my work. Please give me a hand.

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So, you pick the colour, and then detect clicks in the guess boxes. Seems simple enough to me.

    Alternatively, you could implement a "drag and drop" variant.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #9
    Registered User
    Join Date
    Apr 2009
    Posts
    9
    But will drag and drop be more diffcult to me?
    i've looked up some drag and drop examples, but seems difficult to me.

    What about the method i've mentioned before?
    how can the guess box detect clicks?and how can the guess box change the colour which i selected?

    Sorry for too much question. BTW, thank you for your help, Mats.

  10. #10
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    839

  11. #11
    Registered User
    Join Date
    Apr 2009
    Posts
    9
    Is it created by javascript?
    How can i do with c++ one?

  12. #12
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by prefectticky View Post
    But will drag and drop be more diffcult to me?
    i've looked up some drag and drop examples, but seems difficult to me.

    What about the method i've mentioned before?
    how can the guess box detect clicks?and how can the guess box change the colour which i selected?

    Sorry for too much question. BTW, thank you for your help, Mats.
    What is the code behind the current dialog box [I take it it is a dialog box]?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  13. #13
    Registered User
    Join Date
    Apr 2006
    Posts
    137
    It looks like you are building it in C#...
    If you wanna build it in C++, you would need to use a graphics library such as SDL or allegro, but if you want it simple like yours, a normal GUI library would do, otherwise you'll have to use Win32 API -- try the site I linked to, maybe you'll find some useful tutorials to get you started on basic things like creating buttons.
    ★ Inferno provides Programming Tutorials in a variety of languages. Join our Programming Forums. ★

  14. #14
    Registered User
    Join Date
    Apr 2009
    Posts
    9
    Quote Originally Posted by execute View Post
    It looks like you are building it in C#...
    If you wanna build it in C++, you would need to use a graphics library such as SDL or allegro, but if you want it simple like yours, a normal GUI library would do, otherwise you'll have to use Win32 API -- try the site I linked to, maybe you'll find some useful tutorials to get you started on basic things like creating buttons.
    i think GUI is the simplest way to build it.
    Could you help me to have some general ideas in making Mastermind?

  15. #15
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    We still don't QUITE know what you need help with (assuming that you are actually not just asking "Can someone write one for me?") - if you post what code you have now that deals with that dialog box, we would be much better positioned to answer DIRECT questions.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems with fstream, one variabile for write and read
    By Smjert in forum C++ Programming
    Replies: 3
    Last Post: 02-03-2009, 09:19 PM
  2. Replies: 7
    Last Post: 02-12-2003, 10:43 PM
  3. C++: Reference Book, GUI, Networking & Beyond
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 11-10-2001, 07:03 PM
  4. GUI (Graphical User Interface) Help Needed
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 10-11-2001, 10:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21