Code Monkey home page Code Monkey logo

google-hashcode-2018-live-simulation's Introduction

Google Hash Code 2018 : live simulation

goreport CircleCI License Forks Stars Twitter

Introduction

Some context on the competition:

We are given a list of pre-booked rides in a city and a fleet of self-driving vehicles. The objective of the competition is to assign the rides to vehicles, so that riders get to their destinations on time.

The competition subject

Guide to better understanding the animation

Illustration Explanation
driver A red dot is a car.
failed-trip The red line is a representation of a failed trip. The car arrived late.
will-complete Preview Preview A blue line is a trip in progress. You can see the car going through.
will-complete will-complete A green line is a completed trip.
assigned A grey line means that a driver is assigned to the trip.
waiting A yellow line means that the driver is ready, but it's too early to start the ride.

Important: we are only showing the assigned trips. If you press [T] you can toggle off/on the unassigned ones.

off on

Preview

Preview

Installation

$> make deps
$> make

Requirements

Running

flag required explanation
-o โœ… path to the output file you have generated with your program during the hashcode
-i โœ… corresponding input file, ex: b_should_be_easy.in
-noGui you can run the simulation withtout a graphic interface. This will only output your score
-h display help

Example with a Graphic Interface

$> ./google-hash-code-2018 -o resources/output-files/b.out -i resources/input-files/b_should_be_easy.in

Preview

Example without a Graphic Interface

$> go run main.go -o resources/output-files/e.out -i resources/input-files/e_high_bonus.in -noGui
16381105

Graphic interface commands

Command effect
press "space" pause / start the simulation
press "t" shows / hide all the simulation trips
arrow keys move the camera around
mouse scroll zoom in/out

FAQ

Why ?

I thought it would be a fun project to practice Go

Contributing

See Contributing.md.

But basically feel free to contribute if you find something to improve.

License

GPL-V3

google-hashcode-2018-live-simulation's People

Contributors

akselsledins avatar picojr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

google-hashcode-2018-live-simulation's Issues

Check if the output file are valid

Expected Behavior

Throw an error like this:
selection_291

Current Behavior

The simulation runs smoothly

Possible Solution

Check simulation data before starting it.
Additionally, in:

func (v *Vehicle) Drive(allTrips []*Trip, step int, bonus int16) (score int) {
	// until the vehicle handles all scheduled rides
	if v.CurrentTrip >= len(v.Trips) {
		return
	}

	trip := allTrips[v.Trips[v.CurrentTrip]]
	trip.SomeoneIsOnIt()

We should check if someone is already on it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.