Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PriorityQueue<Touple> topSnakes = new PriorityQueue<>((o1, o2) -> {
- if (o1.score < o2.score){
- return 1;
- }else if (o1.score > o2.score){
- return -1;
- }else return 0;
- });
- if (topSnakes.size() < snakeCount / 10.0){
- topSnakes.add(snake);
- }else if (topSnakes.size() > 0 && snake.score > topSnakes.peek().score){
- topSnakes.poll();
- topSnakes.add(snake);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement