< Go Back

Code Golfing is the art of creating incredibly small programs or games, cramming in as much functionality as possible.
I have recently gotten really interested, so I started making my own code golf-y games in Python. Every month I will be releasing a new one.

Number 1: Pizza delivery game
Dead simple: at the "COMMAND" prompt, use WASD to guide the @ symbol around. Once you are at a location, press E to
drop a pizza. At the "WHICH TO DROP" prompt, choose the item # in your inventory. Make it in as few moves possible to get a good score!
SIZE: 831 bytes (!!)
Simply copy-paste this into a python file and run it!

from random import*
p=list("ABCDEFGHIJKLMNOP")
Z='B.STICKS CHEESE SPECIAL PEPPERONI'.split()
o,v,m,s=[],[],0,0
r=randint(0, 15)
shuffle(p)
o=[(randint(0,3),randint(0,15))for _ in' '*4]
v=[x for x,y in o]
while o:
    for i in range(4):print(*[(p[i*4+j],"@")[r==i*4+j]for j in range(4)],'\n')
    print("\nORDERS")
    for x,y in o:print(p[y]+':'+Z[x])
    print("INV.")
    for x in v:print(Z[x])
    a=input("COMMAND")
    m+=1
    r+={"a":-1,"d":1,"w":-4,"s":4}.get(a,0)
    r=max(0,min(15,r))
    if a=="e":
        m-=1
        l=int(input("WHICH TO DROP?"))
        x=v.pop(l-1)
        if (x,r) in o:
            print("THANKS!")
            s+=2
            o.remove((x,r))
        else:
            print("WHAT? I DIDN'T ORDER THAT!")
            s-=2
s*=10
s-=m*5
print("SCORE ",s)
input()