GithubHelp home page GithubHelp logo

codingame's Introduction

CodinGame-Code4Life

Pinar Kok - 20160808013

First of all, I created Sample class to represent samples. It has id (Int), carriedBy (Int), rank (Int), gain (String), health (Int), costs (Integer ArrayList) variables. There is a getId method to get the sample id. After that, I created Robot class to represent the robot (me). It has the variables of storage (Integer ArrayList), and target (String).

In the game loop, I created samples ArrayList to represent the samples. If a sample is created, then it will add to this ArrayList. To control and take the best sample, I use this ArrayList called samples. When I am choosing the sample, I check the health value with maxHealth variable in my code. If the health value of a sample is greater than maxHealth value, and if that sample is in the cloud (it is carried by nobody) then I choose this sample as bestSample and its health as maxHealth.

I have molecules array to keep different types of molecules (A, B, C, D, E). And if I need more molecules than I have, I check this situation with neededMolecule variable which is an empty string at the beginning. After this check, if there is molecule needed more, then I go to MOLECULES and collect them; if there is no molecule needed more, then I go to LABORATORY. For these go and connect jobs, I created gotoAndConnect method. It takes module, data, position. (Data may be neededMolecule (if there is molecule needed more), or bestSample id (if there is no molecule needed more)). That method checks if my position is at the desired module, then CONNECT the data; if my position is not at the correct module, then GOTO the module.

codingame's People

Contributors

pinarrkok avatar

Watchers

Murat Ak avatar  avatar

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.