Prebash Challenge - 2014 - Simon Says - Now Complete

In Memory of Ralph H. Baer - 1922-2014 - co-inventor of the "Simon" game.

This round is now complete!

Simon Says will be the challenge this time

• Simon Says: +17 score
• Resistor: +12 score
• Calculator: +11 score

Challenge completes when Winter Bash Starts - Happy Winter Bash Warmup!

Winterbash Starting!

Here are the questions posted in response to this challenge (oldest to newest - question/answer scores at challenge-close):

All of these were well received questions, and, to my count, have added +535 question rep, +90 accept rep, and +720 answer rep. A nice 1345 total rep.

Even though the official challenge is now over, you can still ask more, answer more, and vote more on all the posts.

Gentle reminders that some may find helpful:

1. do not fall victim to the 'get-it-done-fast' trap. There is no prize for the early entries, and there's almost 10 days to get it done. Frankly, if 10 days is not enough, then that's OK too, just post your code when you can. Along those lines, if any previous challenges inspire you, or you are reading this after this challenge is complete, then feel free to use 'old' ideas for inspiration too. The challenge 'window' is there only to synchronize the timing of participants so we can all discuss our progress.
2. there are no prizes at all... just good questions and good answers. The prize is the satisfaction, and reputation, that you earn.
3. the idea is to extend yourself in ways that you would not normally do. The challenge is just something a little inspiring, if your interest lies in only a part of it, then implement what inspires you. The advantage of the challenge here is that it gives you something in common with other people too. That makes it more fun (if that's your thing).
4. Come and chat about things in the 2nd monitor. These are called community challenges for a reason, they help form a community. Come and join another side of the Code Review community in chat.

WinterBash will be starting in 2 weeks. Let's put up a code-challenge to complete before that. Like previous challenges, this meta post is here to poll for a good challenge idea. Here's how this round will work:

2. Vote for those answers which interest you
3. At the end-of-day on Thursday, 4th December, the most-voted post will become the week challenge.

Once the challenge topic is decided, you can post questions on the main-site related to the challenge. The idea is to run the challenge all the way through to the start of WinterBash, which starts on the 15th Dec (I have been told).

Simon André Forsberg Says

Let's play a game of Simon Says! The older folks around here probably remember a game called Simon.

The Challenge

Create a UI with four colored buttons that light up in a random pattern. After displaying the pattern, the player must repeat the pattern by clicking the buttons in proper order. The pattern gets longer each time the player completes the pattern. If the player presses a wrong button, the game ends.

• Somehow I can't do anything else than up-vote this. – Simon Forsberg Dec 2 '14 at 18:14
• Updated the title @SimonAndréForsberg. – RubberDuck Dec 2 '14 at 18:34
• Okay this is it! Bonus imaginary points for an on-site playable implementation that leverages the JavaScript /Stack Snippets feature! – Mathieu Guindon Dec 4 '14 at 21:45
• That's what I had in mind when I suggested it. I'm hoping a javascript guru steps up to that challenge @Mat'sMug. – RubberDuck Dec 4 '14 at 21:46
• Might be worth noting that @SimonAndréForsberg likes interesting twists on his games (see the memory game and minesweeper), which probably could receive extra warm welcome ;-) – janos Dec 4 '14 at 22:07
• @janos I think I will have to try hard to come up with some nice twists on this one :) – Simon Forsberg Dec 5 '14 at 11:33
• Rest in peace, Mr. Ralph H. Baer – Edward Dec 8 '14 at 15:13

Resistor mania

In electronics, two resistors in series have a combined resistance $R_1+R_2$, and two resistors in parallel have combined resistance of $\displaystyle \frac{R_1 R_2}{R_1 + R_2}$. Given an infinite supply of $270\Omega$ resistors with $5\%$ tolerance, write a program to describe how to combine them into any arbitrary resistance value.

Bonus points for:

1. graphics (especially schematics)
2. using the minimum number of resistors
3. calculating the effective tolerance

This may help those not already familiar with the ideas: http://en.wikipedia.org/wiki/Series_and_parallel_circuits

• 256Ω Would be a nicer number. – Martin York Dec 4 '14 at 19:17
• @LokiAstari: It might be, but it would be unrealistic. 270Ω, 5% is a standard part. – Edward Dec 4 '14 at 19:18

Implement a simple calculator

Where the definition of "simple" is whatever you make it - only supports basic arithmetic operators? Fine. It supports scientific notation, exponents and trigonometry? Fine! Takes input from the console? Fine! Toggle between binary, hex, octal and decimal notations? Fine!

The common denominator here, is that you need:

• A way to take user input
• A way to parse/validate user input
• A way to perform the operations in the input
• A way to output the result(s)

Everything else you want to put in, is up to you and the time you can devote to this small project in the limited number of days we have until the hats come out of their boxes - be creative!

• Hmm... What if your language basically is a simple calculator? cough ruby cough – RubberDuck Dec 2 '14 at 23:00
• Then you vote for Simon Says! ;) – Mathieu Guindon Dec 2 '14 at 23:01
• @RubberDuck: There are a lot of languages that the equivalent of an eval() function that will execute arbitrary code in that language. So I think we can say that would be explicitly excluded. – Martin York Dec 4 '14 at 19:19