so i have a mammoth of a code and still cant get out of silver…
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
class Player
{
static void Main(string[] args)
{
string[] inputs;
int b = 100;
int boost1 = 0;
int boost2 = 0;
int C1X = 0;
int C2X = 0;
int C3X = 0;
int C4X = 0;
int C5X = 0;
int C6X = 0;
int C7X = 0;
int C8X = 0;
int C9X = 0;
int C10X = 0;
int C1Y = 0;
int C2Y = 0;
int C3Y = 0;
int C4Y = 0;
int C5Y = 0;
int C6Y = 0;
int C7Y = 0;
int C8Y = 0;
int C9Y = 0;
int C10Y = 0;
int checkpoints = 0;
string nextcheckpoint = "";
bool checkpointhaschanged = false;
bool assignedcheckpoint = false;
bool allcheckpointsfound = false;
int lastcheckpointx = 0;
int lastcheckpointy = 0;
double checkpointangle = 0;
float cpanglepercentage = 0;
int overnextcpx = 0;
int overnextcpy = 0;
int turndist = 0;
int boost = 1;
bool usedboost = false;
int wasx = 600;
int wasy = 200;
double wasa = 90;
int startup = 5;
// game loop
while (true)
{
inputs = Console.ReadLine().Split(' ');
int x = int.Parse(inputs[0]);
int y = int.Parse(inputs[1]);
int ncx = int.Parse(inputs[2]); // x position of the next check point
int ncy = int.Parse(inputs[3]); // y position of the next check point
int ncd = int.Parse(inputs[4]); // distance to the next checkpoint
int nca = int.Parse(inputs[5]); // angle between your pod orientation and the direction of the next checkpoint
inputs = Console.ReadLine().Split(' ');
int opx = int.Parse(inputs[0]);
int opy = int.Parse(inputs[1]);
b = 100;
checkpointhaschanged = false;
assignedcheckpoint = false;
bool usedability = false;
if (nextcheckpoint != (ncx+" "+ncy)){
nextcheckpoint = ncx+" "+ncy;
checkpointhaschanged = true;
if (ncx == C1X && ncy == C1Y){
allcheckpointsfound = true;
}
}
if (checkpointhaschanged == true){
if (ncx != C1X && ncy != C1Y && allcheckpointsfound == false){
if (C1X == 0 && C1Y == 0){
checkpoints = 1;
C1X = ncx;
C1Y = ncy;
assignedcheckpoint = true;
}
if (assignedcheckpoint==false && C2X == 0 && C2Y == 0){
checkpoints = 2;
C2X = ncx;
C2Y = ncy;
assignedcheckpoint = true;
}
if (assignedcheckpoint==false && C3X == 0 && C3Y == 0){
checkpoints = 3;
C3X = ncx;
C3Y = ncy;
assignedcheckpoint = true;
}
if (assignedcheckpoint==false && C4X == 0 && C4Y == 0){
checkpoints = 4;
C4X = ncx;
C4Y = ncy;
assignedcheckpoint = true;
}
if (assignedcheckpoint==false && C5X == 0 && C5Y == 0){
checkpoints = 5;
C5X = ncx;
C5Y = ncy;
assignedcheckpoint = true;
}
if (assignedcheckpoint==false && C6X == 0 && C6Y == 0){
checkpoints = 6;
C6X = ncx;
C6Y = ncy;
assignedcheckpoint = true;
}
if (assignedcheckpoint==false && C7X == 0 && C7Y == 0){
checkpoints = 7;
C7X = ncx;
C7Y = ncy;
assignedcheckpoint = true;
}
if (assignedcheckpoint==false && C8X == 0 && C8Y == 0){
checkpoints = 8;
C8X = ncx;
C8Y = ncy;
assignedcheckpoint = true;
}
if (assignedcheckpoint==false && C9X == 0 && C9Y == 0){
checkpoints = 9;
C9X = ncx;
C9Y = ncy;
assignedcheckpoint = true;
}
if (assignedcheckpoint==false && C10X == 0 && C10Y == 0){
checkpoints = 10;
C10X = ncx;
C10Y = ncy;
}
}
}
//------------------------------------------------------------------------------
if (allcheckpointsfound == true){
if (ncx == C1X && ncy == C1Y && checkpoints >= 1){
if (checkpoints == 2){
lastcheckpointx = C2X;
lastcheckpointy = C2Y;
}
if (checkpoints == 3){
lastcheckpointx = C3X;
lastcheckpointy = C3Y;
}
if (checkpoints == 4){
lastcheckpointx = C4X;
lastcheckpointy = C4Y;
}
if (checkpoints == 5){
lastcheckpointx = C5X;
lastcheckpointy = C5Y;
}
if (checkpoints == 6){
lastcheckpointx = C6X;
lastcheckpointy = C6Y;
}
if (checkpoints == 7){
lastcheckpointx = C7X;
lastcheckpointy = C7Y;
}
if (checkpoints == 8){
lastcheckpointx = C8X;
lastcheckpointy = C8Y;
}
if (checkpoints == 9){
lastcheckpointx = C9X;
lastcheckpointy = C9Y;
}
if (checkpoints == 10){
lastcheckpointx = C10X;
lastcheckpointy = C10Y;
}
}
if (ncx == C2X && ncy == C2Y && checkpoints >= 2){
lastcheckpointx = C1X;
lastcheckpointy = C1Y;
}
if (ncx == C3X && ncy == C3Y && checkpoints >= 3){
lastcheckpointx = C2X;
lastcheckpointy = C2Y;
}
if (ncx == C4X && ncy == C4Y && checkpoints >= 4){
lastcheckpointx = C3X;
lastcheckpointy = C3Y;
}
if (ncx == C5X && ncy == C5Y && checkpoints >= 5){
lastcheckpointx = C4X;
lastcheckpointy = C4Y;
}
if (ncx == C6X && ncy == C6Y && checkpoints >= 6){
lastcheckpointx = C5X;
lastcheckpointy = C5Y;
}
if (ncx == C7X && ncy == C7Y && checkpoints >= 7){
lastcheckpointx = C6X;
lastcheckpointy = C6Y;
}
if (ncx == C8X && ncy == C8Y && checkpoints >= 8){
lastcheckpointx = C7X;
lastcheckpointy = C7Y;
}
if (ncx == C9X && ncy == C9Y && checkpoints >= 9){
lastcheckpointx = C8X;
lastcheckpointy = C8Y;
}
if (ncx == C10X && ncy == C10Y && checkpoints >= 10){
lastcheckpointx = C9X;
lastcheckpointy = C9Y;
}
if (ncx == C1X && ncy == C1Y && checkpoints > 1){
overnextcpx = C2X;
overnextcpy = C2Y;
}
else if (ncx == C2X && ncy == C2Y && checkpoints > 2){
overnextcpx = C3X;
overnextcpy = C3Y;
}
else if (ncx == C3X && ncy == C3Y && checkpoints > 3){
overnextcpx = C4X;
overnextcpy = C4Y;
}
else if (ncx == C4X && ncy == C4Y && checkpoints > 4){
overnextcpx = C5X;
overnextcpy = C5Y;
}
else if (ncx == C5X && ncy == C5Y && checkpoints > 5){
overnextcpx = C6X;
overnextcpy = C6Y;
}
else if (ncx == C6X && ncy == C6Y && checkpoints > 6){
overnextcpx = C7X;
overnextcpy = C7Y;
}
else if (ncx == C7X && ncy == C7Y && checkpoints > 7){
overnextcpx = C8X;
overnextcpy = C8Y;
}
else if (ncx == C8X && ncy == C8Y && checkpoints > 8){
overnextcpx = C9X;
overnextcpy = C9Y;
}
else if (ncx == C9X && ncy == C9Y && checkpoints > 9){
overnextcpx = C10X;
overnextcpy = C10Y;
}
else{
overnextcpx = C1X;
overnextcpy = C1Y;
}
if (ncx == C10X && ncy == C10Y){
overnextcpx = C1X;
overnextcpy = C1Y;
}
double dif1to2x = x - ncx;
if (dif1to2x<0) {dif1to2x = dif1to2x * -1;}
double dif1to2y = y - ncy;
if (dif1to2y<0) {dif1to2y = dif1to2y * -1;}
double leng1to2 = Math.Sqrt((dif1to2x*dif1to2x)+(dif1to2y*dif1to2y));
double dif1to3x = x - overnextcpx;
if (dif1to3x<0) {dif1to3x = dif1to3x * -1;}
double dif1to3y = y - overnextcpy;
if (dif1to3y<0) {dif1to3y = dif1to3y * -1;}
double leng1to3 = Math.Sqrt((dif1to3x*dif1to3x)+(dif1to3y*dif1to3y));
double dif2to3x = ncx - overnextcpx;
if (dif2to3x<0) {dif2to3x = dif2to3x * -1;}
double dif2to3y = ncy - overnextcpy;
if (dif2to3y<0) {dif2to3y = dif2to3y * -1;}
double leng2to3 = Math.Sqrt((dif2to3x*dif2to3x)+(dif2to3y*dif2to3y));
double a1 = 0-((leng1to3*leng1to3)/(2*leng2to3*leng1to2));
double a2 = (leng2to3/(2*leng1to2));
double a3 = (leng1to2/(2*leng2to3));
checkpointangle = Math.Acos(a1+a2+a3);
if (checkpointangle > 180){
checkpointangle = 180-(checkpointangle-180);
}
cpanglepercentage = (float)(checkpointangle/1.8);
Console.Error.WriteLine("checkpointangle= "+((int)(checkpointangle*100)).ToString());
Console.Error.WriteLine("cpanglepercentage= "+((int)(cpanglepercentage*100)).ToString());
dif1to2x = lastcheckpointx - ncx;
if (dif1to2x<0) {dif1to2x = dif1to2x * -1;}
dif1to2y = lastcheckpointy - ncy;
if (dif1to2y<0) {dif1to2y = dif1to2y * -1;}
leng1to2 = Math.Sqrt((dif1to2x*dif1to2x)+(dif1to2y*dif1to2y));
turndist = (int)(leng1to2 * (cpanglepercentage/100));
double a1x = lastcheckpointx - ncx;
if (a1x<0) {a1x=a1x*-1;}
double a1y = lastcheckpointy - ncy;
if (a1y<0) {a1y=a1y*-1;}
double c1 = Math.Sqrt((a1x*a1x)+(a1y*a1y));
Console.Error.WriteLine("between last and me= "+c1.ToString());
double b1x = x - ncx;
if (b1x<0) {b1x=b1x*-1;}
double b1y = y - ncy;
if (b1y<0) {b1y=b1y*-1;}
double a12 = Math.Sqrt((b1x*b1x)+(b1y*b1y));
Console.Error.WriteLine("between next and last= "+a12.ToString());
double c1x = lastcheckpointx - x;
if (c1x<0){c1x=c1x*-1;}
double c1y = lastcheckpointy - y;
if (c1y<0){c1y=c1y*-1;}
double b1 = Math.Sqrt((c1x*c1x)+(c1y*c1y));
Console.Error.WriteLine("between me and next= "+b1.ToString());
double a23 = 0-((a12*a12)/(2*b1*c1));
double b2 = (b1/(2*c1));
double c2 = (c1/(2*b1));
wasa = Math.Acos(a23+b2+c2);
if (wasa>180){
wasa = 180-(wasa-180);
}
Console.Error.WriteLine("wasa= "+wasa.ToString());
}
Console.Error.WriteLine("Last cp= "+lastcheckpointx.ToString()+" "+lastcheckpointy.ToString());
Console.Error.WriteLine("next cp= "+ncx.ToString()+" "+ncy.ToString());
Console.Error.WriteLine("overnext cp= "+overnextcpx.ToString()+" "+overnextcpy.ToString());
// Write an action using Console.WriteLine()
// To debug: Console.Error.WriteLine(""+.ToString());
// you have to output the target position
// followed by the power (0 <= thrust <= 100) or "BOOST" or "SHIELD"
// i.e.: "x y thrust"
if (allcheckpointsfound == true){
Console.Error.WriteLine("turn dist= "+turndist.ToString());
if (turndist < 0){
turndist = turndist * -1;
}
turndist = turndist * 50;
if (turndist > 2000){
turndist = 2000;
}
if (ncd<turndist){
ncx = overnextcpx;
ncy = overnextcpy;
}
}
if (startup==0){
//b = (int)(100-(wasa/1.8));
b = 100-((nca/180)*100);
Console.Error.WriteLine("boost= "+b.ToString());
if (b<0){b=b*-1;}
Console.Error.WriteLine("boost= "+b.ToString());
}
if (b>90){
b=100;
}
Console.Error.WriteLine("boost= "+b.ToString());
if (startup>0){
b=100;
startup=startup-1;
}
if (nca == 0 && ncd > 3500 && allcheckpointsfound == true && boost == 1){
Console.WriteLine(ncx + " " + ncy + " BOOST");
boost = 0;
usedability = true;
usedboost = true;
}
if (usedability == false){
Console.WriteLine(ncx + " " + ncy + " " + b.ToString());
}
Console.Error.WriteLine("Checkpoints= "+checkpoints.ToString());
Console.Error.WriteLine("allcheckpointsfound? "+allcheckpointsfound.ToString());
Console.Error.WriteLine("boost= "+b.ToString());
Console.Error.WriteLine("turn dist= "+turndist.ToString());
Console.Error.WriteLine("usedboost? "+usedboost.ToString());
wasx = x;
wasy = y;
}
}
}
pls someone help