Skip to main content
Commonmark migration
Source Link

Python (2.6)

##Python (2.6) ExtremelyExtremely simple, but still I'm curious how it will perform compared to the other approaches.

import sys, random
try:
    s = sys.stdin.readlines()[-2]
    m = min(int(x) for x in s.split())
except IndexError:
    m = random.choice([1,1,1,2,2,3,3,4])
a = random.choice([-2,-1,0,1,1,2,2,3,3])
print max(m + a, 1)

Just pipe in the bids via stdin, e.g. python testbid.py < bids.txt.

EDIT: changed for the 'first round all zeros'

EDIT: changed the 'magic numbers' a bit (a second time)

##Python (2.6) Extremely simple, but still I'm curious how it will perform compared to the other approaches.

import sys, random
try:
    s = sys.stdin.readlines()[-2]
    m = min(int(x) for x in s.split())
except IndexError:
    m = random.choice([1,1,1,2,2,3,3,4])
a = random.choice([-2,-1,0,1,1,2,2,3,3])
print max(m + a, 1)

Just pipe in the bids via stdin, e.g. python testbid.py < bids.txt.

EDIT: changed for the 'first round all zeros'

EDIT: changed the 'magic numbers' a bit (a second time)

Python (2.6)

Extremely simple, but still I'm curious how it will perform compared to the other approaches.

import sys, random
try:
    s = sys.stdin.readlines()[-2]
    m = min(int(x) for x in s.split())
except IndexError:
    m = random.choice([1,1,1,2,2,3,3,4])
a = random.choice([-2,-1,0,1,1,2,2,3,3])
print max(m + a, 1)

Just pipe in the bids via stdin, e.g. python testbid.py < bids.txt.

EDIT: changed for the 'first round all zeros'

EDIT: changed the 'magic numbers' a bit (a second time)

added 25 characters in body
Source Link
ChristopheD
  • 1.7k
  • 1
  • 11
  • 21

##Python (2.6) Extremely simple, but still I'm curious how it will perform compared to the other approaches.

import sys, random
try:
    s = sys.stdin.readlines()[-2]
    m = min(int(x) for x in s.split())
except IndexError:
    m = random.choice([1,1,1,2,2,3]3,3,4])
a = random.choice([-2,-1,0,1,1,2]2,2,3,3])
print max(m + a, 1)

Just pipe in the bids via stdin, e.g. python testbid.py < bids.txt.

EDIT: changed for the 'first round all zeros'

EDIT: changed the 'magic numbers' a bit. (a second time)

##Python (2.6) Extremely simple, but still I'm curious how it will perform compared to the other approaches.

import sys, random
try:
    s = sys.stdin.readlines()[-2]
    m = min(int(x) for x in s.split())
except IndexError:
    m = random.choice([1,1,1,2,2,3])
a = random.choice([-2,-1,0,1,1,2])
print max(m + a, 1)

Just pipe in the bids via stdin, e.g. python testbid.py < bids.txt.

EDIT: changed for the 'first round all zeros'

EDIT: changed the 'magic numbers' a bit.

##Python (2.6) Extremely simple, but still I'm curious how it will perform compared to the other approaches.

import sys, random
try:
    s = sys.stdin.readlines()[-2]
    m = min(int(x) for x in s.split())
except IndexError:
    m = random.choice([1,1,1,2,2,3,3,4])
a = random.choice([-2,-1,0,1,1,2,2,3,3])
print max(m + a, 1)

Just pipe in the bids via stdin, e.g. python testbid.py < bids.txt.

EDIT: changed for the 'first round all zeros'

EDIT: changed the 'magic numbers' a bit (a second time)

added 2 characters in body
Source Link
ChristopheD
  • 1.7k
  • 1
  • 11
  • 21

##Python (2.6) Extremely simple, but still I'm curious how it will perform compared to the other approaches.

import sys, random
try:
    s = sys.stdin.readlines()[-2]
    m = min(int(x) for x in s.split())
except IndexError:
    m = random.choice([1,1,21,2,3,32,33])
a = random.choice([-2,-1,0,1,1,2,2,3,4]2])
print max(m + a, 1)

Just pipe in the bids via stdin, e.g. python testbid.py < bids.txt.

EDIT: changed for the 'first round all zeros'

EDIT: changed the 'magic numbers' a bit.

##Python (2.6) Extremely simple, but still I'm curious how it will perform compared to the other approaches.

import sys, random
try:
    s = sys.stdin.readlines()[-2]
    m = min(int(x) for x in s.split())
except IndexError:
    m = random.choice(1,2,2,3,3,3)
a = random.choice([-2,-1,0,1,1,2,2,3,4])
print max(m + a, 1)

Just pipe in the bids via stdin, e.g. python testbid.py < bids.txt.

EDIT: changed for the 'first round all zeros'

##Python (2.6) Extremely simple, but still I'm curious how it will perform compared to the other approaches.

import sys, random
try:
    s = sys.stdin.readlines()[-2]
    m = min(int(x) for x in s.split())
except IndexError:
    m = random.choice([1,1,1,2,2,3])
a = random.choice([-2,-1,0,1,1,2])
print max(m + a, 1)

Just pipe in the bids via stdin, e.g. python testbid.py < bids.txt.

EDIT: changed for the 'first round all zeros'

EDIT: changed the 'magic numbers' a bit.

added 79 characters in body
Source Link
ChristopheD
  • 1.7k
  • 1
  • 11
  • 21
Loading
Source Link
ChristopheD
  • 1.7k
  • 1
  • 11
  • 21
Loading