Skip to content

Resistor series # 2 : ResistorColors #1464

Closed

Description

@emcoding

The ResistorColor exercise is meant as the start of a series of resistor decoding exercises.
Here's number 2: the Resistor Significants exercise.

For this exercise, a given input represents the colors of the first 2 bands of a resistor, for instance ['brown', 'black'] and should return the combined number value 10.

This are real life examples of such color combinations:
image
translated to tests:

  • brown and black -> 10
  • orange and orange -> 33,
  • blue and grey -> 68
  • yellow and violet -> 47

About the naming:
The two first bands of resistors are also referenced to as 'significant figures'. The other bands have a different meaning (number of zeros, percentages).

Activity

  1. Smarticles101 commented on Feb 15, 2019

    @Smarticles101
    Member

    How many are planned for the series?

  2. emcoding commented on Feb 15, 2019

    @emcoding
    ContributorAuthor

    That's not decided. I added a link to the original post with the description of the series. 👍

  3. gabriel376 commented on Feb 17, 2019

    @gabriel376

    I was going to create this very same issue.
    I think the Resistor Color Problem is too simple and should contain series like real-world examples. I just solved it for Java and I am going to implement it for Python track (see exercism/python#1680)
    I don't think we should create a new Resistor Series Problem. Instead, we can add more cases to canonical data (and update test cases for all tracks).

  4. ErikSchierboom commented on Feb 17, 2019

    @ErikSchierboom
    Member

    Instead, we can add more cases to canonical data

    While I understand this sentiment, I don't think we should do this. Yes, the exercise is very simple, but that is also exactly its goal: to be a simple array exercise. If a track decides that it is too basic, they are of course free not to implement this exercise. For some tracks though, it might be the best array introduction exercise.

  5. gabriel376 commented on Feb 17, 2019

    @gabriel376

    Looking through this point of view, Resistor Color as a simple introduction to arrays, it does make sense to keep as it is and create additional exercises that explores more in-depth the use of arrays.

  6. emcoding commented on Feb 26, 2019

    @emcoding
    ContributorAuthor

    Katrina wrote:

    To be honest, I find this exercise really difficult to understand. I don't know anything about resistors, and reading through this I am having a bit of anxiety trying to get past the unfamiliar jargon to figure out what I actually would have to do to solve it.

    That's not good!! Thanks for catching that.

    It's my bad, because I utterly enjoy diving into domain specific language, and I like that in exercises too. (So, if we represent the polarities of the Exercism user in this regard, we may need to find a balance.)
    I can think of two different directions, one leaning on the resistor domain but un-technologize it, one totally moving out of it.

    If you would build anything with a Raspberry Pi or an Arduino, one of the first components you need are resistors. In this exercise, it doesn't matter what a resistor is or does, the only thing that matters here is that they come with different values. And that they are tiny. So tiny, that it's hard to read such a value if it were printed on the thing. To solve that, fabricators use color codes that reveals their value. Which is great, but it makes it hard to see the actual value.
    You are going to solve this with a program that you can feed two colors, and it will translate the color to a number. For instance "brown" and "black" are code for 1 and 0, and together they represent the value 10.
    The color codes are:
    ...

    OR
    2)
    Your client is a necklace designer who uses 10 colors of beads, that they use in pairs of 2. They want to keep track of all the color pairs they use in each design, but it's way too much work to write down all the colors all the time. So they use a 'color code', where each color has its own number.
    You write a program for them to quickly translate the colors to a number, such that 'orange' and 'orange' translates to '33'.
    The color codes are:
    ...

    Is this the direction you're thinking @kytrinyx ?

  7. kytrinyx commented on Feb 26, 2019

    @kytrinyx
    Member

    In this exercise, it doesn't matter what a resistor is or does, the only thing that matters here is that they come with different values. And that they are tiny. So tiny, that it's hard to read such a value if it were printed on the thing.

    I love it. This would actually totally solve the problem for me.

    I think... let's use your new description for now, and we can think about more storifying later!

  8. emcoding commented on Feb 26, 2019

    @emcoding
    ContributorAuthor

    Cool! Thanks

  9. pgaspar commented on Feb 26, 2019

    @pgaspar
    Member

    Also appreciate the less technical description! 🙌

  10. rpottsoh commented on Feb 27, 2019

    @rpottsoh
    Member

    I like one. I don't like two.

    While one is less technical it is still accurate and is still relateable to a real life situation 👍 . Two feels too contrived. Why does it matter that orange and orange is 33 in relation to beads? In terms of resistors, from one I don't know what 33 means either, but I know we are talking about resistors so 33 has something to do with the characteristics of a resistor. I don't get any sense how 33 is a characteristic of a couple of beads in two...

    My opinion may also be biased (pun intended, resistor humor) since I know what resistors are.

  11. changed the title [-]Resistor series # 2 : ResistorSignificants[/-] [+]Resistor series # 2 : ResistorColors[/+] on Mar 10, 2019
  12. vinc86 commented on Jul 23, 2020

    @vinc86

    still the instructions on exercism are not really clear for me. It's not specified that should be an "array" what you have to pass as an argument

  13. rpottsoh commented on Jul 23, 2020

    @rpottsoh
    Member

    @vin86, assuming you are attempting to write a solution on a track that has implemented this exercise, you should look at the test suite provided to determine the nature of the input that is expected.

    If you are trying to implement this exercise on a track that currently doesn't offer it then you are welcome to utilize whatever method makes the best sense for the language you are implementing and reviewing how other tracks have implemented the exercise is a good way get started.

  14. zeektvbox01-hub commented on Sep 7, 2026

    @zeektvbox01-hub

    Can we have a 4th exercise on this which talks about 6 resistors?

  15. IsaacG commented on Sep 7, 2026

    @IsaacG
    Member

    Can we have a 4th exercise on this which talks about 6 resistors?

    You can propose new exercises via the forum.

    https://forum.exercism.org/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions