Skip to main content

BCsnake - 282 bytes

snake in byte-crunching mode


josmiley / Luke spywoker
(mutualaccount)

snake in 277 bytes

from pygame import*;d=display;y,D,S=s=[15,16,17];n,p,x=D,99,d.set_mode([225]*2).fill
while s.count(S)%2*S%n*(S&240):
for e in event.get(2):D=(-1,-n,n,1)[e.key&3]
s=s[p!=S:]+[S+D];x(-1)
if p==S:p=s[0]
for i in[p]+s:x(0,((i-1)%n*y,(i-n)/n*y,y,y))
d.flip();S+=D;time.wait(99)
python2.

Changes

Links

Home Page
http://joel-murielle.perso.sfr.fr
Source
http://joel-murielle.perso.sfr.fr/snake.py

Releases

BCsnake 278 Bytes — 5 Apr, 2012

BCsnake 277 Bytes — 7 Apr, 2012

BCsnake 285 bytes — 1 Jun, 2010

BCsnake 282 bytes — 1 Jun, 2010

BCsnake 288 bytes — 30 Apr, 2010

BCsnake 287 bytes — 1 Jun, 2010

BCsnake 296 bytes — 30 Apr, 2010

Pygame.org account Comments

  • Cameron McWilliams 2012-04-17 16:23

    ... ... ... I don't no what to say other than: this is impressive. Why is the snake slanted? I assume it has to do with saving bytes, but I don't understand any of your 277 bytes

    josmiley 2012-04-28 17:32

    with python3: 278 bytes

    replace: for i in[p]+s:x(0,((i-1)%n*y,(i-n)/n*y,y,y))
    by: for i in[p]+s:x(0,((i-1)%n*y,(i-n)//n*y,y,y))