switch()

Manu turkeyman at gmail.com
Mon Feb 17 06:20:48 PST 2014


On 17 February 2014 22:38, Chris Cain <clcain at uncg.edu> wrote:

> On Monday, 17 February 2014 at 04:00:08 UTC, Manu wrote:
>
>> Of course, I'd just write the above as:
>>
>>>
>>> int difficulty = e.note.note.between(60,108) ? (e.note.note-60)/12 : -1;
>>>
>>>
>> Yes yes, very clever. Obviously it's an example and could come in any
>> shape
>> or form.
>> Personally, I also wouldn't do that anyway; basic readability has
>> definitely been lost.
>>
>
>
> I know I'm weird here, but I disagree. I had no idea what you were doing
> at the beginning of the topic, but that one line revealed to me that this
> is likely related to the music game thing you proposed awhile ago. I can't
> really explain why "note" was insufficient before to reveal that, but once
> I saw "12" explicitly on its own I immediately thought ~"12 ... semitones
> ... octaves ... note ... it's music ... he was working on a music game ...
> he came up with this while working on the music game".
>
> So, it's classifying difficulty based on which octave a note is for your
> music game?
>

I'm dealing with arbitrary values as appearing in midi files.
There is a relationship that you made, kind of... but it's incidental. It's
actually an abuse of the structure of a midi file to relate concepts to
octaves; designers use the separation of octaves in midi composition
software to separate some arbitrary data, because octaves often provide
good visual separation in editors, making it easier to visualise the data
they're authoring.
It's also just the one that was on my screen when I cut and pasted. There
are lots of others that lead me to consider this as a frequently recurring
pattern and become annoyed that my code was was uniformly ugly.


Of course, I might be wrong here. It just seems to me that the reducing of
> information made it clearer what the purpose is disregarding the other
> contextual information that probably exists outside of what you're trying
> to show us.
>

The purpose is kinda unrelated conceptually. In reality, what has happened
is that you have become confused.
You were searching for reason where there is none, and the algorithmic
expression lead you to a false conclusion :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140218/bf311f48/attachment-0001.html>


More information about the Digitalmars-d mailing list