int oppenentXCheckpoint = opponentX-nextCheckpointX;
int oppenentYCheckpoint = opponentY-nextCheckpointY;
int opponentCheckpointDist =(int)Math.sqrt(oppenentXCheckpointoppenentXCheckpoint+oppenentYCheckpointoppenentYCheckpoint);
Hello, Iām struggling in the bronze league, can someone help me, I canāt get through! Here is my current code:
import sys
import math
Auto-generated code below aims at helping you parse
the standard input according to the problem statement.
use = False
game loop
while True:
# next_checkpoint_x: x position of the next check point
# next_checkpoint_y: y position of the next check point
# next_checkpoint_dist: distance to the next checkpoint
# next_checkpoint_angle: angle between your pod orientation and the direction of the next checkpoint
x, y, next_checkpoint_x, next_checkpoint_y, next_checkpoint_dist, next_checkpoint_angle = [int(i) for i in input().split()]
opponent_x, opponent_y = [int(i) for i in input().split()]
# Write an action using print
# To debug: print("Debug messages...", file=sys.stderr, flush=True)
radian = math.radians(next_checkpoint_angle)
puissance=math.cos(radian)
puissance=int(puissance*100)
#if next_checkpoint_dist<=1000 :
# puissance = 0
if puissance<0 :
puissance = 0
# You have to output the target position
# followed by the power (0 <= thrust <= 100)
# i.e.: "x y thrust"
if next_checkpoint_angle == 0 and use == False and next_checkpoint_dist>=4000:
print(next_checkpoint_x,next_checkpoint_y,"BOOST")
use = True
else :
print(next_checkpoint_x,next_checkpoint_y,puissance)
So I managed to hit Silver without any AI algorithms. Is it normal that I hit a wall in order to get to Gold, and I have to start using other, better algorithms? I see the assignment specifically says āgenetic programmingā. Was the idea to use something like that from the beginning?
I could really use some pointers here! This is all new for me.
How to fix this code
#include
#include
#include
template<> std::initializer_list std::āincludesā std::iostream;
include
#include
using namespace std;
void f(const liststd::string &slst)
{
for (auto s : slst)
cout << s << endl;
}
int main()
{
f({ āGoodā, āmorningā, ā!ā });
system(āpauseā);
return 0;
}
range_access.h(71, 5): Possible target for call
range_access.h(81, 5): Possible target for call
range_access.h(100, 5): Possible target for call
range_access.h(109, 31): Possible target for call
range_access.h(110, 37): Possible target for call
initializer_list(101, 5): āstd::endā declared here
using namespace std;
/**
- Auto-generated code below aims at helping you parse
- the standard input according to the problem statement.
**/
int main() {
// game loop
while (1) {
int x;
int y;
int next_checkpoint_x; // x position of the next check point
int next_checkpoint_y; // y position of the next check point
int next_checkpoint_dist; // distance to the next checkpoint
int next_checkpoint_angle; // angle between your pod orientation and the
// direction of the next checkpoint
cin >> x >> y >> next_checkpoint_x >> next_checkpoint_y >>
next_checkpoint_dist >> next_checkpoint_angle;
cin.ignore();
int opponent_x;
int opponent_y;
cin >> opponent_x >> opponent_y;
cin.ignore();
// Write an action using cout. DON'T FORGET THE "<< endl"
// To debug: cerr << "Debug messages..." << endl;
// You have to output the target position
// followed by the power (0 <= thrust <= 100)
// i.e.: "x y thrust"
cout << next_checkpoint_x << " " << next_checkpoint_y << " 80" << endl;
if('next_Checkpoint_Angle > 90')
(next_checkpoint_angle < -90);
else
extracted();
100; std::end; if print x y
}
}
hi im new idk how to code
Hey I am stuck on get more acceleration I am doing C#
Hey there! I just hit the Silver , and Iām super excited but a little unsure about the next steps. Any tips on how to make the most of this new league level? Thanks! (Iām using Python 3)
My code:
import sys
import math
Auto-generated code below aims at helping you parse
the standard input according to the problem statement.
game loop
while True:
# next_checkpoint_x: x position of the next check point
# next_checkpoint_y: y position of the next check point
# next_checkpoint_dist: distance to the next checkpoint
# next_checkpoint_angle: angle between your pod orientation and the direction of the next checkpoint
x, y, next_checkpoint_x, next_checkpoint_y, next_checkpoint_dist, next_checkpoint_angle = [int(i) for i in input().split()]
opponent_x, opponent_y = [int(i) for i in input().split()]
# Write an action using print
# To debug: print("Debug messages...", file=sys.stderr, flush=True)
if next_checkpoint_angle > 90 or next_checkpoint_angle < -90:
print(str(next_checkpoint_x) + " " + str(next_checkpoint_y) + " 0")
else:
if next_checkpoint_dist >= 3000:
print(str(next_checkpoint_x) + " " + str(next_checkpoint_y) + " BOOST")
elif next_checkpoint_dist <=1000:
print(str(next_checkpoint_x) + " " + str(next_checkpoint_y) + " 60")
else:
print(str(next_checkpoint_x) + " " + str(next_checkpoint_y) + " 100")
Hi thereā¦
Since few days iām stuck in silver leagueā¦Any tips for help me to progress?
Thanks!!
Hi, how can you get the pods position? Thanks.
what is the code for the mad pod racing
It looks like the next_checkpoint_angle is off. My pod is flying perpendicular to the next checkpoint direction and I got ~66° only. Makes it pretty hard to get the actual direction
Do you have any method to organize code using multiple files when working on CodinGame?
Pyright is a type checker for Python. It helps keep your code strongly typed even though Python is not strongly typed. Probably not needed too much for CodinGame.
Yes, I feel this struggle. I like to start fresh after long breaks or starting with new languages as well. I usually just delete my account and start over when I am at that point. You lose all progress, but you can redo the leagues from scratch.
I want codingame to add html
Iāve been stuck on Wood 2 forever. I always get beat on the turns, because as I turn my bot keeps drifting. Iām using python and I have no idea how to progress
If you get next_checkpoint_angle too far from 0 (in either positive or negative), slow a bit down. Also slow down when next_checkpoint_dist<1000, youāll still get the momentum but wonāt drift in the bad direction when aiming to the next checkpoint.
If you are a few steps from the checkpoint, move the checkpoint by subtracting your ship velocity from it and aim for that point instead of the actual checkpoint. This should give you a much better line. And like azerty 04 said, slow down when close. If the angle is over 90 you will just circle the checkpoint
Subtract your own velocity from the target destination coordinates before you pass them. Youāll need to subtract your previous frame x and y from the current x and y in the leagues below gold to get your velocity. In Gold, youāll be given vx and vy for each of your two ships and things get way more complicated because youāll start wanting to use one ship to run interference for the other ship.
I managed to get through all the leagues to gold in my first day on the site (gold was awarded just after midnight for me today and I only signed up 18 hours ago).
How do you code it, in python, to slow down your pod? When I have it as
if next_checkpoint_angle > 180 or next_checkpoint_angle < -180:
thrust = 0
else:
thrust = 100
if next_checkpoint_dist < 1000 or next_checkpoint_dist > -1000:
thrust = 0
else:
thrust = 100
nothing ends up changing with the thrust, it doesnāt decrease and always stays at 100 power.