The classic board game made pocket sized! Play it with a friends, family, or  alter egos!

Controls

  • Arrow keys to move cursor.
  • Z/X/C to place a piece.
  • Players take turns with the controls. The outline indicates which color's turn it is.
  • White wins on ties.

Code

n=108pal(5,0,1)s=0g=9f=9c=7camera(-9,-9)m,v=mget,sget::_::p=btnp()g+=p\2%2-p%2f+=p\8%2-p\4%2cls(15)for i=0,n,6do
line(i,0,i,n,4)line(0,i,n,i)end
for x=0,18do
for y=0,18do
k=m(x,y)sset(x,y,k>0and 1)
if(k>0)circfill(x*6,y*6,2,k)end
end
if(p>14)then
mset(g,f,c)c=c<6and 7or 5repeat
b=1for x=0,18do
for y=0,18do
e=m(x,y)if v(x,y)<1then
for i=0,1,1/4do
j=x+cos(i)k=y+sin(i)r=m(j,k)
if(v(j,k)>0and(e<1or e==r))sset(j,k,0)b=z
end
end
end
end
until b
for x=0,18do
for y=0,18do
if(v(x,y)>0)s+=6-m(x,y)mset(x,y)end
end
end
?s,0,-8,s>=0and 7
circ(g*6,f*6,3,c)flip()goto _

Caveats:

  • Game does not score territory.
  • No restriction on placing pieces on existing pieces.
  • No restriction on suicide pieces.
  • No way to pass turns.
  • No Ko rule.
  • Only .5 komi.

Original Tweetcart 

Smaller pieces and no auto capture but fits inside a single tweet!

s=0a={}g=8f=8fillp(1911)::_::circfill(9,9,167,244)p=btnp()g+=(p&2)*2-(p&1)*4f+=(p&8)/2-(p&4)for e in all(a)do
?"■",e[1]-1,e[2]-2,e[3]
if(p>31and g-e[1]|f-e[2]==0)s+=e[3]and-1or 1del(a,e)end
if(p==16)add(a,{g,f,c})c=not c and 119
?s,1,0,s>=0and 7
circ(g,f,2,c)flip()goto _

Comments

Log in with itch.io to leave a comment.

That late game board you have on the back looks so good, I can nearly hear the pieces hitting the board.

Very cool to see a real game in a tweet cart. You even keep track of the captured pieces so you can accurately score at the end.

This is great. Well done with so few characters. I like the white/black outline for who's turn it is, clever. 

thanks! it was a fun one to make.