/*
         * Set the status board, update ship functions, and other clean up after
         * each turn is complete.
         */
        private void SetCondition()
        {
            // On occassion, a pblock was causing issues
            // so I need a way to fail and keep trying
            // instead of waiting forever
            var obj = new object();

            while (true)
            {
                using (var tryLock = new TryLock(obj))
                {
                    if (tryLock.HasLock)
                    {
                        SetConditionExecute();
                        endGameCheck();
                        break;
                    }
                    else
                    {
                        failInfo++;
                        if (failInfo > 10000)
                        {
                            WriteToLog.write("***** SETCONDITION FAILURE");
                            break;
                        }
                    }
                }
            }
        }
 /*
  * Clear the coms text area for a new game.
  */
 public void ComsClear()
 {
     this.Dispatcher.Invoke(() =>
     {
         txtComs.Text = "Ship shows green across the board, Captain!";
         WriteToLog.write("ComsClear");
     });
 }
        /*
         * Display information to the coms textbox making sure to
         * advance to the bottom of the text in the box
         */
        public void ComsChatter(string txt)
        {
            this.Dispatcher.Invoke(() =>
            {
                txtComs.Text += "\r\n" + txt;
                WriteToLog.write("ComsChatter ==> " + txt);

                txtComs.SelectionStart = txtComs.Text.Length;
                txtComs.ScrollToEnd();
            });
        }
        /*
         * Very simple debug routine.  Just print out to the log
         * if something is sent and return debug mode setting.
         *
         */
        public bool Debug(string txt)
        {
            if (debug)
            {
                if (txt.Length > 0)
                {
                    WriteToLog.write(txt);
                }
            }

            return(debug);
        }
Beispiel #5
0
 /*
  * Remove the object form the list that matches
  * the current row,col location
  *
  */
 public void RemoveStarObjectAt(int row, int col)
 {
     // remove the object from the starObjects list
     // the list is very short so nothing fancy needed for the search
     for (int i = 0; i < starObjects.Count(); i++)
     {
         if (starObjects.ElementAt(i).Row == row && starObjects.ElementAt(i).Col == col)
         {
             WriteToLog.write("gameObjects.removeStartObjectAt " + row + "," + col + " type=" + starObjects.ElementAt(i).Type);
             game.GameBoard.RemoveObjectFromBoard(starObjects.ElementAt(i).Type, game.GameBoard.getMyLocation());
             starObjects.Remove(starObjects.ElementAt(i));
             i = starObjects.Count();
         }
     }
 }
        /*
         *
         */
        public MainWindow()
        {
            InitializeComponent();

            // start of custom code
            WriteToLog.write("---- System Start ----", string.Empty, true);
            debug = Config.ReadElement("Debug", "False", true).Equals("true", StringComparison.OrdinalIgnoreCase);

            // initialize the sub classes
            GameBoard     = new GameBoard(this);
            GameMap       = new GameMap(this);
            SRS           = new SRSController(this);
            LRS           = new LRSController(this);
            Warp          = new WarpController(this);
            Torpedoes     = new TorpedoController(this);
            Phasers       = new PhaserController(this);
            Shields       = new ShieldController(this);
            Impulse       = new ImpulseController(this);
            GameObjects   = new GameObjects(this);
            DamageControl = new DamageControl(this);
            StarBases     = new StarBaseController(this);
            Probes        = new ProbeController(this);

            // set up a new board and start the timer
            NewGame(8);
            CreateTimer();

            WriteToLog.write("Debug = " + debug.ToString());
            WriteToLog.ClearOldLogs();

            // set up the hotkeys
            rcImpulse.InputGestures.Add(new KeyGesture(Key.I, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(rcImpulse, ImpulseCommand));

            rcWarp.InputGestures.Add(new KeyGesture(Key.W, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(rcWarp, WarpCommand));

            rcTorpedoes.InputGestures.Add(new KeyGesture(Key.T, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(rcTorpedoes, TorpedoCommand));

            rcPhasers.InputGestures.Add(new KeyGesture(Key.P, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(rcPhasers, PhaserCommand));

            rcShields.InputGestures.Add(new KeyGesture(Key.S, ModifierKeys.Control));
            CommandBindings.Add(new CommandBinding(rcShields, ShieldCommand));
        }
Beispiel #7
0
        /*
         *  Add an object to the starObjects list and place it into the
         * SRS map at the requested coordinates.  Optionally require a certain
         * amount of distance between other objects.  Return true if placement
         *  was successful.
         *
         */
        public bool AddStarObject(int type, int row, int col, int distance)
        {
            bool ok2Place = true;

            if (srsGrid[row, col] == 0)
            {
                if (distance > 0)
                {
                    for (int r = row - distance; r <= row + distance; r++)
                    {
                        for (int c = col - distance; c <= col + distance; c++)
                        {
                            if (r >= 0 && r < 10 && c >= 0 && c < 10)
                            {
                                try
                                {
                                    ok2Place = ok2Place && srsGrid[r, c] == 0;
                                    //_game.GameObjects.AddStarObject(GameObjects.ENTERPRISE, myRow, myCol);
                                }
                                catch (Exception ex)
                                {
                                    WriteToLog.write("SRS Error - " + ex.Message);
                                }
                            }
                        }
                    }
                }

                if (ok2Place)
                {
                    _game.GameObjects.AddStarObject(type, row, col);
                    _game.Debug("Placing at " + row.ToString() + "," + col.ToString());

                    // place it on the map and signal a successful insertion
                    SetShortRangeSensors(row, col, type);
                    type = 0;
                }
                else
                {
                    _game.Debug("Failed to place at " + row.ToString() + "," + col.ToString());
                }
            }

            return(type == 0);
        }
Beispiel #8
0
        public void MoveWithNoAnimation()
        {
            // this sucks
            string action = ShowObjectMovement();

            //Dispatcher.Invoke(new Action(() => { }), DispatcherPriority.ContextIdle);

            WriteToLog.write("No Animation");

            while (action != null)
            {
                if (action[0].Equals('A'))
                {
                    game.ComsChatter("Track " + action.Substring(1));
                }

                WriteToLog.write("Action => " + action.Substring(1));
                action = ShowObjectMovement();
            }
        }
        /*
         * Routine to set everything up for a new game
         */
        public void NewGame(int gridSize)
        {
            WriteToLog.write("---- Game Start ----");

            // initialize the other classes
            GameBoard.NewGame(gridSize);
            GameMap.NewGame();
            SRS.NewGame();
            LRS.NewGame();
            Warp.NewGame();
            Torpedoes.NewGame();
            Phasers.NewGame();
            Shields.NewGame();
            Impulse.NewGame();
            DamageControl.NewGame();
            StarBases.NewGame();
            Probes.NewGame();

            ComsClear();

            // Register starbases
            for (int i = 0; i < GameBoard.GetSize() * GameBoard.GetSize(); i++)
            {
                if (GameBoard.GetGameBoard(i) > 99)
                {
                    // Register this starbase
                    StarBases.AddStarbase(i);
                    WriteToLog.write("Added starbase to loc " + i.ToString());
                }
            }

            // locate the enterprise and play the game
            GameBoard.RandomEnterpriseLocation();
            WriteToLog.write("Enteprise is in sector " + GameBoard.GetLocation());

            SRS.Execute();
            SetCondition();
        }
Beispiel #10
0
        /*
         * This routine tells us how much time will be required to
         * get to full health and we can then select how much time
         * to lose getting some things fixed up.  Shields, warp
         * engines, and phasers have priority for repair.
         *
         */
        public void FixAllDamage()
        {
            WriteToLog.write("DamageControl.fixAllDamage ");
            if (_game.GetAlertLevel() != MainWindow.REDALERT)
            {
                double spend = 0;

                int damage = _game.Impulse.getDamage()
                             + _game.Warp.getDamage()
                             + _game.Torpedoes.getDamage()
                             + _game.Shields.getDamage()
                             + _game.Phasers.getDamage()
                             + _game.LRS.getDamage();

                if (damage == 0)
                {
                    _game.ComsChatter("Damage control reports all systems ready.");
                }
                else
                {
                    double starDays = _game.DamageControl.CalculateDamageTime(damage);

                    if (_game.IsDocked())
                    {
                        if (starDays > .3)
                        {
                            starDays = Math.Round(_game.IsDocked() ? starDays / 2 : starDays, 1);
                        }
                    }

                    WriteToLog.write("    to fix = " + starDays + " starDays");

                    if (starDays > 0)
                    {
                        spend = (double)Dialogs.GetValue("Damage Control", "It will take " + starDays.ToString() + " star days to fix all repairs.  Choose how many to spend.", 0, starDays);
                        WriteToLog.write("    requested=" + spend);

                        if (spend > 0)
                        {
                            if (spend >= starDays)
                            {
                                // just fix everything
                                _game.Impulse.repairAllDamage();
                                _game.Warp.repairAllDamage();
                                _game.Torpedoes.repairAllDamage();
                                _game.Shields.repairAllDamage();
                                _game.Phasers.repairAllDamage();
                                _game.LRS.repairAllDamage();

                                _game.ComsChatter("All damage was repaired on time.");
                            }
                            else
                            {
                                int repairAvailable = (int)(damage * (spend / starDays) + 1);
                                int repairSpread    = repairAvailable / 4;

                                // TODO - put these controllers to a list or array...
                                // perhaps some sort of registration process to DC...
                                // Then loop through fixing anything not healthy, and
                                // then any critical component under 50%, and finally
                                // everything that has damage

                                // loop until we've either fixed everything or
                                // we run out of points to fix the damages
                                while (repairAvailable > 0)
                                {
                                    WriteToLog.write("    damage in=" + damage + "   repairAvailable=" + repairAvailable);

                                    // priority is given to shields, warp, and phasers
                                    repairAvailable -= _game.Shields.RepairDamage(repairAvailable > repairSpread ? repairSpread : repairAvailable);
                                    repairAvailable -= _game.Warp.RepairDamage(repairAvailable > repairSpread ? repairSpread : repairAvailable);
                                    repairAvailable -= _game.Phasers.RepairDamage(repairAvailable > repairSpread ? repairSpread : repairAvailable);

                                    // if below 50%, do some more work
                                    repairAvailable -= _game.Shields.RepairDamage((_game.Shields.HealthPercent() < 40 ? repairAvailable > repairSpread ? repairSpread : repairAvailable : 0));
                                    repairAvailable -= _game.Warp.RepairDamage((_game.Shields.HealthPercent() < 40 ? repairAvailable > repairSpread ? repairSpread : repairAvailable : 0));
                                    repairAvailable -= _game.Phasers.RepairDamage((_game.Shields.HealthPercent() < 40 ? repairAvailable > repairSpread ? repairSpread : repairAvailable : 0));

                                    repairAvailable -= _game.Impulse.RepairDamage(repairAvailable > repairSpread ? repairSpread : repairAvailable);
                                    repairAvailable -= _game.Torpedoes.RepairDamage(repairAvailable > repairSpread ? repairSpread : repairAvailable);
                                    repairAvailable -= _game.LRS.RepairDamage(repairAvailable > repairSpread ? repairSpread : repairAvailable);

                                    WriteToLog.write("    repairAvailable=" + repairAvailable);
                                }

                                // return any time left
                                starDays -= (damage > 0 ? starDays - damage / repairPointsPerStarDate : 0);

                                _game.ComsChatter("Damage control crews report ready.");
                            }
                        }

                        WriteToLog.write(string.Empty + starDays + " added to current date");
                        _game.GameBoard.StarDateAdd(starDays);
                    }
                }
            }
            else
            {
                _game.ComsChatter("Damage control crews are busy.");

                if (_game.Debug(""))
                {
                    // Cheat to get through game faster while testing
                    for (int row = 0; row < 10; row++)
                    {
                        for (int col = 0; col < 10; col++)
                        {
                            if (_game.SRS.GetShortRangeSensors(row, col) == 2)
                            {
                                _game.GameObjects.RemoveStarObjectAt(row, col);
                            }
                        }
                    }

                    _game.Shields.updateCurrentCount(100);
                }
            }
        }
Beispiel #11
0
        /*
         * Set up this module for a new game
         */
        public void NewGame()
        {
            lock (pblock)
            {
                WriteToLog.write("*** Building map panel ***");
                game.mapPanel.Children.Clear();

                this.boardSize   = game.GameBoard.GetSize();
                this.mapGridSize = boardSize + 2;

                // create a blank map
                myMap        = new int[boardSize * boardSize];
                this.gameMap = new Label[boardSize * boardSize];

                double gridHeight = 340 / mapGridSize;
                double gridLength = 800 / mapGridSize;

                // Now set up the map grid panel
                for (int row = 0; row < mapGridSize; row++)
                {
                    RowDefinition gridRow = new RowDefinition();
                    gridRow.Height    = new System.Windows.GridLength(gridHeight, System.Windows.GridUnitType.Pixel);
                    gridRow.MaxHeight = gridHeight;
                    game.mapPanel.RowDefinitions.Add(gridRow);

                    for (int col = 0; col < mapGridSize; col++)
                    {
                        ColumnDefinition gridCol = new ColumnDefinition();
                        gridCol.Width    = new System.Windows.GridLength(gridLength, System.Windows.GridUnitType.Pixel);
                        gridCol.MaxWidth = gridLength;
                        game.mapPanel.ColumnDefinitions.Add(gridCol);
                    }
                }

                for (int row = 0; row < boardSize; row++)
                {
                    Label l = new Label();
                    l.Width   = gridLength;
                    l.Height  = gridHeight;
                    l.Content = (row + 1).ToString();
                    l.HorizontalContentAlignment = HorizontalAlignment.Center;
                    Grid.SetRow(l, 0);
                    Grid.SetColumn(l, row + 1);
                    game.mapPanel.Children.Add(l);

                    Label l2 = new Label();
                    l2.Width   = gridLength;
                    l2.Height  = gridHeight;
                    l2.Content = (row + 1).ToString();
                    l2.HorizontalContentAlignment = HorizontalAlignment.Center;
                    Grid.SetRow(l2, row + 1);
                    Grid.SetColumn(l2, 0);
                    game.mapPanel.Children.Add(l2);


                    for (int col = 0; col < boardSize; col++)
                    {
                        myMap[ToLoc(row, col)] = -1;

                        // set up the label def for this grid location
                        gameMap[ToLoc(row, col)]         = new Label();
                        gameMap[ToLoc(row, col)].Width   = gridLength;
                        gameMap[ToLoc(row, col)].Height  = gridHeight;
                        gameMap[ToLoc(row, col)].Content = "---";
                        gameMap[ToLoc(row, col)].HorizontalContentAlignment = HorizontalAlignment.Center;
                        Grid.SetRow(gameMap[ToLoc(row, col)], row + 1);
                        Grid.SetColumn(gameMap[ToLoc(row, col)], col + 1);
                        game.mapPanel.Children.Add(gameMap[ToLoc(row, col)]);
                    }
                }
            }
        }
Beispiel #12
0
        private void SetConditionExecute()
        {
            WriteToLog.write("SetCondition - starDate=" + GameBoard.CurrentStarDate() + "  energy=" + this.energyLevel);

            // set the alert level
            if (GameBoard.GetGameBoard() % 100 / 10 > 0)
            {
                this.alertLevel = REDALERT;
            }
            else
            {
                //energy <15% or or shields up is yellow alert
                if (this.energyLevel < 15 || Shields.AreUp())
                {
                    this.alertLevel = YELLOWALERT;
                }
                else
                {
                    this.alertLevel = GREENALERT;
                }
            }

            Debug("Alert Level = " + alertLevel);

            // update the form
            this.Dispatcher.BeginInvoke((Action)(() =>
            {
                Debug("Updating Status");

                switch (this.alertLevel)
                {
                case REDALERT:
                    lblAlert.Content = "RED";
                    break;

                case YELLOWALERT:
                    this.lblAlert.Content = "YELLOW";
                    break;

                default:
                    this.lblAlert.Content = "GREEN";
                    break;
                }

                // update labels - the updatecontent method sends
                // the info to the log file when in debug mode
                UpdateContent(lblStarDate, String.Format("{0:0.0} ({1:0.0})", this.GameBoard.CurrentStarDate(), GameBoard.TimeLeft()));
                UpdateContent(lblEnergy, String.Format("{0:0.0}%", this.energyLevel));
                UpdateContent(lblKlingons, GameBoard.getKlingonCount().ToString());

                lblImpulse.Content = Impulse.HealthPercent() + "%";
                lblWarp.Content = Warp.HealthPercent() + "%";
                lblPhasers.Content = Phasers.HealthPercent() + "%";
                lblTorpedoes.Content = Torpedoes.HealthPercent() + "%";
                lblTorpedoCount.Content = "(" + Torpedoes.getCurrentCount() + " Remaining)";
                lblShields.Content = Shields.HealthPercent() + "%";
                lblLRS.Content = LRS.HealthPercent() + "%";
                lblShieldPowerRemaining.Content = Shields.levelPercent() + "%";

                string[] loc = GameBoard.GetLocationInfo();
                lblQuadrant.Content = loc[0];
                lblSector.Content = loc[1];
            }));


            // set button colors
            Debug("Set buttons");
            this.Dispatcher.BeginInvoke((Action)(() =>
            {
                // update button background
                btnImpulse.Background = ((Impulse.IsHealthy() ? LTGREEN : REDISH));
                btnWarp.Background = ((Warp.IsHealthy() ? LTGREEN : REDISH));
                btnTorpedoes.Background = ((Torpedoes.IsHealthy() ? (Torpedoes.getCurrentCount() > 2 ? LTGREEN : LTYELLOW) : REDISH));
                btnPhasers.Background = ((Phasers.IsHealthy() ? LTGREEN : REDISH));
                btnLRS.Background = ((LRS.IsHealthy() ? GREENISH : REDISH));
                btnRepairs.Background = (DamageControl.HealthPercent() > 50 ? GREENISH : (DamageControl.IsHealthy() ? LTYELLOW : REDISH));
                btnDivert.Background = (Shields.levelPercent() > 80 ? GREENISH : (Shields.levelPercent() < 40 ? REDISH : LTYELLOW));

                btnDivert.IsEnabled = !IsDocked();
                btnShields.IsEnabled = !IsDocked();

                if (this.alertLevel == REDALERT)
                {
                    if (Shields.HealthPercent() > 60)
                    {
                        btnShields.Background = (Shields.AreUp() ? GREENISH : REDISH);
                    }
                    else
                    {
                        btnShields.Background = ((Shields.IsHealthy() && Shields.AreUp() ? LTYELLOW : REDISH));
                    }
                }
                else
                {
                    if (Shields.HealthPercent() > 30)
                    {
                        btnShields.Background = (Shields.AreUp() ? GREENISH : LTGREEN);
                    }
                    else
                    {
                        btnShields.Background = ((Shields.IsHealthy() ? (Shields.AreUp() ? LTGREEN : LTYELLOW) : REDISH));
                    }
                }
            }));


            // are we docked?
            Debug("Docked");
            SetDocked(SRS.AreWeDocked());

            // look for starbase updates
            Debug("Starbases");
            StarBases.Execute();

            // execute damage control and LRS updates
            Debug("DC");
            DamageControl.Execute();

            // update the Long range sensors
            Debug("LRS");
            LRS.Execute();

            Debug("Exiting setcondition");
        }
Beispiel #13
0
        /*
         * Process the top animation object and pop
         * it off the stack.  When done, return a null.
         *
         */
        public String ShowObjectMovement()
        {
            lock (pblock)
            {
                WriteToLog.write("Showing Object Movement");

                String result = null;

                if (moveObjects != null && moveObjects.Count() > 0)
                {
                    // get the info and remove from the top of the stack
                    int    type   = moveObjects.ElementAt(0).Type;
                    String action = moveObjects.ElementAt(0).Action;
                    int    row    = moveObjects.ElementAt(0).Row;
                    int    col    = moveObjects.ElementAt(0).Col;
                    moveObjects.Remove(moveObjects.ElementAt(0));

                    WriteToLog.write("ShowObjectMovement Action " + action + " with " + type + " @ (" + row + "," + col + ")");

                    if (action.Substring(0, 1).Equals("F", StringComparison.OrdinalIgnoreCase))
                    {
                        // Enemy firing at Enterprise
                        if (action.Length > 1)
                        {
                            game.ComsChatter(action.Substring(1));
                        }
                        game.SRS.SetShortRangeSensors(row, col, type);
                        result = "F";
                    }
                    else if (action.Equals("L", StringComparison.OrdinalIgnoreCase))
                    {
                        // Landed in new sector location, clear objects, call SRS to redraw board
                        game.GameBoard.setMyLocation(type);
                        this.ClearObjects();
                        game.SRS.InitGrid(row, col);
                    }
                    else if (action.Substring(0, 1).Equals("C", StringComparison.OrdinalIgnoreCase))
                    {
                        // coms chatter - update the user
                        game.ComsChatter(action.Substring(1));
                        result = "C";
                    }
                    else
                    {
                        // update the SRS map, Add to cell or zero out for Remove/Destroy actions
                        game.SRS.SetShortRangeSensors(row, col, action.Equals("A", StringComparison.OrdinalIgnoreCase) ? type : 0);

                        if (action.Equals("D", StringComparison.OrdinalIgnoreCase))
                        {
                            // We destroyed something, remove it from the board & srs
                            for (int i = 0; i < starObjects.Count(); i++)
                            {
                                // Is this the object?
                                if (row == starObjects.ElementAt(i).Row&& col == starObjects.ElementAt(i).Col)
                                {
                                    // Tell us what got destroyed
                                    switch (type)
                                    {
                                    case ASTEROID:
                                        game.ComsChatter("Asteroid destroyed.");
                                        break;

                                    case KLINGON:
                                        game.ComsChatter("Klingon destroyed!");
                                        break;

                                    case STARBASE:
                                        game.ComsChatter("Starfleet is ordering a General Courtmartial!");
                                        break;
                                    }

                                    // Destroyed, so remove it
                                    this.RemoveStarObjectAt(row, col);
                                }
                            }
                        }

                        // Return what we did so we can decide if we want to do
                        // anything extra, or null if it was the last node
                        result = (moveObjects.Count() > 0 ? " AKSE    T".Substring(type, 1) + action : null);
                    }
                }

                return(result);
            }
        }
Beispiel #14
0
        public bool Execute()
        {
            bool clearToWarp = Usable();
            bool executed    = false;

            _game.Debug("In Warp");

            if (!clearToWarp) // && _game.impulse.isHealthy())
            {
                // warp is down, but you can use impulse to go where you want
                // at a cost of .5 star dates per warp... do you want to do that?
                String dialog = "The warp engines are down, but you can accomplish\n"
                                + "the same effect by using impulse engines at one half\n"
                                + "stardate for each sector traversed.\n\n"
                                + "Do you want to continue?";

                clearToWarp = Dialogs.YesNoDialog("Warp Down", dialog) == System.Windows.Forms.DialogResult.Yes;
            }


            if (clearToWarp)
            {
                int loc = _game.GameBoard.getMyLocation();
                int row = loc / _boardSize;
                int col = loc % _boardSize;

                double course = Dialogs.CourseDialog("Warp");

                if (course >= 1D)
                {
                    //System.out.println("Starting Track at "+row+","+col);
                    List <Track> track       = Course.CreateTrackList(row, col, course);
                    int          maxDuration = Dialogs.DurationDialog("Warp", 12);

                    _game.Debug("Track length=" + track.Count.ToString());

                    int i = (maxDuration > track.Count ? track.Count : maxDuration);

                    if (i > 0)
                    {
                        bool inGalaxy = true;
                        executed = true;

                        while (i > 0)
                        {
                            i--;


                            // Run DC for any unhealthy critical systems for each sector traversed
                            // If running on impulse, we have more time to do work, so more improvement
                            // would be expected for each critical system.
                            //int a = (IsHealthy() ? 0 : RepairDamage(IsHealthy() ? 1 : 4));
                            //a = (_game.impulse.isHealthy() ? 0 : _game.Impulse.repairDamage(isHealthy() ? 1 : 3));
                            //a = (_game.phasers.isHealthy() ? 0 : _game.Phasers.repairDamage(isHealthy() ? 1 : 3));
                            //a = (_game.phasers.isHealthy() ? 0 : _game.Torpedoes.repairDamage(isHealthy() ? 1 : 3));

                            // get coordinates
                            int c = track.ElementAt(i).Col;
                            int r = track.ElementAt(i).Row;

                            WriteToLog.write("Warp Track " + i + " - " + r + "," + c);

                            // is the destination in the galaxy?
                            if (r >= 0 && r < _boardSize && c >= 0 && c < _boardSize)
                            {
                                // found a valid track location, moving to that sector
                                // add time and energy for each sector traversed
                                _game.GameBoard.StarDateAdd((i + 1) * (IsHealthy() ? 0.1 : .5));
                                _game.AdjustEnergy((IsHealthy() ? 5 : -1) * (i + 1));

                                i = 0;
                                _game.GameBoard.setMyLocation(r * _boardSize + c);
                                _game.ComsChatter("Now in sector " + _game.GameBoard.GetLocation());
                            }
                            else
                            {
                                // we can't go out of bounds
                                if (inGalaxy)
                                {
                                    _game.ComsChatter("Lt Uhura reports: 'Captain, Star Fleet forbids us from leaving the galaxy.'");
                                    inGalaxy = false;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                _game.ComsChatter("Mr Scot says 'I'm sorry Captain, but me poor wee bairns are down!;");
            }

            return(executed);
        }