Git Product home page Git Product logo

mocollab's Issues

Change log

Providing a change log for assignment submission.

Task 3: Adding the Clown-Car

The Transport is a unit with the following features and attributes.
• It is a ground unit that can carry other ground units (except other transports).
• It has a capacity specifying the total unit_size of units it can carry.
• There is no limit to how many units can be loaded and unloaded in one turn.
5
• If the transport is destroyed, then all units in the transport are also destroyed.
Also, a line describing a Transport unit in a .lvl file has one additional integer specifying its
capacity.
When the transport is selected, notice that a new button on the display appears that says GATHER/UNLOAD.
One of two things happens when this button is pressed:
• If the transport is carrying at least one unit, then it tries to unload the unit that has been in the
transport the longest. It will search the four adjacent tiles to see if any of them can be occupied by
the unit. If so, then the unit is unloaded there. If the unit cannot be placed on any of these tiles,
then nothing happens.
• If the transport is empty, then it will gather some units into the transport. These units must be
non-transport ground units (on the same team) that can reach the transport in one turn and have not
yet moved this turn. Finally, the total unit_size of the units that are loaded will not exceed the
capacity of the transport.
Currently, the transport unit greedily selects the first units that will fit from the list of available units.
Your job is to implement a different specific behaviour for selecting which units to pick up.
The file gather.py is the only file you have to modify for this part. In it, there is a function
gather(transport, unit_list, value) where:
• transport is a Transport unit that is gathering units.
• unit_list is the list of eligible ground units that can be loaded into transport this turn (this
is already calculated for you before the function is called from within gui.py).
• value is a function mapping units to some value. In gui.py, it is called with a lambda function
that maps a unit to its remaining health.

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.