Skip to main content
Commonmark migration
Source Link

#A Little Off The Top, Python 2

A Little Off The Top, Python 2

import math, sys

total_degrees, degrees_left, total_people, people_left = map(int, sys.argv[1:])

def get_equal_share(total_degrees, people):
  return int(math.ceil(total_degrees/float(people)))

def noms(total_degrees, degrees_left, people):
  bid = get_equal_share(total_degrees,people)-1
  return min(degrees_left, bid)

print noms(total_degrees, degrees_left, people_left)

Since the "perfect" algorithm tries to split the cake evenly between the bots, we're going to take just a sliver less than that. Demands its full fair share of the overall cake, even in subsequent rounds, but skews that number upward since it's based on how many people are left.

I haven't programmed in Python in a long while, so let me know if my code is broken...

#A Little Off The Top, Python 2

import math, sys

total_degrees, degrees_left, total_people, people_left = map(int, sys.argv[1:])

def get_equal_share(total_degrees, people):
  return int(math.ceil(total_degrees/float(people)))

def noms(total_degrees, degrees_left, people):
  bid = get_equal_share(total_degrees,people)-1
  return min(degrees_left, bid)

print noms(total_degrees, degrees_left, people_left)

Since the "perfect" algorithm tries to split the cake evenly between the bots, we're going to take just a sliver less than that. Demands its full fair share of the overall cake, even in subsequent rounds, but skews that number upward since it's based on how many people are left.

I haven't programmed in Python in a long while, so let me know if my code is broken...

A Little Off The Top, Python 2

import math, sys

total_degrees, degrees_left, total_people, people_left = map(int, sys.argv[1:])

def get_equal_share(total_degrees, people):
  return int(math.ceil(total_degrees/float(people)))

def noms(total_degrees, degrees_left, people):
  bid = get_equal_share(total_degrees,people)-1
  return min(degrees_left, bid)

print noms(total_degrees, degrees_left, people_left)

Since the "perfect" algorithm tries to split the cake evenly between the bots, we're going to take just a sliver less than that. Demands its full fair share of the overall cake, even in subsequent rounds, but skews that number upward since it's based on how many people are left.

I haven't programmed in Python in a long while, so let me know if my code is broken...

More noms
Source Link
AdmBorkBork
  • 43.5k
  • 5
  • 103
  • 284

#A Little Off The Top, Python 2

import math, sys

total_degrees, degrees_left, total_people, people_left = map(int, sys.argv[1:])

def get_equal_share(degrees_lefttotal_degrees, people):
  return int(math.ceil(degrees_lefttotal_degrees/float(people)))

def noms(total_degrees, degrees_left, people):
  bid = get_equal_share(degrees_lefttotal_degrees,people)-1
  return min(degrees_left, bid)

print noms(total_degrees, degrees_left, people_left)

Since the "perfect" algorithm tries to split the cake evenly between the remaining peoplebots, we're going to undercut them by takingtake just a sliver less than that. Demands its full fair share of the overall cake, and hopefully make up for possible losses against Randoms with futureeven in subsequent rounds, but skews that number upward since it's based on how many people are left.

I haven't programmed in Python in a long while, so let me know if my code is broken...

#A Little Off The Top, Python 2

import math, sys

total_degrees, degrees_left, total_people, people_left = map(int, sys.argv[1:])

def get_equal_share(degrees_left, people):
  return int(math.ceil(degrees_left/float(people)))

def noms(degrees_left, people):
  bid = get_equal_share(degrees_left,people)-1
  return min(degrees_left, bid)

print noms(degrees_left, people_left)

Since the "perfect" algorithm tries to split the cake evenly between the remaining people, we're going to undercut them by taking just a sliver less than that, and hopefully make up for possible losses against Randoms with future rounds.

I haven't programmed in Python in a long while, so let me know if my code is broken...

#A Little Off The Top, Python 2

import math, sys

total_degrees, degrees_left, total_people, people_left = map(int, sys.argv[1:])

def get_equal_share(total_degrees, people):
  return int(math.ceil(total_degrees/float(people)))

def noms(total_degrees, degrees_left, people):
  bid = get_equal_share(total_degrees,people)-1
  return min(degrees_left, bid)

print noms(total_degrees, degrees_left, people_left)

Since the "perfect" algorithm tries to split the cake evenly between the bots, we're going to take just a sliver less than that. Demands its full fair share of the overall cake, even in subsequent rounds, but skews that number upward since it's based on how many people are left.

I haven't programmed in Python in a long while, so let me know if my code is broken...

Source Link
AdmBorkBork
  • 43.5k
  • 5
  • 103
  • 284

#A Little Off The Top, Python 2

import math, sys

total_degrees, degrees_left, total_people, people_left = map(int, sys.argv[1:])

def get_equal_share(degrees_left, people):
  return int(math.ceil(degrees_left/float(people)))

def noms(degrees_left, people):
  bid = get_equal_share(degrees_left,people)-1
  return min(degrees_left, bid)

print noms(degrees_left, people_left)

Since the "perfect" algorithm tries to split the cake evenly between the remaining people, we're going to undercut them by taking just a sliver less than that, and hopefully make up for possible losses against Randoms with future rounds.

I haven't programmed in Python in a long while, so let me know if my code is broken...