MasterMind
Version 2.01
By zack^

Contents:
	- About
	- Installation
	- Usage
	- Examples
	- Credits
	- Version History


About:

MasterMind is an ageless game of logic and deduction where your code-craking skills are put to the test. Try to guess (or break) your opponents colour code before you run out guessing rows.
There are 6 colours, Red, Blue, Purple, Yellow, Green and Purple. An opponent creates a 4 colour code from these (using any or all of the colours) and starting on Row 1 you use the clues given by the opponent in trying to conclude what his code was.
Sounds easy? It can be if you know how to read the clues and turn them into answers. The only clues that are given are shown through the use of black and white pegs. A black peg means you guessed the colour correctly and in the right spot! And a white peg means that you guessed the colour correctly in that row, but not in the right spot. What makes it even more difficult is that the opponent won't tell you what peg represents what colour in the row, you have to work that out yourself :)

MasterMind for mIRC was first developed in early 2003 but was put off until over a year later. Now it's complete with the release of the Single Player portion of the game. The rules are exactly the same as in the regular boardgame except now you can choose how many rows you wish to play, from hard to a custom amount of lines; and the computer randomly picks a selection of colours for you to guess everytime.

Installation:

Unzip the entire contents to anywhere in your mIRC directory (or otherwise) and type the following command in mIRC:
	
	/load -rs mastermind.mrc

Or if you moved it to another directory:

	/load -rs c:\dir\to\mastermind.mrc

Or if you have no idea where you put it:

	//load -rs $findfile($mircdir,mastermind.mrc,1)

Once loaded, you can use any of the popups to load MasterMind, or just type /mm

You can also type /mm N where N is the number of rows you want to play (it defaults to 15 [Easy] anyway).

Usage:

The game can be very complicated at first, but it gets easier as you learn what the black/white pegs (BWP) mean and how to use them to your advantage.
You start with a clean board of rows this is where you guess the computer's colours. To the top right (and in the popups) are the colours you can play with, clicking these will change the colour in the 'Current Colour' box, remember you must click on the colour and not the black border surrounding it, or the white dot that is trying to make it look 3d :)
Once a colour is selected (Red is by default) you can now click on the light-gray playing circle in the first row (or any circle in that column), this will change the circle to that colour and is your first guessed colour. You repeat these steps on the following 3 circles. At anytime you want to change a colour that you've selected in a circle (but the last one selected) you just change the colour and reclick on it.
Once you've selected a row of colours the computer will then tell you how you did by showing either of the following:
	- 1 or more black pegs, this means you've guessed 1 or more colours in that row correctly and placed them in the right spot.
	- 1 or more white pegs, this indicates that you've guessed 1 or more colours correctly but didn't place them in the right spot.
	- A red cross, this means you got no colours correct or in the right spots in that row.
It takes some time to understand how to read these, but you'd get it after a while.
If you get 4 black pegs that means you've guessed the row correctly and you won! Next try and put the rows down a level and guess the code :)
If you run out of rows before you can guess it, you lose the game and will have to start a new one with a new colour code.

If you've got anymore questions about playing the game MasterMind, perhaps read the examples below, or contact be at zack@mircscripts.org, PMSG me on www.mircscripts.org, contact me online DALnet (#Scripting, #helpdesk, #help) or Undernet (#mircscripts, #mircscripts.org, #mircscripting), or find some tutorials on the internet by searching www.google.com.

Currently the Multiplayer part of the game is disabled and you won't be able to play it. It's currently under developement and much of the code which is a part of this addon is for the multiplayer section. I would have removed it, but all the aliases are intertwined for both sections and it's easier just to keep it there.

Examples:

Here I will show you some examples of outcomes when guessing colours for the people new at the game, first a key of what everything represents:
	
	R - Red
	B - Blue
	Pu - Purple
	Y - Yellow
	G - Green
	Pi - Pink
	BP - Black Peg
	WP - White Peg
	O - Empty Circle
	X - Red Cross

Now, say we have 6 rows to guess with, this is what the board will look like:

O  O  O  O
O  O  O  O
O  O  O  O
O  O  O  O
O  O  O  O
O  O  O  O

The first row being the bottom one, now the computer selects these colours R G Y Y (Red, Green, Yellow, Yellow), remember we don't actually know this throughout a real game. For our first guess, let's pick all Red's, so it'll look like this:

O  O  O  O
O  O  O  O
O  O  O  O
O  O  O  O
O  O  O  O
R  R  R  R - BP

What's this? The computer told us that we got 1 BP, so that means we got 1 Red in the correct position! Go us! Now let's guess the next row. Perhaps let's try and find some blue's now, but remember we know that there's 1 Red so we may as well include it in this next line.

O  O  O  O
O  O  O  O
O  O  O  O
O  O  O  O
B  B  B  R - WP
R  R  R  R - BP

We got a WP! Woo! Party! But we had a black peg before, what's going on? Let's analyse this (don't you just love logic). In the first row we deduced that there is 1 red in the colour code, in the second line we included the red and it was said to be in the wrong spot, but only 1 clue was returned. This must mean that there are no blues in the colour code and that in this line our red is in the wrong spot. Okay, onto the next line, Yellows? And let's include the Red, but put it into a different spot!

O  O  O  O
O  O  O  O
O  O  O  O
Y  Y  R  Y - BP WP WP
B  B  B  R - WP
R  R  R  R - BP

Wow! We got TWO white pegs this time! And one black peg! Go us! This is where it gets confusing, which pegs represent the black and which the whites? Could the red now be in the right position and yellows incorrect? Or is our red represented by a white peg and it's in the wrong position, and one yellow is correct and the other wrong? Argh! You can start pulling out your hair now! But at least we know that there is 1 red, and 2 yellows at least! So let's try and guess the final colour and move onto the next line. Let's try Green and keeping one of the current colours in the spot and moving the other two around.

O  O  O  O
O  O  O  O
G  R  Y  Y - BP BP WP WP
Y  Y  R  Y - BP WP WP
B  B  B  R - WP
R  R  R  R - BP

Well, at least we've guessed all the colours, just have to get them in the right order :) Now let's see... We have two black pegs, and two white pegs, that means two of the colours are in the right position and two are incorrect. There's not much to do here but guess, you could read the rows beforehand and see what colours have been used before but since we haven't used many there's not much that can be done there. For the next line next just mix them up and see what we get...

O  O  O  O
Y  Y  G  R - WP WP WP WP
G  R  Y  Y - BP BP WP WP
Y  Y  R  Y - BP WP WP
B  B  B  R - WP
R  R  R  R - BP

Um.. all white pegs? That means we mixed them up too much.. But wait a clue! We moved the two yellows totally out of position and now they're white pegs, so that MUST mean that they belong where they were in the last row! So that must mean that the green and red must be the wrong way around, could this be the result???

R  G  Y  Y - BP BP BP BP
Y  Y  G  R - WP WP WP WP
G  R  Y  Y - BP BP WP WP
Y  Y  R  Y - BP WP WP
B  B  B  R - WP
R  R  R  R - BP

Yay! Well done! We won! We got for black pegs! Now.. It's your turn :)

Credits:

myndzi - helping test and rewrite some parts to make it slightly quicker (and nearly getting me akilled, tsk tsk)
Petah - for testing and bug reports
sed, nimper, jarryd (and anyone else I sent it to) - for helping me test it and encouragement
commenters at ms.org ss section - for the suggestions, encouragement and comments
you - for downloading it :)

Version History:

2.01:
Public release, single player version. Multiplayer disabled.

2.00:
Single Player version, beta release. Totally rewritten from v1.00, but same graphics used.

1.00:
First developed version, graphics, code, etc.