Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function split(v:Int, ?subdivide:Int = 2, ?splitones:Bool = true):Array<Int>{
- if (subdivide == 6){
- if (v == 6){
- return [1, 1, 1, 1, 1, 1];
- }
- if(splitones){
- return [1, 1, 1, 1, 1, 1];
- }else{
- if (v == 5) return [1, 1, 1, 1, 1];
- if (v == 4) return [1, 1, 1, 1];
- if (v == 3) return [1, 1, 1];
- if (v == 2) return [1, 1];
- if (v == 1) return [1];
- }
- }else if (subdivide == 5){
- if (v == 6){
- return Random.pick([
- [1, 1, 1, 1, 2],
- [1, 1, 1, 2, 1],
- [1, 1, 2, 1, 1],
- [1, 2, 1, 1, 1],
- [2, 1, 1, 1, 1]
- ]);
- }else if (v == 5){
- return [1, 1, 1, 1, 1];
- }
- if(splitones){
- return [1, 1, 1, 1, 1];
- }else{
- if (v == 4) return [1, 1, 1, 1];
- if (v == 3) return [1, 1, 1];
- if (v == 2) return [1, 1];
- if (v == 1) return [1];
- }
- }else if (subdivide == 4){
- if (v == 6){
- return Random.pick([
- [1, 1, 1, 3], [1, 1, 2, 2], [1, 1, 3, 1], [1, 2, 1, 2], [1, 2, 2, 1],
- [2, 1, 1, 2], [2, 1, 2, 1], [2, 2, 1, 1],
- [3, 1, 1, 1]
- ]);
- }else if (v == 5){
- return Random.pick([
- [2, 1, 1, 1], [1, 2, 1, 1], [1, 1, 2, 1], [1, 1, 1, 2]
- ]);
- }else if (v == 4){
- return [1, 1, 1, 1];
- }
- if(splitones){
- return [1, 1, 1, 1];
- }else{
- if (v == 3) return [1, 1, 1];
- if (v == 2) return [1, 1];
- if (v == 1) return [1];
- }
- }else if (subdivide == 3){
- if (v == 6){
- return Random.pick([
- [1, 1, 4], [1, 2, 3], [1, 3, 2], [1, 4, 1], [2, 1, 3], [2, 2, 2], [2, 3, 1], [3, 1, 2], [3, 2, 1], [4, 1, 1]
- ]);
- }else if (v == 5){
- return Random.pick([
- [1, 1, 3], [1, 2, 2], [1, 3, 1], [2, 1, 2], [2, 2, 1], [3, 1, 1]
- ]);
- }else if (v == 4){
- return Random.pick([
- [1, 1, 2], [1, 2, 1], [2, 1, 1]
- ]);
- }else if (v == 3){
- return [1, 1, 1];
- }
- if(splitones){
- return [1, 1, 1];
- }else{
- if (v == 2) return [1, 1];
- if (v == 1) return [1];
- }
- }else if (subdivide == 2){
- if (v == 6){
- return Random.pick([
- [1, 5], [2, 4], [3, 3], [4, 2], [5, 1]
- ]);
- }else if (v == 5){
- return Random.pick([
- [1, 4], [2, 3], [3, 2], [4, 1]
- ]);
- }else if (v == 4){
- return Random.pick([
- [1, 3], [2, 2], [3, 1]
- ]);
- }else if (v == 3){
- return Random.pick([
- [2, 1], [1, 2]
- ]);
- }else if (v == 2){
- return [1, 1];
- }
- if (splitones){
- return [1, 1];
- }
- return [1];
- }else if (subdivide == 1){
- return [v];
- }
- return [v];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement