Exemplo n.º 1
0
        public DebugForm(console c, bool enable_debug)
        {
            try
            {
                this.AutoScaleMode = AutoScaleMode.Inherit;
                InitializeComponent();
                float  dpi                   = this.CreateGraphics().DpiX;
                float  ratio                 = dpi / 96.0f;
                string font_name             = this.Font.Name;
                float  size                  = (float)(8.25 / ratio);
                System.Drawing.Font new_font = new System.Drawing.Font(font_name, size);
                this.Font = new_font;
                this.PerformAutoScale();
                this.PerformLayout();
                console = c;

                if (enable_debug)
                {
                    chkAudio.Checked    = true;
                    chkCAT.Checked      = true;
                    chkConsole.Checked  = true;
                    chkDirectX.Checked  = true;
                    chkEthernet.Checked = true;
                    chkIRRemote.Checked = true;
                    chkUSB.Checked      = true;
                }
            }
            catch (Exception ex)
            {
                Debug.Write(ex.ToString());
            }
        }
Exemplo n.º 2
0
        unsafe public CWKeyer2(console c)
        {
            console   = c;
            siolisten = console.Siolisten;
            Thread.Sleep(50);
            DttSP.NewKeyer(600.0f, true, 0.0f, 3.0f, 25.0f, (float)Audio.SampleRate1);
            DttSP.SetKeyerMode(0);
            Thread.Sleep(50);


            CWTone              = new Thread(new ThreadStart(DttSP.KeyerSoundThread));
            CWTone.Name         = "CW Sound Thread";
            CWTone.Priority     = ThreadPriority.Highest;
            CWTone.IsBackground = true;
            CWTone.Start();

            Monitor              = new Thread(new ThreadStart(DttSP.KeyerMonitorThread));
            Monitor.Name         = "CW Monitor Thread";
            Monitor.Priority     = ThreadPriority.Highest;
            Monitor.IsBackground = true;
            Monitor.Start();

            Thread.Sleep(100);

            timer = new HiPerfTimer();
        }
        public ActionResult DeleteConfirmed(int id)
        {
            console console = db.consoles.Find(id);

            db.consoles.Remove(console);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
 public MultiPSKEthernetServer(console c)
 {
     console        = c;
     receive_buffer = new byte[65535];
     send_buffer    = new byte[65535];
     send_event     = new AutoResetEvent(false);
     server_event   = new AutoResetEvent(false);
 }
Exemplo n.º 5
0
 public ClientRecvData(console c)
 {
     console = c;
     if (sendEvent == null)
     {
         sendEvent = new AutoResetEvent(false);
     }
 }
 public ActionResult Edit([Bind(Include = "id,name,company,bio_link")] console console)
 {
     if (ModelState.IsValid)
     {
         db.Entry(console).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(console));
 }
        /// <summary>
        /// Starts the bot up.
        /// </summary>
        ///
        /// <param name="console">Function for printing to debug console.</param>
        public void start(console console)
        {
            this.console = console;
            this.active  = true;

            // Load map data
            this.map.loadMap();

            if (!this.active)
            {
                return;
            }

            // Group waterable tiles
            this.map.findGroupings(this.console);

            if (!this.active)
            {
                return;
            }

            this.currentGroup = 0;
            this.currentTile  = 0;

            this.path = this.map.findGroupPath(this.console);

            if (path.Count == 0)
            {
                this.active = false;
                return;
            }

            this.displayMessage(this.helper.Translation.Get("process.start"), 2);

            if (!this.active)
            {
                return;
            }

            this.order = this.map.findFillPath(this.path[this.currentGroup], this.console);

            if (!this.active)
            {
                return;
            }

            if (((WateringCan)Game1.player.CurrentTool).WaterLeft <= 0)
            {
                this.refillWater();

                return;
            }

            Game1.player.controller = new PathFindController(Game1.player, Game1.currentLocation, this.order[this.currentTile].getStand(), 2, this.startWatering);
        }
        public ActionResult Create([Bind(Include = "id,name,company,bio_link")] console console)
        {
            if (ModelState.IsValid)
            {
                db.consoles.Add(console);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(console));
        }
Exemplo n.º 9
0
 public void call_update_doors(door Door, bool stat, console Console, bool callLeave, int lvl)
 {
     if (callLeave)
     {
         Console.leaveConsole();
     }
     if (Door == null)
     {
         return;
     }
     callingDoorUpdate(Door, stat, lvl);
 }
Exemplo n.º 10
0
        public AGauge(console c)
        {
            console = c;
            float  dpi       = this.CreateGraphics().DpiX;
            float  ratio     = dpi / 96.0f;
            string font_name = this.Font.Name;
            float  size      = (float)(8.25 / ratio);

            System.Drawing.Font new_font = new System.Drawing.Font(font_name, size);
            this.Font   = new_font;
            gaugeBitmap = new Bitmap(console.picAGauge.Width, console.picAGauge.Height, PixelFormat.Format24bppRgb);
            this.PerformLayout();
        }
        // GET: Consoles/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            console console = db.consoles.Find(id);

            if (console == null)
            {
                return(HttpNotFound());
            }
            return(View(console));
        }
Exemplo n.º 12
0
        public OldVoliBot(string username, string password, console _parent, QueueTypes queue)
        {
            parent                         = _parent;
            ipath                          = parent.lolPath; Accountname = username; Password = password; queueType = queue;
            baseRegion                     = BaseRegion.GetRegion(_parent.region.ToString());
            connection.OnConnect          += new LoLConnection.OnConnectHandler(connection_OnConnect);
            connection.OnDisconnect       += new LoLConnection.OnDisconnectHandler(connection_OnDisconnect);
            connection.OnError            += new LoLConnection.OnErrorHandler(connection_OnError);
            connection.OnLogin            += new LoLConnection.OnLoginHandler(connection_OnLogin);
            connection.OnLoginQueueUpdate += new LoLConnection.OnLoginQueueUpdateHandler(connection_OnLoginQueueUpdate);
            connection.OnMessageReceived  += new LoLConnection.OnMessageReceivedHandler(connection_OnMessageReceived);
            string pass = Regex.Replace(password, @"\s+", "");

            connection.Connect(Accountname, pass, baseRegion.PVPRegion, _parent.currentVersion + "." + Config.clientSubVersion);
        }
Exemplo n.º 13
0
        public About(console c)
        {
            console            = c;
            this.AutoScaleMode = AutoScaleMode.Inherit;
            InitializeComponent();
            float  dpi       = this.CreateGraphics().DpiX;
            float  ratio     = dpi / 96.0f;
            string font_name = this.Font.Name;
            float  size      = (float)(8.25 / ratio);

            System.Drawing.Font new_font = new System.Drawing.Font(font_name, size);
            this.Font = new_font;
            this.PerformAutoScale();
            this.PerformLayout();
        }
Exemplo n.º 14
0
        // GET: ConsoleManager/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            console console = db.consoles.Find(id);

            if (console == null)
            {
                return(HttpNotFound());
            }
            ViewBag.id = new SelectList(db.consoles, "id", "name", console.id);
            return(View(console));
        }
Exemplo n.º 15
0
        /// <summary>
        /// Find all groupings of waterable tiles
        /// </summary>
        ///
        /// <param name="console">Function for printing to debug console.</param>
        public void findGroupings(console console)
        {
            this.groupings = new List <Group>();

            foreach (Tile tile in this.waterableTiles)
            {
                bool grouped = false;

                if (tile.visited)
                {
                    continue;
                }

                int index = this.groupings.Count;

                if (tile.x <= this.width - 1)
                {
                    Tile neighbor = this.map[tile.y][tile.x + 1];
                    if (neighbor.waterable)
                    {
                        grouped = true;
                        Group group = new Group(index);
                        this.populateGroup(group, tile);
                        this.groupings.Add(group);
                    }
                }
                if (tile.y <= this.height - 1 && !grouped)
                {
                    Tile neighbor = this.map[tile.y + 1][tile.x];
                    if (neighbor.waterable)
                    {
                        grouped = true;
                        Group group = new Group(index);
                        this.populateGroup(group, tile);
                        this.groupings.Add(group);
                    }
                }
                if (!grouped)
                {
                    Group solo = new Group(index);

                    solo.Add(tile);
                    tile.visited = true;

                    this.groupings.Add(solo);
                }
            }
        }
Exemplo n.º 16
0
        public SIOListenerII(console c)
        {
            console          = c;
            console.Closing += new System.ComponentModel.CancelEventHandler(console_Closing);
            parser           = new CATParser(console);

            //event handler for Serial RX Events
            SDRSerialSupportII.SDRSerialPort.serial_rx_event += new SDRSerialSupportII.SerialRXEventHandler(SerialRXEventHandler);

            if (console.CATEnabled)                // if CAT is on fire it up
            {
                try
                {
                    enableCAT();
                }
                catch (Exception ex)
                {
                    // fixme??? how cool is to to pop a msg box from an exception handler in a constructor ??
                    //  seems ugly to me (wjt)
                    console.CATEnabled = false;
                    if (console.SetupForm != null)
                    {
                        console.SetupForm.copyCATPropsToDialogVars();                         // need to make sure the props on the setup page get reset
                    }
                    MessageBox.Show("Could not initialize CAT control.  Exception was:\n\n " + ex.Message +
                                    "\n\nCAT control has been disabled.", "Error Initializing CAT control",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            SIOMonitor          = new System.Timers.Timer();
            SIOMonitor.Elapsed += new
                                  System.Timers.ElapsedEventHandler(SIOMonitor_Elapsed);
            SIOMonitor.Interval = 5000;     // 5s

            run_thread               = true;
            send_thread              = new Thread(new ThreadStart(SendThread));
            send_thread.Name         = "Serial send Process Thread ";
            send_thread.Priority     = ThreadPriority.Normal;
            send_thread.IsBackground = true;
            send_thread.Start();
        }
Exemplo n.º 17
0
        public cwedit(console c)
        {
            //
            // Required for Windows Form Designer support
            //
            this.AutoScaleMode = AutoScaleMode.Inherit;
            InitializeComponent();
            int dpi = (int)this.CreateGraphics().DpiX;

            if (dpi > 96)
            {
                string font_name             = this.Font.Name;
                System.Drawing.Font new_font = new System.Drawing.Font(font_name, 6.5f);
                this.Font = new_font;
            }

            console = c;
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
Exemplo n.º 18
0
 public Skin(console c)
 {
     console = c;
 }
Exemplo n.º 19
0
 public LoopDLL(console c)
 {
     console = c;
 }
Exemplo n.º 20
0
 public ExtIO_RTL(console c)
 {
     console = c;
 }
Exemplo n.º 21
0
        public SetupWizard(console c, int sound_card_index)
        {
            this.AutoScaleMode = AutoScaleMode.Inherit;
            InitializeComponent();
            float  dpi       = this.CreateGraphics().DpiX;
            float  ratio     = dpi / 96.0f;
            string font_name = this.Font.Name;
            float  size      = (float)(8.25 / ratio);

            System.Drawing.Font new_font = new System.Drawing.Font(font_name, size);
            this.Font = new_font;
            this.PerformAutoScale();
            this.PerformLayout();

            console = c;

            resource = new System.Resources.ResourceManager(typeof(SetupWizard));

            CurPage       = Page.WELCOME;
            usb_present   = false;
            Si570_present = false;

            model = console.CurrentModel;
            switch (model)
            {
            case Model.GENESIS_G11:
                radModelG11.Checked = true;
                break;

            case Model.GENESIS_G59USB:
                radModelG59.Checked = true;
                break;

            case Model.GENESIS_G3020:
                radModelG3020.Checked = true;
                break;

            case Model.GENESIS_G40:
                radModelG40.Checked = true;
                break;

            case Model.GENESIS_G80:
                radModelG80.Checked = true;
                break;

            case Model.GENESIS_G160:
                radModelG160.Checked = true;
                break;

            case Model.GENESIS_G137:
                radModelG137.Checked = true;
                break;

            case Model.GENESIS_G500:
                radModelG500.Checked = true;
                break;

            case Model.QRP2000:
                radModelQRP2000.Checked = true;
                break;
            }

            comboBox3.SelectedIndex = sound_card_index;
        }
Exemplo n.º 22
0
        /// <summary>
        /// Finds the closest refill location
        /// </summary>
        public ActionableTile getClosestRefill(Tile start, console console)
        {
            foreach (List <Tile> row in this.map)
            {
                foreach (Tile tile in row)
                {
                    tile.waterCheck = false;
                }
            }

            List <Tuple <Tile, Tile> > queue = new List <Tuple <Tile, Tile> >(); // Current, Last

            queue.Add(new Tuple <Tile, Tile>(start, null));

            Tile current = null;
            Tile last    = null;

            while (queue.Count > 0)
            {
                last    = queue[0].Item2;
                current = queue[0].Item1;
                queue.RemoveAt(0);

                if (current.waterCheck)
                {
                    continue;
                }

                current.waterCheck = true;

                if (current.water)
                {
                    List <Point> actions = new List <Point>();
                    actions.Add(current.getPoint());

                    if (current.block)
                    {
                        return(new ActionableTile(last.getPoint(), actions, ActionableTile.Action.Refill));
                    }
                    else
                    {
                        return(new ActionableTile(current.getPoint(), actions, ActionableTile.Action.Refill));
                    }
                }

                if (current.block && current != start)
                {
                    continue;
                }

                foreach (Tuple <int, int, Func <int, int, bool> > direction in this.directions)
                {
                    if (direction.Item3(current.y + direction.Item1, current.x + direction.Item2))
                    {
                        if (!this.map[current.y + direction.Item1][current.x + direction.Item2].block || this.map[current.y + direction.Item1][current.x + direction.Item2].water)
                        {
                            queue.Add(new Tuple <Tile, Tile>(this.map[current.y + direction.Item1][current.x + direction.Item2], current));
                        }
                    }
                }
            }

            return(null);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Finds path in group through adjacent tiles
        /// </summary>
        ///
        /// <param name="group">Group of crops to find path through.</param>
        public List <ActionableTile> findFillPath(Group group, console console)
        {
            // Start a new path of actionable tiles
            // Actionable tiles are a standing place, and nearby tiles to water
            List <ActionableTile> path = new List <ActionableTile>();

            // Reset the visited values of each tile in group.
            foreach (Tile tile in group.getList())
            {
                this.map[tile.y][tile.x].reset();
            }

            // Queue for depth first search
            List <Tile> stack = new List <Tile>();

            stack.Add(group.findClosestTile(Game1.player.getTileX(), Game1.player.getTileY()).Item1);

            bool keepGoing;

            do
            {
                keepGoing = false;

                while (stack.Count > 0)
                {
                    Tile current = stack[stack.Count - 1];
                    stack.RemoveAt(stack.Count - 1);

                    if (current.visited)
                    {
                        continue;
                    }
                    else if (current.watered)
                    {
                        current.visited = true;

                        foreach (Tuple <int, int, Func <int, int, bool> > direction in this.directions)
                        {
                            if (direction.Item3(current.y + direction.Item1, current.x + direction.Item2))
                            {
                                Tile neighbor = this.map[current.y + direction.Item1][current.x + direction.Item2];
                                if (!neighbor.visited && group.Contains(neighbor))
                                {
                                    stack.Add(neighbor);
                                }
                            }
                        }
                    }
                    else
                    {
                        // Start a new action
                        ActionableTile actionable = new ActionableTile(ActionableTile.Action.Water);
                        current.visited = true;

                        if (current.block)
                        {
                            int  score      = 0;
                            Tile bestOption = null;

                            // If you can stand on adjacents, do it.
                            foreach (Tuple <int, int, Func <int, int, bool> > direction in this.directions.Concat(this.diagonals))
                            {
                                if (direction.Item3(current.y + direction.Item1, current.x + direction.Item2))
                                {
                                    Tile neighbor = this.map[current.y + direction.Item1][current.x + direction.Item2];
                                    if (neighbor.block)
                                    {
                                        continue;
                                    }

                                    int neighborScore = 0;

                                    if (group.Contains(neighbor))
                                    {
                                        neighborScore += 5;
                                    }
                                    if (neighbor.waterable)
                                    {
                                        neighborScore += 5;
                                    }
                                    if (!neighbor.watered)
                                    {
                                        neighborScore += 5;
                                    }
                                    if (!neighbor.visited)
                                    {
                                        neighborScore += 5;
                                    }

                                    if (neighborScore > score)
                                    {
                                        bestOption = neighbor;
                                    }
                                }
                            }

                            if (bestOption == null)
                            {
                                continue;
                            }

                            // Set possible standing point.
                            actionable.setStand(bestOption.getPoint());
                        }
                        else
                        {
                            // Set this as standing position
                            actionable.setStand(current.getPoint());
                        }

                        // Water here
                        if (current.getPoint() == actionable.getStand())
                        {
                            actionable.pushExecuteOn(current.getPoint());
                            current.watered = true;
                        }
                        else if (this.map[actionable.getStand().Y][actionable.getStand().X].waterable && !this.map[actionable.getStand().Y][actionable.getStand().X].watered)
                        {
                            actionable.pushExecuteOn(actionable.getStand());
                            this.map[actionable.getStand().Y][actionable.getStand().X].watered = true;
                        }

                        // If you can water adjacents, do it.
                        foreach (Tuple <int, int, Func <int, int, bool> > direction in this.directions)
                        {
                            if (direction.Item3(actionable.getStand().Y + direction.Item1, actionable.getStand().X + direction.Item2))
                            {
                                Tile neighbor = this.map[actionable.getStand().Y + direction.Item1][actionable.getStand().X + direction.Item2];
                                if (neighbor.waterable && !neighbor.watered)
                                {
                                    actionable.pushExecuteOn(neighbor.getPoint());
                                    neighbor.watered = true;
                                }
                                if (!neighbor.visited && group.Contains(neighbor))
                                {
                                    stack.Add(neighbor);
                                }
                            }
                        }

                        // If you can water diagonals, do it.
                        foreach (Tuple <int, int, Func <int, int, bool> > direction in this.diagonals)
                        {
                            if (direction.Item3(actionable.getStand().Y + direction.Item1, actionable.getStand().X + direction.Item2))
                            {
                                Tile neighbor = this.map[actionable.getStand().Y + direction.Item1][actionable.getStand().X + direction.Item2];
                                if (neighbor.waterable && !neighbor.watered)
                                {
                                    actionable.pushExecuteOn(neighbor.getPoint());
                                    neighbor.watered = true;
                                }
                            }
                        }

                        path.Add(actionable);
                    }
                }

                foreach (Tile tile in group.getList())
                {
                    if (!tile.visited)
                    {
                        stack.Add(tile);
                        keepGoing = true;
                        break;
                    }
                }
            } while (keepGoing);

            return(path);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Runs TSP Greedy to find best path through all groups
        /// </summary>
        ///
        /// <param name="console">Function for printing to debug console.</param>
        public List <Group> findGroupPath(console console)
        {
            try
            {
                if (this.groupings.Count == 1)
                {
                    return(this.groupings);
                }

                List <Group> path = new List <Group>();

                int[,] costMatrix = this.generateCostMatrix(console);

                int counter = 0;
                int j       = 0;
                int i       = 0;
                int min     = int.MaxValue;

                List <int> visitedRouteList = new List <int>();

                visitedRouteList.Add(0);
                int[] route = new int[costMatrix.Length];

                while (i < costMatrix.GetLength(0) && j < costMatrix.GetLength(1))
                {
                    if (counter >= costMatrix.GetLength(0) - 1)
                    {
                        break;
                    }

                    if (j != i && !(visitedRouteList.Contains(j)))
                    {
                        if (costMatrix[i, j] < min)
                        {
                            min            = costMatrix[i, j];
                            route[counter] = j + 1;
                        }
                    }
                    j++;

                    if (j == costMatrix.GetLength(0))
                    {
                        min = int.MaxValue;
                        visitedRouteList.Add(route[counter] - 1);

                        j = 0;
                        i = route[counter] - 1;
                        counter++;
                    }
                }

                foreach (int index in visitedRouteList)
                {
                    if (index != 0)
                    {
                        path.Add(this.groupings[index - 1]);
                    }
                }

                return(path);
            } catch (IndexOutOfRangeException e)
            {
                console("WaterBot encountered an error and will return a sub-optimal path.");
                return(this.groupings);
            } catch (Exception e)
            {
                console("WaterBot encountered an unknown error and will return a sub-optimal path.");
                return(this.groupings);
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// Uses A* to find cost between different groupings.
        /// </summary>
        ///
        /// <param name="console">Function for printing to debug console.</param>
        public int[,] generateCostMatrix(console console)
        {
            foreach (Group group in this.groupings)
            {
                if (group.Count() == 0)
                {
                    this.groupings.Remove(group);
                }
            }

            int nodes = this.groupings.Count + 1;

            int[,] costMatrix = new int[nodes, nodes];

            // From
            for (int i = 0; i < nodes; i++)
            {
                // To
                for (int j = 0; j < nodes; j++)
                {
                    if (i == j)
                    {
                        costMatrix[i, j] = -1;
                    }
                    else
                    {
                        if (costMatrix[j, i] > 0)
                        {
                            costMatrix[i, j] = costMatrix[j, i];
                        }
                        else if (j == 0 || i == 0)
                        {
                            Point start = new Point(Game1.player.getTileX(), Game1.player.getTileY());
                            Point end   = this.groupings[i == 0 ? j - 1 : i - 1].Centroid(this);

                            Tuple <List <Tile>, int> path = this.walkablePathBetweenPoints(console, start, end);

                            costMatrix[i, j] = path.Item2;
                        }
                        else
                        {
                            Point start = this.groupings[i - 1].Centroid(this);
                            Point end   = this.groupings[j - 1].Centroid(this);

                            Tuple <List <Tile>, int> path = this.walkablePathBetweenPoints(console, start, end);

                            costMatrix[i, j] = path.Item2;
                        }
                    }
                }
            }

            List <int> safeGroups   = new List <int>();
            List <int> deleteGroups = new List <int>();

            for (int i = 0; i < nodes; i++)
            {
                if (costMatrix[0, i] == int.MaxValue)
                {
                    deleteGroups.Add(i);
                }
                else
                {
                    safeGroups.Add(i);
                }
            }

            deleteGroups.Sort();

            for (int i = deleteGroups.Count - 1; i >= 0; i--)
            {
                this.groupings.RemoveAt(deleteGroups[i] - 1);
            }

            int[,] reachableCostMatrix = new int[safeGroups.Count, safeGroups.Count];

            for (int i = 0; i < safeGroups.Count; i++)
            {
                for (int j = 0; j < safeGroups.Count; j++)
                {
                    reachableCostMatrix[i, j] = costMatrix[safeGroups[i], safeGroups[j]];
                    reachableCostMatrix[j, i] = costMatrix[safeGroups[j], safeGroups[i]];
                }
            }

            return(reachableCostMatrix);
        }
Exemplo n.º 26
0
        /// <summary>
        /// Runs A* on map to find shortest path from start to end.
        /// </summary>
        ///
        /// <param name="console">Function for printing to debug console.</param>
        /// <param name="start">Point to start at.</param>
        /// <param name="end">Point to end at.</param>
        public Tuple <List <Tile>, int> walkablePathBetweenPoints(console console, Point start, Point end)
        {
            List <Tile>             openSet  = new List <Tile>();
            Dictionary <Tile, Tile> cameFrom = new Dictionary <Tile, Tile>();
            Dictionary <Tile, int>  gScore   = new Dictionary <Tile, int>();
            Dictionary <Tile, int>  fScore   = new Dictionary <Tile, int>();

            Tile startTile = this.map[start.Y][start.X];

            openSet.Add(startTile);

            gScore.Add(startTile, 0);
            fScore.Add(startTile, startTile.distanceTo(end));

            while (openSet.Count > 0)
            {
                Tile current  = openSet[0];
                int  smallest = int.MaxValue;

                foreach (Tile tile in openSet)
                {
                    if (fScore[tile] < smallest)
                    {
                        smallest = fScore[tile];
                        current  = tile;
                    }
                }

                if (current.Equals(end))
                {
                    List <Tile> path = new List <Tile>();
                    while (cameFrom.Keys.Contains(current))
                    {
                        current = cameFrom[current];
                        path.Add(current);
                    }
                    return(new Tuple <List <Tile>, int>(path, path.Count));
                }

                openSet.Remove(current);

                List <Tile> neighbors = getNeighbors(current, true, false);

                foreach (Tile neighbor in neighbors)
                {
                    if (!gScore.Keys.Contains(neighbor))
                    {
                        gScore.Add(neighbor, int.MaxValue);
                    }

                    int tenativeGScore = gScore[current] + 1;
                    if (tenativeGScore < gScore[neighbor])
                    {
                        if (!cameFrom.Keys.Contains(neighbor))
                        {
                            cameFrom.Add(neighbor, null);
                        }
                        if (!fScore.Keys.Contains(neighbor))
                        {
                            fScore.Add(neighbor, int.MaxValue);
                        }

                        cameFrom[neighbor] = current;
                        gScore[neighbor]   = tenativeGScore;
                        fScore[neighbor]   = tenativeGScore + neighbor.distanceTo(end);

                        if (!openSet.Contains(neighbor))
                        {
                            openSet.Add(neighbor);
                        }
                    }
                }
            }
            return(new Tuple <List <Tile>, int>(null, int.MaxValue));
        }
Exemplo n.º 27
0
 public ExtIO_si570_usb(console c)
 {
     console = c;
 }
Exemplo n.º 28
0
 public WinLIRC(console c)
 {
     console = c;
 }
Exemplo n.º 29
0
 public ServerSendData(console c)
 {
     console = c;
 }
Exemplo n.º 30
0
 public QRP2000(console c)
 {
     console = c;
 }