Example #1
0
    //Method used to generate the base events
    protected override void generateEvents()
    {
        int i = 0;

        ordered = new List <ImplicitEvent>();

        //Generate ordered list
        for (i = 0; i < 7; i++)
        {
            ImplicitEvent e = null;

            e = new ImplicitEvent((int)((i % 4f) + 1), 2);

            ordered.Add(e);
        }
        random = new List <ImplicitEvent>();
        //Generate random events
        for (i = 0; i < 105; i++)
        {
            ImplicitEvent e = null;

            e = new ImplicitEvent((int)((i % 4f) + 1), (int)(Mathf.FloorToInt(i / 35f) + 1));

            random.Add(e);
        }
    }
Example #2
0
    //Method used to generate the base events
    protected override void generateEvents()
    {
        int i=0;

        ordered = new List<ImplicitEvent>();

        //Generate ordered list
        for(i=0;i<7;i++){
            ImplicitEvent e=null;

            e = new ImplicitEvent((int)((i%4f) + 1),2);

            ordered.Add(e);
        }
        random = new List<ImplicitEvent>();
        //Generate random events
        for(i=0;i<105;i++){

            ImplicitEvent e=null;

            e = new ImplicitEvent((int)((i%4f) + 1),(int)(Mathf.FloorToInt(i/35f) + 1));

            random.Add(e);
        }
    }
Example #3
0
    //Method used to randomize the order of the list of events
    protected override void randomizeEvents()
    {
        System.Random rand = new System.Random();

        int i = 0;

        //Add base randomiztion to ordered list
        for(i=0;i<ordered.Count;i++){
            ImplicitEvent originalStats = ordered[i];

            int spotToMove = rand.Next(i,ordered.Count);

            ordered[i] = ordered[spotToMove];

            ordered[spotToMove] = originalStats;
        }

        int s =0;

        for(i = 0; i< 28;i++){
            ImplicitEvent iE = new ImplicitEvent(ordered[s].Dot, 1);

            ordered.Add(iE);

            s++;

            if(s>=7) s=0;
        }

        for(i=0;i<random.Count;i++){
            ImplicitEvent originalStats = random[i];

            int spotToMove = rand.Next(i,random.Count);

            random[i] = random[spotToMove];

            random[spotToMove] = originalStats;
        }

        bool ok=true;
        bool eventGood;

        int cycleCount = 0;

        cycleCount = 0;
        ok=true;

        //Randomize the random
        do{
            ok=true;

            for(i=2; i <random.Count;i++){

                eventGood = true;

                if(random[i].Dot == random[i-1].Dot
                    && random[i].Dot == random[i-2].Dot)
                    eventGood=false;

                //If there are three in a row, find another element that has a different color and swap the two
                if(!eventGood){
                    ok = false;

                    int start = i+1;
                    if(start>=random.Count) start = 0;

                    for(int j =i+1;j<random.Count;j++){
                        eventGood=true;
                        if(random[j].Dot == random[i].Dot)
                            eventGood=false;

                        if(eventGood){

                            ImplicitEvent originalStats = random[i];

                            random[i] = random[j];

                            random[j] = originalStats;

                            break;
                        }
                        else if(j>=random.Count) j=0;
                    }
                }
            }
            cycleCount++;
            //Attempt 5 loops to fix any bad instances, after 5th proceed anyway
            if(cycleCount>5)ok=true;
        }while(!ok);

        events = new List<EventStats>();

        for(i = 0; i <35; i++){
            random[i].BlockNum = 1;
            events.Add(random[i]);
        }
        for(i = 0; i <ordered.Count; i++){
            ImplicitEvent iE = new ImplicitEvent(ordered[i].Dot, 2);
            events.Add(iE);
        }
        for(i = 0; i <ordered.Count; i++){
            ImplicitEvent iE = new ImplicitEvent(ordered[i].Dot, 3);
            events.Add(iE);
        }
        for(i = 35; i <70; i++){
            random[i].BlockNum = 4;
            events.Add(random[i]);
        }
        for(i = 0; i <ordered.Count; i++){
            ImplicitEvent iE = new ImplicitEvent(ordered[i].Dot, 5);
            events.Add(iE);
        }
        for(i = 70; i <105; i++){
            random[i].BlockNum = 6;
            events.Add(random[i]);
        }
    }
Example #4
0
    //Method used to randomize the order of the list of events
    protected override void randomizeEvents()
    {
        System.Random rand = new System.Random();

        int i = 0;

        //Add base randomiztion to ordered list
        for (i = 0; i < ordered.Count; i++)
        {
            ImplicitEvent originalStats = ordered[i];

            int spotToMove = rand.Next(i, ordered.Count);

            ordered[i] = ordered[spotToMove];

            ordered[spotToMove] = originalStats;
        }

        int s = 0;

        for (i = 0; i < 28; i++)
        {
            ImplicitEvent iE = new ImplicitEvent(ordered[s].Dot, 1);

            ordered.Add(iE);

            s++;

            if (s >= 7)
            {
                s = 0;
            }
        }

        for (i = 0; i < random.Count; i++)
        {
            ImplicitEvent originalStats = random[i];

            int spotToMove = rand.Next(i, random.Count);

            random[i] = random[spotToMove];

            random[spotToMove] = originalStats;
        }

        bool ok = true;
        bool eventGood;

        int cycleCount = 0;

        cycleCount = 0;
        ok         = true;

        //Randomize the random
        do
        {
            ok = true;

            for (i = 2; i < random.Count; i++)
            {
                eventGood = true;

                if (random[i].Dot == random[i - 1].Dot &&
                    random[i].Dot == random[i - 2].Dot)
                {
                    eventGood = false;
                }

                //If there are three in a row, find another element that has a different color and swap the two
                if (!eventGood)
                {
                    ok = false;

                    int start = i + 1;
                    if (start >= random.Count)
                    {
                        start = 0;
                    }

                    for (int j = i + 1; j < random.Count; j++)
                    {
                        eventGood = true;
                        if (random[j].Dot == random[i].Dot)
                        {
                            eventGood = false;
                        }

                        if (eventGood)
                        {
                            ImplicitEvent originalStats = random[i];

                            random[i] = random[j];

                            random[j] = originalStats;

                            break;
                        }
                        else if (j >= random.Count)
                        {
                            j = 0;
                        }
                    }
                }
            }
            cycleCount++;
            //Attempt 5 loops to fix any bad instances, after 5th proceed anyway
            if (cycleCount > 5)
            {
                ok = true;
            }
        }while(!ok);

        events = new List <EventStats>();

        for (i = 0; i < 35; i++)
        {
            random[i].BlockNum = 1;
            events.Add(random[i]);
        }
        for (i = 0; i < ordered.Count; i++)
        {
            ImplicitEvent iE = new ImplicitEvent(ordered[i].Dot, 2);
            events.Add(iE);
        }
        for (i = 0; i < ordered.Count; i++)
        {
            ImplicitEvent iE = new ImplicitEvent(ordered[i].Dot, 3);
            events.Add(iE);
        }
        for (i = 35; i < 70; i++)
        {
            random[i].BlockNum = 4;
            events.Add(random[i]);
        }
        for (i = 0; i < ordered.Count; i++)
        {
            ImplicitEvent iE = new ImplicitEvent(ordered[i].Dot, 5);
            events.Add(iE);
        }
        for (i = 70; i < 105; i++)
        {
            random[i].BlockNum = 6;
            events.Add(random[i]);
        }
    }