I'm writing an ear training app for Android and don't really know how to get my app flowing. I have a class, Player, which is a user class, which stores which level you are on in which exercise.
And in my Intervals activity I want to use different methods depending on which level the user is at. I thought a bout a switch statement, if level 1 use first method, level 2 second method. But I'm also mixing it up with random methods, and here's where it gets complex.
I have these methods:
playIntervalUp(int interval) //plays given interval upwards
playIntervalDown(int interval) // plays given interval downwards
generateRandom(int interval) //Sets a local generated value, accessible from whole activity.
The order I'm trying to program these methods is. The number are the users level.
- 10 x playIntervalUp(major or minor second) //randomly generated
- 10 x playIntervalDown(major or minor second) //randomly generated
- 10 x playIntervalDown() or playIntervalUp() //random intervals, seconds (up/down)
- 10 x playIntervalDown()/playIntervalUp() // random intervals, seconds(up/down) and fourths(up)
- 10 x playIntervalDown()/playIntervalUp() // random intervals, seconds(up/down) and fourths(up/down)
- ...
I think you get the point. I want to introduce new intervals but still use the old ones, and sometimes only new intervals then adding old ones. I can think of one way to do this, through switch statements within switch statements and generateRandom() but it's feels messy and to nested.
Any ideas on how to solve this, is there a simple way to have some kind of flowchart or maybe restructure my whole code better? All ideas are welcome :)
Aucun commentaire:
Enregistrer un commentaire