コード例 #1
0
        public VlasovPlayer(
            int position,
            Dictionary <string, string> caMap,
            CEncodedObjectInputBufferI bin,
            string logpath,
            string logname,
            AIEventInterfaceI aiEvent,
            AICommandInterfaceI command,
            AIQueryI query,
            AICheatI cheat,
            int logLevel)
            : base(
                position,
                logpath,
                logname,
                caMap,
                bin,
                aiEvent,
                command,
                query,
                cheat,
                logLevel)
        {
            elogger_ = new CSubLog("ExamplePlayer:" + Convert.ToString(position), realLog_);
            elogger_.info("D Logger Log Open: " + logpath + " " + logname);
            elogger_.info("Position " + Convert.ToSingle(position) + " waking up.");

            testAttribute_ = EncodeUtil.parseInt(caMap[TEST_ATTR]);

            hints_ = new CDLLHints(bin);
        }
コード例 #2
0
        public VlasovPlayer(int position, string pname, string logpath, string logname,
                            CDLLHints hints, AIEventInterfaceI aiEvent,
                            AICommandInterfaceI command, AIQueryI query, AICheatI cheat,
                            int logLevel) : base(position, logpath, logname, aiEvent, command,
                                                 query, cheat, logLevel)
        {
            elogger_ = new CSubLog("Vlasov Player:" + Convert.ToString(position), realLog_);
            elogger_.info("D Logger Log Open: " + logpath + " " + logname);
            elogger_.info(pname + " waking up");

            hints_ = hints.copy();

            pname_ = pname;
        }
コード例 #3
0
 protected AIPlayerData(int position, string path, string logname, AIEventInterfaceI aiEvent, AICommandInterfaceI command, AIQueryI query, AICheatI cheat, int logLevel)
     : base(position, path, logname, aiEvent, command, query, cheat, logLevel)
 {
     dlogger_ = new CSubLog("PlayerData:" + Convert.ToString(position), realLog_);
     dlogger_.info("D Logger Log Open: " + path + " " + logname);
     random_ = new CMTRandom();
 }
コード例 #4
0
ファイル: AIPlayer.cs プロジェクト: OlegYurchik/edce-ai
        //////////////////////////////////////////////////////////////////////////////

        //////////////////////////////////////////////////////////////
        protected AIPlayer(int position, string path, string logname, AIEventInterfaceI aiEvent, AICommandInterfaceI command, AIQueryI query, AICheatI cheat, int logLevel)
        {
            position_ = position;
            realLog_  = new CLog(path, logname, logLevel);
            alogger_  = new CSubLog("AIPlayer" + Convert.ToString(position_), realLog_);
            alogger_.info("A Logger Log Open: " + path + " " + logname);

            aiEvent_ = aiEvent;
            command_ = command;
            query_   = query;
            cheat_   = cheat;
        }
コード例 #5
0
        protected override void runTurn()
        {
            try
            {
                elogger_.info("Running Turn");

                if (pollAllEvents())
                {
                    ackHold(); return;
                }

                elogger_.info("Ending Turn");
            }
            catch (Exception T)
            {
                elogger_.info(T);
            }
        }
コード例 #6
0
ファイル: ExamplePlayer.cs プロジェクト: gcsoupcan/empireAI
        //Run Turn
        //The game gives the AI PLayer Thread control.
        //When it returns, the turn will be over
        //the start turn event will be somewhere in the stack of events
        //that the AI received.
        protected override void runTurn()
        {
            try
            {
                elogger_.info("Running Turn");

                //pull all events since last we met
                //This should end with the start turn
                if (pollAllEvents())
                {
                    ackHold(); return;
                }

                elogger_.info("Ending Turn");
            }
            catch (Exception T)
            {
                elogger_.info(T);
            }
        }
コード例 #7
0
ファイル: AIPlayer.cs プロジェクト: OlegYurchik/edce-ai
 public void runMyTurn()
 {
     try
     {
         setProgress(NO_PROGRESS);
         runTurn();
     }
     catch (Exception T)
     {
         alogger_.info("Error In Run Turn");
         alogger_.info(T);
         command_.aiThrow(position_, T);
     }
     finally
     {
         setProgress(MAX_PROGRESS);
         endTurn();
     }
 }
