Пример #1
0
        public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, TraceWriter log)
        {
            ActionResult       response  = new OkResult();
            IrisModelValidator validator = new IrisModelValidator();

            try
            {
                log.Info("IrisExMachina started");

                string    requestBody = new StreamReader(req.Body).ReadToEnd();
                IrisModel requestData = JsonConvert.DeserializeObject <IrisModel>(requestBody);
                FluentValidation.Results.ValidationResult result = validator.Validate(requestData);
                result.IsValid.Should().BeTrue();
                PEngine            engine       = new PEngine("iris-data.txt");
                var                trainedModel = engine.Train();
                IrisPredictedModel predicted    = trainedModel.Predict(requestData);


                response = new OkObjectResult($"Predicted flower type { predicted.PredictedLabel}");
            }
            catch (Exception ex)
            {
                response = new BadRequestObjectResult(ex.Message);
                log.Error(ex.Message);
            }
            return(response);
        }
Пример #2
0
 public Page1()
 {
     InitializeComponent();
     pathresulttohow = "";
     whn             = false;
     numberofQ       = 0;
     slist           = MainWindow.t.ConvertSymptomsToPredicate(MainWindow.t.ConvertToPredicate());
     pe          = new PEngine();
     synthesizer = new SpeechSynthesizer();
     synthesizer.SelectVoiceByHints(VoiceGender.Female);
     synthesizer.Volume = 100;
     synthesizer.Rate   = 0;
     cs[0]      = new colors(true, "#252839", "#677077", "#f2b632", "#b5b5b7");
     cs[1]      = new colors(false, "#30231d", "#6a5750", "#b5a379", "#f6f1ed");
     cs[2]      = new colors(true, "#262216", "#49412c", "#97743a", "#b0a18e");
     cs[3]      = new colors(false, "#16174f", "#963019", "#667467", "#f6f1ed");
     cs[4]      = new colors(true, "#1d2120", "#5a5c51", "#ba9077", "#bcd5d1");
     cs[5]      = new colors(false, "#173e43", "#3fb0ac", "#fae596", "#dddfd4");
     cs[6]      = new colors(false, "#6ed3cf", "#9068be", "#e62739", "#e1e8f0");
     colors     = 0;
     envrnomnet = 0;
     scale      = 1;
     x          = 0;
     y          = 0;
     //tb1.Text = ""+MainWindow.t.passvalue;
     repaint();
     //synthesizer.SpeakAsync("hellow");
 }
Пример #3
0
        /// <summary>
        /// initializes the platformer game
        /// </summary>
        protected override void Initialize()
        {
            //IsMouseVisible = true;
            Window.Title = "Geimu 2";
            ChangeResolution(1024, 768);

            Engine = new PEngine(this);
            PEngine.NameToType["obj_block"]        = typeof(BlockObject); //if there is a better way to go about doing this please tell
            PEngine.NameToType["obj_player"]       = typeof(PlayerObject);
            PEngine.NameToType["obj_item"]         = typeof(ItemObject);
            PEngine.NameToType["obj_upgrade"]      = typeof(UpgradeObject);
            PEngine.NameToType["obj_enemy"]        = typeof(EnemyObject);
            PEngine.NameToType["obj_boss"]         = typeof(BossObject);
            PEngine.NameToType["obj_win"]          = typeof(GameWinObject);
            PEngine.NameToType["obj_lose"]         = typeof(GameOverObject);
            PEngine.NameToType["obj_camera"]       = typeof(CameraObject);
            PEngine.NameToType["obj_crosshair"]    = typeof(CrosshairObject);
            PEngine.NameToType["obj_jumpparticle"] = typeof(JumpParticleObject);
            PEngine.NameToType["obj_jumpreset"]    = typeof(JumpResetObject);
            PEngine.NameToType["obj_goalblock"]    = typeof(GoalBlockObject);
            PEngine.NameToType["obj_fairy"]        = typeof(FairyObject);
            PEngine.NameToType["obj_damageblock"]  = typeof(DamageBlockObject);
            PEngine.NameToType["tle_stonebrick"]   = typeof(StoneBrickTile);
            PEngine.NameToType["tle_dirt"]         = typeof(DirtTile);
            PEngine.NameToType["tle_stone"]        = typeof(StoneTile);

            Engine.ChangeRoom((new Room(Engine)).Load("Levels/level2.json"));

            base.Initialize();
        }
