Skip to main content
4 of 5
improve I/O spec
PhiNotPi
  • 29.1k
  • 10
  • 85
  • 157

Topping the Charts

#Topping the Charts#

You are a record label company. Your goal is to get 4 of your signed bands in the top 4 positions in the charts. However, its recently been noted that bands currently in the charts influence who is going to be in the charts the next day.

In this challenge, each player will control 5 bands (instances of your code), each of them placed in alternating order in one of the 11 spots of the scoreboard, with the 11th spot open. Each band will have a unique, hidden ID (from 0-9), and a unique, visible name (a randomly generated integer).

Each turn, the band with the open spot below them in the charts will call an ID. The bot instance with that ID will move to that spot, creating a new open spot. If spot #1 is open, then the 11th bot will be the one to name an ID.

The game is over when spots 1-4 are all held by your bands, giving you 3 points. If a particular band ordering is created more than 3 times, then both labels will tie and be given 1 point. The player with the most points after facing each other player twice (to ensure both labels start with a band in the #1 position) wins.

#I/O#

Bots will be stay alive between turns. Information will be passed back and forth via STDIO. When multiple pieces of information is passed, it will be comma separated. Each instance of your bot MUST NOT communicate with each other (nor with the other team).

At the beginning of the game, your will be passed three integers, your ID, position, and name, and then you will be passed a list of names of the current positions, with 0 being the open position.

On your turn, you will be passed a list of names of the current positions, with 0 being the open position. You must return the ID you wish to place in the spot below you.

If you get switched, you will be be passed two integers, the name of the person that switched you, and your new position (from 0-10).

If you win, you will be passed 0, at which, you must end your program

The controller can be found here: https://github.com/nathanmerrill/ScoreboardKoTH

Nathan Merrill
  • 14.5k
  • 3
  • 48
  • 128