Can anyone teach me how to write mastermind in GUI??
My little son want to play it!!
Can anyone teach me how to write mastermind in GUI??
My little son want to play it!!
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.
So can you teach me the general comcept of how to do those things?
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.
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.
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.
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.
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.
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.
Is it created by javascript?
How can i do with c++ one?
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. ★
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.