Git Product home page Git Product logo

divide-squad's Introduction

Metrics

divide-squad's People

Contributors

spencercjh avatar

Watchers

 avatar  avatar

divide-squad's Issues

解决没有随机性的方案

0-1背包算法分完两部分球员后,把两队分数相同的球员拿出来进行洗牌再随机地放入两队。

可能的实现方案:

  • 在分类算法实现中,将SquadPlayer内部类实例转为对应的Player之前操作;
  • 抽出两个集合A,B中分数且位置相同的球员(group by stats and position),得到Map<POSITION,List<List<SquadPlayer>>>,value列表的第0项是A队球员,第一项是B队球员;
  • 遍历这个Map,取Value,如果两队在这个分数上的球员人数相同,则将这两波人打散随机分配队伍;
  • 根据球员新的队伍分配到对应队伍。

如何随机分配:

取随机数,若为偶进A队,否则进B队。

实现上的Bonus:

  • 不修改或者少修改原有的实现类,而是新增新的类。

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.