GM really needs shortcircuited logic

Posted by s on Aug. 22, 2008, 2:15 a.m.

Luda's board game has swallowed me away from C++ and Babble and into GML. Thus I get to see GML in a new light and be like WTF this language sucks

switch cb[clx,cly]{

case-1:

if clx<7 if cb[clx+1,cly]=0{draw_cell(clx+1,cly)}

if clx>0 if cb[clx-1,cly]=0{draw_cell(clx-1,cly)}

if cly<7 if cb[clx,cly+1]=0{draw_cell(clx,cly+1)}

break;case-2:case 2:

if clx<7 if cb[clx+1,cly]=0{draw_cell(clx+1,cly)}

if clx>0 if cb[clx-1,cly]=0{draw_cell(clx-1,cly)}

if cly<7 if cb[clx,cly+1]=0{draw_cell(clx,cly+1)}

if cly>0 if cb[clx,cly-1]=0{draw_cell(clx,cly-1)}

break;case-3:case 3:

if clx<7 if abs(cb[clx+1,cly])!=3{draw_cell(clx+1,cly)}

if clx>0 if abs(cb[clx-1,cly])!=3{draw_cell(clx-1,cly)}

if cly<7 if abs(cb[clx,cly+1])!=3{draw_cell(clx,cly+1)}

if cly>0 if abs(cb[clx,cly-1])!=3{draw_cell(clx,cly-1)}

break;case-4:case 4:

if clx<7 if cb[clx+1,cly]=0||(cb[clx+2-(clx>5),cly]=0&&abs(cb[clx+1,cly])!=4){draw_cell(clx+1,cly)}

if clx>0 if cb[clx-1,cly]=0||(cb[clx-2+(clx<2),cly]=0&&abs(cb[clx-1,cly])!=4){draw_cell(clx-1,cly)}

if cly<7 if cb[clx,cly+1]=0||(cb[clx,cly+2-(cly>5)]=0&&abs(cb[clx,cly+1])!=4){draw_cell(clx,cly+1)}

if cly>0 if cb[clx,cly-1]=0||(cb[clx,cly-2+(cly<2)]=0&&abs(cb[clx,cly-1])!=4){draw_cell(clx,cly-1)}

break;case-5:

if clx<7 if cb[clx+1,cly]=0{draw_cell(clx+1,cly)}

if clx>0 if cb[clx-1,cly]=0{draw_cell(clx-1,cly)}

if cly<7 if cb[clx,cly+1]=0{draw_cell(clx,cly+1)}

if clx<7&&cly<7 if cb[clx+1,cly+1]=0{draw_cell(clx+1,cly+1)}

if clx>0&&cly<7 if cb[clx-1,cly+1]=0{draw_cell(clx-1,cly+1)}

break;case 1:

if clx<7 if cb[clx+1,cly]=0{draw_cell(clx+1,cly)}

if clx>0 if cb[clx-1,cly]=0{draw_cell(clx-1,cly)}

if cly>0 if cb[clx,cly-1]=0{draw_cell(clx,cly-1)}

break;case 5:

if clx<7 if cb[clx+1,cly]=0{draw_cell(clx+1,cly)}

if clx>0 if cb[clx-1,cly]=0{draw_cell(clx-1,cly)}

if cly>0 if cb[clx,cly-1]=0{draw_cell(clx,cly-1)}

if clx<7&&cly>0 if cb[clx+1,cly-1]=0{draw_cell(clx+1,cly-1)}

if clx>0&&cly>0 if cb[clx-1,cly-1]=0{draw_cell(clx-1,cly-1)}

}

(I'm glad I wrote draw_cell before writing that code)

Comments

PY 16 years, 4 months ago

luda's game is hard, it keeps beating me, even on 0 :(

s 16 years, 4 months ago

I was able to beat Luda after about 4 games just before he went off to bed. Yay drowsy players, the only reason I won was because he didn't catch that capturing my push would create a trap for my push to slay his lord. I need to learn to use my warps more and advance my lords instead of maintaining my defence

I've not played the game with 2ply, but on 1ply the AI can be made to trap itself and thus lord rushing it isn't as difficult. Especially when it goes off into back and forth logic failures

The AI was pretty bad when it just chose random moves. I moved my corner pawn back and forth and the AI had probability play out and killed all its pawns

HUGE SUCCESS!

(I haven't tested the latest patches on it though, so failure unknown)

PY 16 years, 4 months ago

Me and luda are about to have a game :D

And by that I mean luda is about to own me.

Alexitron 16 years, 4 months ago

I hate lines of code!