private void OnMove() { var inputs = new double[m_Sensors.Count]; for (int i = 0; i < inputs.Length; i++) { inputs[i] = m_Sensors[i].GetDistance(); } m_Net.Calculate(inputs); }
private void OnMove() { var inputs = new double[m_Sensors.Count]; for (int i = 0; i < inputs.Length; i++) { inputs[i] = m_Sensors[i].GetDistance(); } m_Net.Calculate(inputs); if (m_UseTrain) { var outputs = new double[4] { m_Snake.MoveUp, m_Snake.MoveRight, m_Snake.MoveDown, m_Snake.MoveLeft }; var data = new DataSet() { input = inputs, output = outputs }; Train(data); } }