<commit_before>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Diagnostics;
using System.IO;

namespace kagv {

    public partial class main_form {
        private void animator(int counter, int agv_index) {

            int stepx = Convert.ToInt32(AGVs[agv_index].Steps[0, counter]);
            int stepy = Convert.ToInt32(AGVs[agv_index].Steps[1, counter]);

            if (stepx == 0 || stepx == 0)
                return;

            bool isfreeload = false;
            bool halted = false;
            displayStepsToLoad(counter, agv_index);

            //RULES OF WHICH AGV WILL STOP WILL BE ADDED
            for (int i = 0; i < nUD_AGVs.Value; i++) {

                if (agv_index != i
                    && AGVs[i].GetLocation() != new Point(0, 0)//i dont like that much tho
                    && AGVs[agv_index].GetLocation() == AGVs[i].GetLocation()
                    && AGVs[agv_index].GetLocation() != endPointCoords
                    ) {

                    halt(agv_index, counter);
                    halted = true;
                } else {
                    if (!halted)
                        AGVs[agv_index].SetLocation(stepx - 9, stepy - 9);
                }

            }


            if (markedbyagv[agv_index].X * 20 == AGVs[agv_index].GetLocation().X &&
                (markedbyagv[agv_index].Y * 20) + topBarOffset == AGVs[agv_index].GetLocation().Y &&
                !AGVs[agv_index].isBusy()) {

                m_rectangles[markedbyagv[agv_index].X][markedbyagv[agv_index].Y].SwitchLoad();
                AGVs[agv_index].Busy(true);
                AGVs[agv_index].setLoaded();
                if (fromstart[agv_index]) {
                    loads--;
                    isLoad[markedbyagv[agv_index].X, markedbyagv[agv_index].Y] = 2;

                    fromstart[agv_index] = false;
                }
            }

            if (!fromstart[agv_index]) {
                if (AGVs[agv_index].GetLocation().X == m_rectangles[endPointCoords.X / 20][(endPointCoords.Y - topBarOffset) / 20].x &&
                    AGVs[agv_index].GetLocation().Y == m_rectangles[endPointCoords.X / 20][(endPointCoords.Y - topBarOffset) / 20].y) {


                    AGVs[agv_index].Busy(false);

                    for (int k = 0; k < width; k++) {
                        for (int b = 0; b < height; b++) {
                            if (isLoad[k, b] == 1)
                                isfreeload = true;
                        }
                    }

                    if (loads > 0 && isfreeload) {

                        Reset(agv_index);
                        AGVs[agv_index].Busy(true);
                        markedbyagv[agv_index] = new Point();
                        System.Threading.Tasks.Task _thread = new System.Threading.Tasks.Task(() => {
                            getNextLoad(agv_index);
                        });

                        _thread.Start();
                        _thread.Wait();

                        AGVs[agv_index].Busy(false);
                        AGVs[agv_index].setEmpty();

                    } else {
                        AGVs[agv_index].setEmpty();
                        isfreeload = false;

                        switch (agv_index) {
                            case 0:
                                timer1.Stop();
                                agv1steps_LB.Text = "AGV 1: Finished";
                                break;
                            case 1:
                                timer2.Stop();
                                agv2steps_LB.Text = "AGV 2: Finished";
                                break;
                            case 2:
                                timer3.Stop();
                                agv3steps_LB.Text = "AGV 3: Finished";
                                break;
                            case 3:
                                timer4.Stop();
                                agv4steps_LB.Text = "AGV 4: Finished";
                                break;
                            case 4:
                                timer5.Stop();
                                agv5steps_LB.Text = "AGV 5: Finished";
                                break;
                        }

                    }

                    timer_counter[agv_index] = -1;
                    counter = 0;

                }
            } else {
                if (isLoad[markedbyagv[agv_index].X, markedbyagv[agv_index].Y] == 2)
                    if (AGVs[agv_index].GetLocation().X == m_rectangles[endPointCoords.X / 20][(endPointCoords.Y - topBarOffset) / 20].x &&<commit_msg>functions.cs:  inside Animator(): changed name of incoming parameter<commit_after>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Diagnostics;
using System.IO;

namespace kagv {

    public partial class main_form {
        private void animator(int steps_counter, int agv_index) {

            int stepx = Convert.ToInt32(AGVs[agv_index].Steps[0, steps_counter]);
            int stepy = Convert.ToInt32(AGVs[agv_index].Steps[1, steps_counter]);

            if (stepx == 0 || stepx == 0)
                return;

            bool isfreeload = false;
            bool halted = false;
            displayStepsToLoad(steps_counter, agv_index);

            //RULES OF WHICH AGV WILL STOP WILL BE ADDED
            for (int i = 0; i < nUD_AGVs.Value; i++) {

                if (agv_index != i
                    && AGVs[i].GetLocation() != new Point(0, 0)//i dont like that much tho
                    && AGVs[agv_index].GetLocation() == AGVs[i].GetLocation()
                    && AGVs[agv_index].GetLocation() != endPointCoords
                    ) {

                        halt(agv_index, steps_counter);
                    halted = true;
                } else {
                    if (!halted)
                        AGVs[agv_index].SetLocation(stepx - 9, stepy - 9);
                }

            }


            if (markedbyagv[agv_index].X * 20 == AGVs[agv_index].GetLocation().X &&
                (markedbyagv[agv_index].Y * 20) + topBarOffset == AGVs[agv_index].GetLocation().Y &&
                !AGVs[agv_index].isBusy()) {

                m_rectangles[markedbyagv[agv_index].X][markedbyagv[agv_index].Y].SwitchLoad();
                AGVs[agv_index].Busy(true);
                AGVs[agv_index].setLoaded();
                if (fromstart[agv_index]) {
                    loads--;
                    isLoad[markedbyagv[agv_index].X, markedbyagv[agv_index].Y] = 2;

                    fromstart[agv_index] = false;
                }
            }

            if (!fromstart[agv_index]) {
                if (AGVs[agv_index].GetLocation().X == m_rectangles[endPointCoords.X / 20][(endPointCoords.Y - topBarOffset) / 20].x &&
                    AGVs[agv_index].GetLocation().Y == m_rectangles[endPointCoords.X / 20][(endPointCoords.Y - topBarOffset) / 20].y) {


                    AGVs[agv_index].Busy(false);

                    for (int k = 0; k < width; k++) {
                        for (int b = 0; b < height; b++) {
                            if (isLoad[k, b] == 1)
                                isfreeload = true;
                        }
                    }

                    if (loads > 0 && isfreeload) {

                        Reset(agv_index);
                        AGVs[agv_index].Busy(true);
                        markedbyagv[agv_index] = new Point();
                        System.Threading.Tasks.Task _thread = new System.Threading.Tasks.Task(() => {
                            getNextLoad(agv_index);
                        });

                        _thread.Start();
                        _thread.Wait();

                        AGVs[agv_index].Busy(false);
                        AGVs[agv_index].setEmpty();

                    } else {
                        AGVs[agv_index].setEmpty();
                        isfreeload = false;

                        switch (agv_index) {
                            case 0:
                                timer1.Stop();
                                agv1steps_LB.Text = "AGV 1: Finished";
                                break;
                            case 1:
                                timer2.Stop();
                                agv2steps_LB.Text = "AGV 2: Finished";
                                break;
                            case 2:
                                timer3.Stop();
                                agv3steps_LB.Text = "AGV 3: Finished";
                                break;
                            case 3:
                                timer4.Stop();
                                agv4steps_LB.Text = "AGV 4: Finished";
                                break;
                            case 4:
                                timer5.Stop();
                                agv5steps_LB.Text = "AGV 5: Finished";
                                break;
                        }

                    }

                    timer_counter[agv_index] = -1;
                    steps_counter = 0;

                }
            } else {
                if (isLoad[markedbyagv[agv_index].X, markedbyagv[agv_index].Y] == 2)
                    if (AGVs[agv_index].GetLocation().X == m_rectangles[endPointCoords.X / 20][(endPointCoords.Y - topBarOffset) / 20].x &&
{'fraction_non_alphanumeric': 0.1049757906665293, 'fraction_numerical': 0.011744102194292779, 'mean_word_length': 1.0770218228498074, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3662444', 'n_tokens_mistral': 2920, 'n_tokens_neox': 2598, 'n_words': 471}