switch()

Chris Cain clcain at uncg.edu
Mon Feb 17 04:38:39 PST 2014


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?

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.


More information about the Digitalmars-d mailing list