MEMO: (col-number-hash) ( -- hashtable ) CHAR: a CHAR: h [a,b] 1 8 [a,b] zip >hashtable ; : col>number ( letter -- number ) (col-number-hash) at ; :: valid-incline? ( move-x current-x move-y current-y -- ? ) move-x current-x - :> dx move-y col>number current-y col>number - :> dy dy dx = dy dx -1 * = or ; :: inside-board? ( move-x move-y -- ? ) 8 [1,b] move-x move-y col>number [ swap member? ] bi-curry@ bi and ; :: valid-bishop? ( current-x current-y move-x move-y -- ? ) ! not same location, member of a 1-8 range, and dy/dx = 1 or -1 { [ move-x current-x = not ] [ move-x move-y inside-board? ] [ move-x current-x move-y current-y valid-incline? ] } 0&& ;