Mastermind Game1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Problem Descriptions

Hidden from
code-breaker
c1-c2-c3-c4
In the game of Mastermind, your
job as the “code-breaker” is to
deduce a hidden configuration of
4 coloured pegs ("the solution")
chosen by another person (the
“code-maker”), by making
guesses at it. The pegs come in
six different colours.
For the purposes of argument,
Green=1, Red=2, Black=3,
Blue=4, Yellow=5, White=6.
Problem Descriptions
Hidden from
code-breaker
c1-c2-c3-c4 After each guess is played, the code-
maker 'marks' the guess, using some
smaller, slimmer black and white
pegs, which is called "markers". A
black marker tells you that one of
your pegs (but you don't know which
one) is the right colour and in the right
position. A white marker tells you that
one of your pegs (again you don't
know which one) is of a colour which
is in the solution, but it's in the wrong
position.
The player is given ten guesses to try
to find the solution.
Basic Configuration
Computer

Code-maker Code-breaker

Team 1
Change role

Team 2

• During the match, each team will play against another team via
EMU8086 emulator.
• Each team will take turn to play as code-maker and code-breaker.
• E.g. Game 1: Team 1  code-maker, Team 2  code-breaker
Game 2: Team 1  code-breaker, Team 2  code-maker
“Code-maker”
Start

E.g. „12‟, „44‟ represents Generate codes in 2 Select 4-coloured pegs (should be
Green-Red-Blue-Blue bytes format as random as possible)

Set Line = 1

Received 2 bytes: “PQ”=c1-c2


Wait for „PQ‟, „RS‟ “RS”=c3-c4

• The secret codes should be codes


“X”=#black
shown to ensure that correct Reply Hints ‘XY’
hints are given “Y”=#white
• The code-maker should also
include an interface to allow
the user to enter the codes
and show each line of codes Yes Line=10 or
(colors) attempted by the user
‘XY’=‘40’? No, continue
as well as the hints given. Game
• The interface can be either End (Line++)
over
text-based or graphic-based.
“Code-breaker”
Start

Set Line=1
Initialization Generate the first set of codes
E.g. „12‟, „34‟ for
“X”=#black
Green-Red-Black-Blue
“Y”=#white
Received 1byte:
Yes „XY‟
Wait for
‘XY’=‘40’?
hints

No No, continue
(Line++)
Reply 4-coloured pegs Line=10 ?
(guess) in 2 bytes format • The code-breaker should
be able to accept the hints
E.g. „34‟, „56‟ represents Yes from the user, generates
Black-Blue-Yellow-White and shows the codes (next
End guess) based on the given
hints.
Assembly Language Programming
 Program flowchart must be included in the report,
but not the program listing
 A disk (CD/DVD) with complete source codes
(*.asm) must be submitted together with the report
 During the development stage, you may use
EMU8086 emulator to verify your program
 There should be two separate programs, namely:
1. Code-maker
2. Code-breaker
Mastermind Matches Rules #1
 Your opponent will be announced during the match day.
 Each match consists of 2 games. Each team will change
between the „code-maker‟ and „code-breaker‟.
 For e.g., Team 1  code-maker, Team 2  code-
breaker.
i. Team 1 runs the code-maker, Team 2 runs the code-breaker.
ii. Team 2 enters the codes generated by the code-breaker into Team 1‟s
code-maker.
iii. Team 1‟s code-maker generates the hints and Team 2 enters the hints into
their code-breaker.
iv. Based on the hints given, Team 2‟s code-breaker generates the next set of
codes.
v. Steps (ii) to (iv) are repeated until the codes have been broken or 10
guesses have been attempted
 The „code-maker‟ will be awarded 1 point for every
unsuccessful guess from the „code-breaker‟. e.g., if the
„code-breaker‟ takes 7 steps to get the right answer, then
MasterMind Matches Rules #2
 Winner will be determined based on the points accumulated.
For example, if
Team 1 vs. Team 2
P1 as code-maker 6 points (takes 7 steps)
P2 as code-maker (takes 5 steps) 4 points
(6-4)  Team WIN !!!

 Rematch will be conducted in the case of „draw‟


 The winner will enter next round of the tournament
 In case of draw for 3 times even after the rematch is
conducted, the
lecturer will check the programs/algorithm and decide the
winner.
 The decision is final.
Matches Marks
 Matches marks:
Winner (1) +1
Final (2) +1

Semifinal (4) +1
Quarterfinal (8) +1

Preliminary (16) +1

• 1 mark will be given to the team that participates in the matches.


• Each team that successfully proceed to the next round will earn
1 extra mark for the matches.
• For example, if you manage to enter semifinal,
match marks = 1 + 1 + 1 = 3 marks.

You might also like