Skip to content

Jozi-JUG/code-rally-2017-10

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started With Code Rally

Introduction

CodeRally is a competitive coding challenge where you develop a rally car to compete against other cars. Your ability to develop a good algorithm will make the difference.

Requirements

  • Java 8
  • Eclipse Oxygen JEE

Installation

This document has a more detailed description that the steps below.

Your First Car

Some people have experienced issue with the Intermediate car. This is the kind that the plugin will generate when you create your first agent car.

Always start the WebSphere Liberty Server before creating a car or making any changes to your car. It seems once the plugin has failed to connect it doesn't try again.

This is a very basic car. You can change the behaviour by remove call to super and performing alternative logic.

import com.ibm.coderally.agent.DefaultCarAIAgent;
import com.ibm.coderally.api.agent.AIUtils;
import com.ibm.coderally.entity.cars.agent.Car;
import com.ibm.coderally.entity.obstacle.agent.Obstacle;
import com.ibm.coderally.geo.agent.CheckPoint;
import com.ibm.coderally.track.agent.Track;

public class VeryBasicCar extends DefaultCarAIAgent {

	@Override
	public void onCarCollision(Car other) {
		super.onCarCollision(other);		
	}

	@Override
	public void onCheckpointUpdated(CheckPoint oldCheckpoint) {
		getCar().setBrakePercent(0);
		getCar().setAccelerationPercent(100);
		getCar().setTarget(AIUtils.getClosestLane(getCar().getCheckpoint(), getCar().getPosition()));
	}

	@Override
	public void onObstacleInProximity(Obstacle obstacle) {
		super.onObstacleInProximity(obstacle);		
	}

	@Override
	public void onOnTrack() {
        super.onOnTrack();		
	}
	
	@Override
	public void onOffTrack() {
		super.onOffTrack();		
	}

	@Override
	public void onOpponentInProximity(Car car) {
		super.onOpponentInProximity(car);		
	}

	@Override
	public void onRaceStart() {

		// Replace with custom logic or remove method for default implementation.

		getCar().setBrakePercent(0);
		getCar().setAccelerationPercent(100);
		getCar().setTarget(AIUtils.getClosestLane(getCar().getCheckpoint(), getCar().getPosition()));
		
	}

	@Override
	public void onTimeStep() {		
		
		AIUtils.recalculateHeading(getCar());
	}

	@Override
	public void init(Car car, Track track) {
		super.init(car, track);		
	}

	@Override
	public void onObstacleCollision(Obstacle obstacle) {
		super.onObstacleCollision(obstacle);
	}

	@Override
	public void onStalled() {
        super.onStalled();		
	}
}

GameServer

Visit http://rally.cloudafrica.net:9080/CodeRallyWeb/

About

Getting Started With Code Rally

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published