示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            DataExample dataExample = db.DataExamples.Find(id);

            db.DataExamples.Remove(dataExample);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "ID,NameType,Info")] DataExample dataExample)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dataExample).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(dataExample));
 }
示例#3
0
        public ActionResult Create([Bind(Include = "ID,NameType,Info")] DataExample dataExample)
        {
            if (ModelState.IsValid)
            {
                db.DataExamples.Add(dataExample);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(dataExample));
        }
示例#4
0
        // GET: DataExamples/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DataExample dataExample = db.DataExamples.Find(id);

            if (dataExample == null)
            {
                return(HttpNotFound());
            }
            return(View(dataExample));
        }
示例#5
0
    DataExample AIPredict(out int index)
    {
        double[] inputData = FieldToDataSet();
        var      result    = neyralNetwork.GetResult(inputData).ToList();

        index = result.ToList().IndexOf(result.Max());
        if (game.Field[index, game.FieldSize.Y - 1] == CellInfo.Blank)
        {
            result[index] = 1;
            return(new DataExample(inputData, result.ToArray()));
        }
        else
        {
            result[index] = 0;
            var data = new DataExample(inputData, result.ToArray());
            for (int i = 0; i < LearnCount; i++)
            {
                neyralNetwork.Learn(data);
            }
            return(AIPredict(out index));
        }
    }
    void CreateFile(List <Vector3> recordedData)
    {
        m_fileLocation = Application.streamingAssetsPath + Config.NEURAL_NET_PATH + "CustomGesture" + "/Gestures/";

        System.IO.Directory.CreateDirectory(m_fileLocation);

        if (recordedData.Count >= 1)
        {
            DataExample saveMe = new DataExample();
            saveMe.gestureName    = m_gestureName;
            saveMe.gestureData    = recordedData;
            saveMe.timeSinceStart = Time.time.ToString();
            //      saveMe.timestamp = System.DateTime.Now.ToString();
            saveMe.speechData = "";
            saveMe.state      = m_currentPresentationState.ToString();

            using (System.IO.StreamWriter file = new System.IO.StreamWriter(m_fileLocation + m_gestureName + ".txt"))
            {
                file.WriteLine(JsonUtility.ToJson(saveMe, true));
            }
        }
    }