Beispiel #1
0
        public IActionResult AdjustSinglePlayer(int red, int green, int blue, int red1, int green1, int blue1, string name, int boardSize, bool usable, bool jack, string difficulty)
        {
            var HuPlayer = new HumanPlayer(ObtainLogic(), name, "rgb(" + red1 + ", " + green1 + ", " + blue1 + ")");

            HttpContext.Session.SetObject("HuPlayer", HuPlayer);

            var SePlayer = new AIPlayer((Behaviour.Mode)Int32.Parse(difficulty), ObtainLogic(), "rgb(" + red + ", " + green + ", " + blue + ")");

            HttpContext.Session.SetObject("SePlayer", SePlayer);

            aiMode  = (Behaviour.Mode) int.Parse(difficulty);
            aiColor = "rgb(" + red + ", " + green + ", " + blue + ")";
            HttpContext.Session.SetObject("AIcolor", aiColor);
            HttpContext.Session.SetObject("ai", aiMode);

            bool mp = false;

            HttpContext.Session.SetObject("Real", mp);

            HttpContext.Session.SetObject("BSize", (byte)boardSize);



            bool us = usable;
            bool ja = jack;

            HttpContext.Session.SetObject("usable", us);
            HttpContext.Session.SetObject("jack", ja);

            return(StartGame(mp));
        }
Beispiel #2
0
        // Puts AIPlayer into the HTTP Context
        public IActionResult AdjustAI(Behaviour.Mode mode, string color)
        {
            var SePlayer = new AIPlayer(mode, ObtainLogic(), color);

            HttpContext.Session.SetObject("SePlayer", SePlayer);

            aiMode  = mode;
            aiColor = color;


            bool mp = false;

            HttpContext.Session.SetObject("Real", mp);
            return(View("SinglePlayerGameSettings"));
        }
Beispiel #3
0
        private Behaviour CreateAI(Behaviour.Mode mode, GameLogic gameLogic, Player player)
        {
            switch (mode)
            {
            case Behaviour.Mode.Easy:
                return(new AIEasy(gameLogic, player));

            case Behaviour.Mode.Medium:
                return(new AIMedium(gameLogic, player));

            case Behaviour.Mode.Difficult:
                return(new AIDifficult(gameLogic, player));

            case Behaviour.Mode.Impossible:
                return(new AIImpossible(gameLogic, player));
            }

            return(null);

            return(CreateAI((Behaviour.Mode) new Random().Next(3), gameLogic, player));
        }
Beispiel #4
0
 public AIPlayer(Behaviour.Mode mode, GameLogic gameLogic, string color)
 {
     Name     = "Handsome Jack";
     ai       = CreateAI(mode, gameLogic, this);
     strColor = color;
 }
Beispiel #5
0
 public AIPlayer(Behaviour.Mode mode, GameLogic gameLogic, ConsoleColor color)
 {
     Name   = "Handsome Jack";
     ai     = CreateAI(mode, gameLogic, this);
     _color = color;
 }