Kilothello
This game was made for the PICO-1K Jam 2023. It is a "demake" of Apathello, my entry in A Game By Its Cover 2023. The code was written to fit into 1KB. For reference, that is twice the size of the HTML for this paragraph.
Press X to start the game. Once the game starts, press the arrow keys to move the cursor, and press X to place a piece. Once the game is over, press X to restart.
The complete source code is below, and is also downloadable as a 1KB .p8.rom file. Bitwise ops and P8SCII codes everywhere... 🥴
z={-257.00394,[9]=-257.00394,[-7]=-257.00394,[7]=32639.49804,[-1]=32639.49804,[-9]=32639.49804,[8]=~0,[-8]=~0}function u(a,b,c)return a>>>c|b>>>c+32,b>>>c|a>>>c-32end function v(a,b,c,d,e,f)i=0j=0for g,h in pairs(z)do m,n=u(h&e,f&h,g)m&=c n&=d k=0l=0while(m|n~=0)do k|=m l|=n m,n=u(h&m,n&h,g)if(a&m|b&n~=0)i|=k j|=l m&=c n&=d end end return a|e~i,b|f~j,c~i,d~j,i,j end function vv(a,b,c,d,e,f)i=0j=0for g,h in pairs(z)do m,n=u(h&e,f&h,g)m&=c n&=d k=0l=0while(m|n~=0)do k|=m l|=n m,n=u(h&m,n&h,g)i|=~c&~a&m j|=~d&~b&n m&=c n&=d end end return i,j end function ne(b)a=0while(b~=0)a+=b<<16&1b>>>=1 return a end function ra()?"⁶1⁶c" camera()srand()for a=0,227do pset(rnd()<<7,rnd()<<7,rnd(4))end camera(-25,-20)end o=35r=4096t=2048q=.00013s=.00025y=409?"\aswi7d2g-dg-gdgaaa",39 ?"⁶!5f11█✽⁵\r●",39 while(y>33or not btnp(5))do ra()y+=4-y/8if(y<51)?"press ❎",24,51,39 ?"⁶w⁶t⁶#kilothello",0,y,39 end::_::ra()o-=btnp(1)and-1or btnp()&1o-=btnp(3)and-8or(btnp()&4)*2o&=63g,h=vv(q,r,s,t,q,r)w,y=u(0,.00002,-o)rectfill(o%8*10,o\8*10,o%8*10+8,o\8*10+8,4)for a=0,7do if(a>0)line(a*10-1,0,a*10-1,78,2)line(0,a*10-1,78,a*10-1) for aa=0,7do _,_,_,_,i,j=v(q,r,s,t,w,y)_,b=u(q,r,aa+a*8)_,c=u(s,t,aa+a*8)_,d=u(g,h,aa+a*8)_,f=u(i,j,aa+a*8)if(g&w|y&h~=0 and f&.00002>0)rectfill(aa*10,a*10,aa*10+8,a*10+8,3) e=p and c<<16&1|b<<17&2or b<<16&1|c<<17&2if(e>0)?"●",aa*10+1,a*10+2,5*e-3 if(d&.00002>0)?"⁙",aa*10+3,a*10+2,aa+a*8==o and 0or 5 end end c=ne(q)+ne(r)d=ne(s)+ne(t)if(p)c,d=d,c ?sub("⁶#black "..c,p and 3),24,81,39 ?sub("⁶#\nwhite "..d,not p and 3),24,81,39 if g|h==0then s,t,q,r=q,r,s,t g,h=vv(q,r,s,t,q,r)p=not p if g|h==0then?"⁶w⁶t⁶#⁶d6game over⁶6",4,25,39 ?c==d and"\t ⁶#tie game⁶7\n"or c>d and"\t ⁶#black wins⁶7\n"or"\t ⁶#white wins⁶7\n",39 ?"\t ⁶#press ❎",39 while(not btnp(5))? run()end?"⁶w⁶t⁶#⁶d6pass⁶6",24,34,39 goto _ end if btnp(5)then if g&w|y&h==0then?"\asdi5v7x5a0a" else s,t,q,r=v(q,r,s,t,w,y)p=not p?"\as8i4x5d2eg-ab" end end goto _
(Yes, I know this is longer than 1024 characters, but PICO-8 applies a form of compression called PXA to this code when saving to a PNG or ROM file. carlc27843 has an excellent visualizer for this compression system available online.)
Status | Released |
Platforms | HTML5 |
Rating | Rated 5.0 out of 5 stars (1 total ratings) |
Author | Josiah Winslow |
Genre | Strategy |
Made with | PICO-8 |
Tags | Board Game, othello, pico1k, PICO-8, reversi |
Download
Click download now to get access to the following files:
Leave a comment
Log in with itch.io to leave a comment.