There are two players- the code setter and the code breaker. The code setter picks 4 pegs from 6 colors and arranges them in order. The pegs are colored red, blue, yellow, green, white and orange. Any combination including duplicates is allowed eg RBWO or RRRG etc.
The code breaker has to guess what the color and order of the pegs are. The guess is marked by the code maker who provides a red for every peg of the right color in the right place, and a white for a correct color in the wrong place. The code breaker keeps guessing until they guess correctly or hasn't guessed it in 10 guesses. In the challenge your application gets 15 guesses.
Your mission is to write an application in C, C++ or C# that will play as the code breaker. A Windows dll has been written in C that you download, and is called by your application. The dll generates a code and then scores your application's guesses. You start with a score of ten and every guess reduces the score by 1.
- Download Compiled dll. (
- Download dll Source Code so you can see what it does.
- Download C/C++ Test Program Source Code Use this as the skeleton of your C or C++ Application.
- Download C# Test Program Source Code Use this as the skeleton of your C# Application.
The Results
We had five entrants, congratulations to Andre who just pipped Lucas and Thomas.- Andre Prata (Portugal age 19) 18 Points C++.
- Lucas Pimentel (Dominican Republic age 28) 17 Points C#.
- Thomas Ince (USA age 30) 15 Points C++.
- Ankit Agarwal (India age 24) 5 Points C#.
- David Kline -15 Points C (Didn't solve the problem).
Well done to everyone who entered- There was a fair amount of code in that challenge!
More Programming Challenges
- Link to Rock, Scissors and Paper Bot Ongoing Programming Challenge - Runs weekly until 2008.
- Link to Programming Challenge 1 - Completed
- Link to Programming Challenge 2 - Completed
- Link to Programming Challenge 3 - Completed
- Link to Programming Challenge 5 - Completed.
- Link to Programming Challenge 6 - Search a Linked List Fast- Completed
- Link to Programming Challenge 7 - Validate Chess Positions - (Deadline December 31 2007)
- Link to Programming Challenge 8 - Score Texas Holdem Poker Hands - (Deadline January 31 2008)