Пример #4
0
 public SimpleView(BaseModel baseModel, GraphicsDeviceManager graphics, ContentManager content)
 {
     this.baseModel = baseModel;
     this.graphics  = graphics;
     this.gm        = (App)App.Instance;
     this.content   = content;
     //initializes the sprite batch
     spritebatch = new SpriteBatch(graphics.GraphicsDevice);
     //Loads the sprites
     enemy      = content.Load <Texture2D>("Drone");
     bulletNorm = content.Load <Texture2D>("bullet");
     bulletDisc = content.Load <Texture2D>("discbullet");
     bulletWide = content.Load <Texture2D>("widebullet");
     middle     = content.Load <Texture2D>("centre");
     try
     {
         middle0 = content.Load <Texture2D>("tower-0");
         middle1 = content.Load <Texture2D>("tower-1");
         middle2 = content.Load <Texture2D>("tower-2");
     }
     catch (Exception)
     {
         simpleMid = true;
     }
     gun1       = content.Load <Texture2D>("turret");
     gun2       = content.Load <Texture2D>("2turret");
     gun3       = content.Load <Texture2D>("3turret");
     boss       = content.Load <Texture2D>("spaceinvader");
     background = content.Load <Texture2D>("bg1");
     graphics.GraphicsDevice.Clear(Color.Black);
     //Initializes the bloom postprocessing with the device to display on
     bloom = new BloomPostprocess.BloomComponent(gm, graphics.GraphicsDevice);
     //Registers the bloom compenent to the list of compenents, it will be drawn AFTER the rest of the game.
     gm.Components.Add(bloom);
     particleEngine              = new PEngine(this);
     menuManager                 = new MenuDrawers.MenuManager();
     baseModel.Tower.ZeroHealth += new EventHandler(OnDeath);
 }
Пример #5
0
        public MainForm()
        {
            InitializeComponent();

            #region Window Settings
            this.WindowState     = FormWindowState.Normal;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Bounds          = Screen.PrimaryScreen.Bounds;

            this.BackColor = Color.Aquamarine;
            #endregion

            GameEngine_ = new PEngine();

            Start();

            // Gets a reference to the current BufferedGraphicsContext
            CurrentContext_ = BufferedGraphicsManager.Current;
            // Creates a BufferedGraphics instance associated with Form1, and with
            // dimensions the same size as the drawing surface of Form1.
            Buffer_ = CurrentContext_.Allocate(this.CreateGraphics(),
                                               this.DisplayRectangle);
        }
Пример #6
0
        /// <summary>
        /// initializes the platformer game
        /// </summary>
        protected override void Initialize()
        {
            IsMouseVisible = true;
            Window.Title   = "The Dark Halls";
            ChangeResolution(1024, 768);

            Engine = new PEngine(this);
            PEngine.NameToType["obj_block"]      = typeof(BlockObject); //if there is a better way to go about doing this please tell
            PEngine.NameToType["obj_player"]     = typeof(PlayerObject);
            PEngine.NameToType["obj_item"]       = typeof(ItemObject);
            PEngine.NameToType["obj_upgrade"]    = typeof(UpgradeObject);
            PEngine.NameToType["obj_enemy"]      = typeof(EnemyObject);
            PEngine.NameToType["obj_boss"]       = typeof(BossObject);
            PEngine.NameToType["obj_win"]        = typeof(GameWinObject);
            PEngine.NameToType["obj_lose"]       = typeof(GameOverObject);
            PEngine.NameToType["tle_stonebrick"] = typeof(StoneBrickTile);


            CurrentRoomX  = -1;
            CurrentRoomY  = -1;
            RoomMapWidth  = 12;
            RoomMapHeight = 12;
            RoomMap       = new Room[RoomMapWidth, RoomMapHeight];
            for (int i = 0; i < RoomMapWidth; i++)
            {
                for (int j = 0; j < RoomMapHeight; j++)
                {
                    RoomMap[i, j] = GetRandomDungeonRoom();
                }
            }
            Engine.LoadRoom("Levels\\startingroom.json");
            MaxTimerLength     = 60 * 40;
            Timer              = MaxTimerLength;
            BossAlreadySpawned = false;
            base.Initialize();
        }