Author: Ian Osgood
Date: 18:16:42 02/24/05
Go up one level in this thread
Too much C. Here is a solution in Forth. Run with "gforth knights.f". variable run : .run run @ if run @ '0 + emit 0 run ! then ; : rank ( bn wn i -- bn wn ) dup 8 + swap do over i = if .run 'n emit else dup i = if .run 'N emit else 1 run +! then then loop .run ; : fen ( color bn wn -- ) 7 8 * 0 do i rank '/ emit 8 +loop 7 8 * rank space 2drop emit space ." - - 0 1" cr ; : main 0 run ! 64 1 do i 0 do 'w i j fen 'w j i fen \ 'b i j fen 'b j i fen \ uncomment this line for unique positions including color to move loop loop ; main bye Ian
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.