/** * This function returns the time series tuple for the current frame. * formate:"ts,mID,mDiff,mType,Lx,Ly,Rx,Ry,Bx,By,Lvel,Rvel,Bvel,Plen,H1input,H2input,composInput,Lscore,Rscore\n" * ts: timestamp * mID: match ID * mDiff: match difficulty * mType: match type * Lx,Ly: left paddle x and y position * Rx,Ry: right paddle x and y position * Bx,By: ball x and y position * Lvel: left paddle velocity * Rvel: right paddle velocity * Bvel: ball velocity * Plen: paddle length * H1input: human 1 input * H2input: human 2 input (if not applicable, then value is 9999) * composInput: composite input of both human players (if not applicable, then value is 9999) * Lscore: left paddle score * Rscore: right paddle score * */ public static string GetTimeSeriesTuple() { string t; Vector2 garbage = BallUtils.GetBallVelocity(); //TODO: please figure out why removing this breaks everything t = GeneralUtils.GetTimeStamp() + "," + GeneralUtils.m_dataScript.currMatchNum.ToString() + "," + GeneralUtils.GetCurrentMatch().difficulty.ToString() + "," + GeneralUtils.GetCurrentConfig().ToString() + "," + GeneralUtils.GetHumanPosition().x.ToString() + "," + GeneralUtils.GetHumanPosition().y.ToString() + "," + GeneralUtils.GetAgentPosition().x.ToString() + "," + GeneralUtils.GetAgentPosition().y.ToString() + "," + BallUtils.GetBallPosition().x.ToString() + "," + BallUtils.GetBallPosition().y.ToString() + "," + VelocityUtils.GetVelocity("leftPaddle").ToString() + "," + VelocityUtils.GetVelocity("rightPaddle").ToString() + "," + VelocityUtils.GetVelocity("ball").ToString() + "," + GeneralUtils.GetPaddleSize("Left") + "," + GeneralUtils.GetPaddleSize("Right") + "," + GeneralUtils.GetHumanInput(1).ToString() + "," + GeneralUtils.GetHumanInput(2).ToString() + "," + GeneralUtils.GetHumanInput(3).ToString() + "," + GeneralUtils.GetPlayerScore("Left").ToString() + "," + GeneralUtils.GetPlayerScore("Right").ToString() + "\n"; return(t); }
/** * This function calculates the destination of the agent paddle. */ public static Vector2 GetAgentDestination() { Vector2 intersection; Vector2 b = BallUtils.GetBallPosition(); Vector2 v = BallUtils.GetBallVelocity(); float m = (v.x == 0 ? 0 : (v.y / v.x)); float x_dest = 42.47662F; float y_intercept = ((-1F * b.x * v.y) / v.x) + b.y; intersection = new Vector2(x_dest, m * x_dest + y_intercept); return(intersection); }