void Test() { // build input List <Matrix <double> > xs = new List <Matrix <double> >(); for (LinkedListNode <Vector3> i = inputs.First; i != inputs.Last.Next; i = i.Next) { Matrix <double> x = Matrix <double> .Build.Dense(1, inputDim); x[0, 0] = i.Value.x; x[0, 1] = i.Value.y; x[0, 2] = i.Value.z; xs.Add(x); } // predict List <Matrix <double> > ys; rnn.Predict(xs, out ys); // the least recently result Matrix <double> y = ys[ys.Count - 1]; // this is not only the orientation, magnitude is aslo involved Vector2 inputDirection = new Vector2((float)(y[0, 0] - 0.5) * 2, (float)(y[0, 1] - 0.5) * 2); // make the predict result visible on the joystick Joystick.Instance.SetDirection(inputDirection); // if there is a movement, move the player if (Joystick.Instance.InputDirection != Vector2.zero) { Vector3 direction = new Vector3(-Joystick.Instance.InputDirection.x, 0, Joystick.Instance.InputDirection.y); direction = eye.transform.TransformDirection(direction); GetComponent <Rigidbody>().transform.position += new Vector3(direction.x, 0, direction.z) * speed; } }