Exemplo n.º 1
0
        public static NodeCollection Calculate (Beat beat, int distance_from_start) {
            if (beat.isEmpty()) {
                throw new ArgumentException();
            }
            NodeCollection result = new NodeCollection(beat);
            List<Node> items = result.items;
            int any_tap_count = beat.getAnyTapCount();
            List<int> any_tap_indices = beat.getIndices(TapType.Force, TapType.PassiveBegin, TapType.PassiveStay, TapType.PassiveEnd);

            if (any_tap_count == 1) {
                Panel a = Panel.Panels_1D_Playable[any_tap_indices[0]];
                Node1Calculator.Calculate1(items, beat, distance_from_start, a);
            } else if (any_tap_count == 2) {
                Panel a = Panel.Panels_1D_Playable[any_tap_indices[0]];
                Panel b = Panel.Panels_1D_Playable[any_tap_indices[1]];

                Node2Calculator.Calculate11(items, beat, distance_from_start, a, b);
                Node2Calculator.Calculate2(items, beat, distance_from_start, a, b);
            } else if (any_tap_count == 3) {
                Panel a = Panel.Panels_1D_Playable[any_tap_indices[0]];
                Panel b = Panel.Panels_1D_Playable[any_tap_indices[1]];
                Panel c = Panel.Panels_1D_Playable[any_tap_indices[2]];

                //3
                Node3Calculator.Calculate3(items, beat, distance_from_start, a, b, c);
                //21
                Node3Calculator.Calculate21(items, beat, distance_from_start, a, b, c);
                Node3Calculator.Calculate21(items, beat, distance_from_start, a, c, b);

                Node3Calculator.Calculate21(items, beat, distance_from_start, b, c, a);

                if (items.Count == 0) {
                    throw new NotImplementedException();
                }
            } else if (any_tap_count == 4) {
                Panel a = Panel.Panels_1D_Playable[any_tap_indices[0]];
                Panel b = Panel.Panels_1D_Playable[any_tap_indices[1]];
                Panel c = Panel.Panels_1D_Playable[any_tap_indices[2]];
                Panel d = Panel.Panels_1D_Playable[any_tap_indices[3]];

                //31
                Node4Calculator.Calculate31(items, beat, distance_from_start, a, b, c, d);
                Node4Calculator.Calculate31(items, beat, distance_from_start, b, c, d, a);
                Node4Calculator.Calculate31(items, beat, distance_from_start, c, d, a, b);
                Node4Calculator.Calculate31(items, beat, distance_from_start, d, a, b, c);
                //22
                Node4Calculator.Calculate22(items, beat, distance_from_start, a, b, c, d);
                Node4Calculator.Calculate22(items, beat, distance_from_start, a, c, d, b);
                Node4Calculator.Calculate22(items, beat, distance_from_start, a, d, b, c);

                Node4Calculator.Calculate22(items, beat, distance_from_start, b, c, d, a);
                Node4Calculator.Calculate22(items, beat, distance_from_start, b, d, a, c);

                Node4Calculator.Calculate22(items, beat, distance_from_start, c, d, a, b);

                if (items.Count == 0) {
                    throw new NotImplementedException();
                }
            } else if (any_tap_count == 5) {
                Panel a = Panel.Panels_1D_Playable[any_tap_indices[0]];
                Panel b = Panel.Panels_1D_Playable[any_tap_indices[1]];
                Panel c = Panel.Panels_1D_Playable[any_tap_indices[2]];
                Panel d = Panel.Panels_1D_Playable[any_tap_indices[3]];
                Panel e = Panel.Panels_1D_Playable[any_tap_indices[4]];

                Node5Calculator.Calculate32(items, beat, distance_from_start, a, b, c, d, e);
                Node5Calculator.Calculate32(items, beat, distance_from_start, a, b, d, e, c);
                Node5Calculator.Calculate32(items, beat, distance_from_start, a, b, e, c, d);

                Node5Calculator.Calculate32(items, beat, distance_from_start, a, c, d, e, b);
                Node5Calculator.Calculate32(items, beat, distance_from_start, a, c, e, b, d);

                Node5Calculator.Calculate32(items, beat, distance_from_start, a, d, e, b, c);

                Node5Calculator.Calculate32(items, beat, distance_from_start, b, c, d, e, a);
                Node5Calculator.Calculate32(items, beat, distance_from_start, b, c, e, a, d);

                Node5Calculator.Calculate32(items, beat, distance_from_start, b, d, e, a, c);

                Node5Calculator.Calculate32(items, beat, distance_from_start, c, d, e, a, b);

                if (items.Count == 0) {
                    throw new NotImplementedException();
                }
            } else if (any_tap_count == 6) {
                Panel a = Panel.Panels_1D_Playable[any_tap_indices[0]];
                Panel b = Panel.Panels_1D_Playable[any_tap_indices[1]];
                Panel c = Panel.Panels_1D_Playable[any_tap_indices[2]];
                Panel d = Panel.Panels_1D_Playable[any_tap_indices[3]];
                Panel e = Panel.Panels_1D_Playable[any_tap_indices[4]];
                Panel f = Panel.Panels_1D_Playable[any_tap_indices[5]];

                Node6Calculator.Calculate33(items, beat, distance_from_start, a, b, c, d, e, f);
                Node6Calculator.Calculate33(items, beat, distance_from_start, d, e, f, a, b, c);

                if (items.Count == 0) {
                    throw new NotImplementedException();
                }
            } else {
                throw new NotImplementedException();
            }

            if (items.Count == 0) {
                throw new ExecutionEngineException();
            }
            return result;
        }