Commit b8f3a676 authored by Mikko Lainio's avatar Mikko Lainio 🇺🇦
Browse files

updated demo score values based on updated simulation.

parent 1399105c
......@@ -918,7 +918,7 @@ MonoBehaviour:
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_textAlignment: 257
m_textAlignment: 514
m_isAlignmentEnumConverted: 1
m_characterSpacing: 0
m_wordSpacing: 0
......@@ -1446,17 +1446,17 @@ MonoBehaviour:
key0: {r: 1, g: 0.14010851, b: 0, a: 1}
key1: {r: 1, g: 0.81733686, b: 0, a: 1}
key2: {r: 0.73315376, g: 0.9622642, b: 0, a: 0}
key3: {r: 0.4292453, g: 0.84300077, b: 1, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0.9130335, b: 1, a: 0}
key4: {r: 1, g: 1, b: 1, a: 0}
key5: {r: 1, g: 1, b: 1, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 21627
ctime2: 43908
ctime3: 65535
ctime4: 0
ctime5: 0
ctime1: 16384
ctime2: 32768
ctime3: 49151
ctime4: 65535
ctime5: 65535
ctime6: 0
ctime7: 0
atime0: 0
......@@ -1468,9 +1468,9 @@ MonoBehaviour:
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 4
m_NumColorKeys: 5
m_NumAlphaKeys: 2
MaxGradientThreshold: 50
MaxGradientThreshold: 100
TimeSteps: 2000
--- !u!1 &798756958
GameObject:
......
......@@ -25,11 +25,12 @@ public class CubeController : MonoBehaviour
void Awake()
{
QuantumDemoManager.RegisterController(this, cPosition);
m_defaultPos = transform.position;
}
void Start()
private void OnEnable()
{
m_defaultPos = transform.position;
transform.position = m_defaultPos;
}
// Update is called once per frame
......
......@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using Python.Runtime;
using UnityEditor.U2D;
public class QuantumDemoManager : MonoBehaviour
{
......@@ -35,7 +36,8 @@ public class QuantumDemoManager : MonoBehaviour
[SerializeField] private GameObject StartTextObject;
[SerializeField] private Gradient m_rewardGradient;
[SerializeField] private float MaxGradientThreshold = 10f;
private List<float> m_growth = new List<float>(10);
public int TimeSteps = 400;
private float m_score;
......@@ -152,6 +154,18 @@ public class QuantumDemoManager : MonoBehaviour
rightScale.y = result.Observation[1] * 3f;
float growth = rightScale.y - lastRightScale;
if (m_growth.Count > 10)
m_growth.RemoveAt(0);
m_growth.Add(growth);
growth = 0f;
foreach (float g in m_growth)
{
growth += g;
}
growth /= m_growth.Count;
m_left.transform.localScale = leftScale;
m_right.transform.localScale = rightScale;
......@@ -161,13 +175,13 @@ public class QuantumDemoManager : MonoBehaviour
//m_left.transform.position = new Vector3(lPos * 2, 0f, 0f) + Vector3.left * 2f;
//m_right.transform.position = new Vector3(rPos * 2, 0f, 0f) + Vector3.right * 2f;
SetScore(result.Reward, growth*100000f);
SetScore(result.Reward, growth*10000f);
return result.Done;
}
private void SetScore(float score, float growth)
{
m_score += score * 10000;
m_score += score;
if (m_scoreText != null)
{
m_scoreText.text = "SCORE: " + m_score.ToString("F0");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment