Exemplo n.º 1
0
 public RaceCarState(int iX, int iY, int iXVelocity, int iYVelocity, RaceTrack rt)
 {
     X            = iX;
     Y            = iY;
     m_iXVelocity = iXVelocity;
     m_iYVelocity = iYVelocity;
     m_rtTrack    = rt;
 }
Exemplo n.º 2
0
 public RaceCarState(int iX, int iY, int iXVelocity, int iYVelocity, RaceTrack rt)
 {
     X = iX;
     Y = iY;
     m_iXVelocity = iXVelocity;
     m_iYVelocity = iYVelocity;
     m_rtTrack = rt;
 }
Exemplo n.º 3
0
 internal RaceViewer(RaceTrack rt)
 {
     InitializeComponent();
     m_rtTrack = rt;
     Size = new Size(m_rtTrack.Width * SCALE + 50, 100 + m_rtTrack.Height * SCALE);
     TrackPictureBox.Size = new Size(m_rtTrack.Width * SCALE, m_rtTrack.Height * SCALE);
     RefreshForm = new RefreshDelegate(RefreshFormMethod);
     HideForm = new HideDelegate(HideFormMethod);
     CarState = null;
     StateValues = null;
     SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.AllPaintingInWmPaint, true);
     Active = false;
     m_bThreadRunning = false;
     CurretnUpdateState = null;
 }
Exemplo n.º 4
0
 internal RaceViewer(RaceTrack rt)
 {
     InitializeComponent();
     m_rtTrack            = rt;
     Size                 = new Size(m_rtTrack.Width * SCALE + 50, 100 + m_rtTrack.Height * SCALE);
     TrackPictureBox.Size = new Size(m_rtTrack.Width * SCALE, m_rtTrack.Height * SCALE);
     RefreshForm          = new RefreshDelegate(RefreshFormMethod);
     HideForm             = new HideDelegate(HideFormMethod);
     CarState             = null;
     StateValues          = null;
     SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.AllPaintingInWmPaint, true);
     Active             = false;
     m_bThreadRunning   = false;
     CurretnUpdateState = null;
 }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            FileStream fs = new FileStream("Debug.txt", FileMode.Create);

            Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
            Debug.Listeners.Add(new TextWriterTraceListener(fs));

            RaceTrack    rc   = new RaceTrack("RaceTrack1.bmp");//change here to a different race BMP: 2 is very small, 3 is very large
            RandomPolicy p    = new RandomPolicy(rc);
            RaceViewer   form = new RaceViewer(rc);

            form.Start();
            //rc.DrawRace(p, form);

            ValueFunction vi1 = new ValueFunction(rc);
            ValueFunction vi2 = new ValueFunction(rc);
            ValueFunction vi3 = new ValueFunction(rc);
            int           cUpdates1 = 0, cUpdates2 = 0, cUpdates3 = 0;
            TimeSpan      ts1, ts2, ts3;

            form.StateValues = vi3;
            //  vi3.RealTimeDynamicProgramming(100, out cUpdates3, out ts3);

            form.StateValues = vi1;
            vi1.ValueIteration(0.5, out cUpdates1, out ts1);

            form.StateValues = vi2;
            //vi2.PrioritizedValueIteration(0.5, out cUpdates2, out ts2);
            rc.DrawRace(vi3, form);

            double dADR1 = rc.ComputeAverageDiscountedReward(vi1, 1000, 100);
            double dADR2 = rc.ComputeAverageDiscountedReward(vi2, 1000, 100);
            double dADR3 = rc.ComputeAverageDiscountedReward(vi3, 1000, 100);

            Debug.Close();
        }
Exemplo n.º 6
0
 public RaceCarState(int iX, int iY, RaceTrack rt)
     : this(iX, iY, 0, 0, rt)
 {
 }
Exemplo n.º 7
0
 public RaceCarState(int iX, int iY, RaceTrack rt)
     : this(iX, iY, 0, 0, rt)
 {
 }