コード例 #8
0
 public virtual void addSpots(List <CUnit> spots)
 {
     if (spots != null)
     {
         for (int i = 0; i < spots.Count; i++)
         {
             CUnit su = spots[i];
             if (aiLogging_)
             {
                 dlogger_.info("S - Adding Spot " + su);
             }
             addSpot(su);
         }
     }
 }
コード例 #9
0
ファイル: CUnit.cs プロジェクト: OlegYurchik/edce-ai
        public virtual bool update(string attr, string value, CSubLog logger)
        {
            switch (attr)
            {
            case CUnitConstants.NAME:
            {
                name_ = value;
                return(true);
            }

            case CUnitConstants.TURN:
            {
                turn_ = EncodeUtil.parseInt(value);
                return(true);
            }

            case CUnitConstants.HOST:
            {
                host_ = EncodeUtil.parseUInt(value);
                logger.info(this + " now has host value [" + Convert.ToString(host_) + "]");

                return(true);
            }

            case CUnitConstants.RMVR:
            {
                rmvr_ = EncodeUtil.parseInt(value);
                return(true);
            }

            case CUnitConstants.RMVS:
            {
                rmvs_ = EncodeUtil.parseInt(value);
                return(true);
            }

            case CUnitConstants.FIRED:
            {
                fired_ = EncodeUtil.fromBoolString(value);
                return(true);
            }

            case CUnitConstants.ARMED:
            {
                armed_ = EncodeUtil.fromBoolString(value);
                return(true);
            }

            case CUnitConstants.DUGIN:
            {
                dugIn_ = EncodeUtil.fromBoolString(value);
                return(true);
            }

            case CUnitConstants.DMG:
            {
                dmg_ = EncodeUtil.parseInt(value);
                return(true);
            }

            case CUnitConstants.SHORT_FUEL:
            {
                shortFuel_ = EncodeUtil.fromBoolString(value);
                return(true);
            }

            case CUnitConstants.READINESS:
            {
                readiness_ = value;
                return(true);
            }

            case CUnitConstants.EXPERIENCE:
            {
                experience_ = EncodeUtil.parseUInt(value);
                return(true);
            }

            case CUnitConstants.EXP_LEVEL:
            {
                expType_ = value;
                return(true);
            }

            case CUnitConstants.CHILD_ADD:
            {
                uint cgid = EncodeUtil.parseUInt(value);
                cunits_.Add(cgid);
                logger.info("Unit " + Convert.ToString(gid_) + " adds child " + Convert.ToString(cgid));
                return(true);
            }

            case CUnitConstants.CHILD_REM:
            {
                uint cgid = EncodeUtil.parseUInt(value);
                for (int j = 0; j < cunits_.Count; j++)
                {
                    if (cunits_[j] == cgid)
                    {
                        cunits_.RemoveAt(j);
                        break;
                    }
                }
                logger.info("Unit " + Convert.ToString(gid_) + " removes child " + Convert.ToString(cgid));
                return(true);
            }

            case CUnitConstants.LX:
                setLoc(new CLoc(EncodeUtil.parseInt(value), loc_.y));
                return(true);

            case CUnitConstants.LY:
                setLoc(new CLoc(loc_.x, EncodeUtil.parseInt(value)));
                return(true);

            case CUnitConstants.OWNER:     //will need to do more here if interested in gifts or giveaways
            {
                owner_ = EncodeUtil.parseInt(value);
                return(true);
            }

            case CUnitConstants.LANDED:
            {
                landed_ = EncodeUtil.fromBoolString(value);
                return(true);
            }

            case CUnitConstants.REENTRY:
            {
                inReentry_ = EncodeUtil.fromBoolString(value);
                return(true);
            }

            case CUnitConstants.LEVEL:
            {
                level_ = value;
                return(true);
            }

            case CUnitConstants.SLAYER:
            {
                stackLayer_ = EncodeUtil.parseUInt(value);
                return(true);
            }
            }
            return(false);
        }