1. createFen
  2. "answers the fen diagram of the position. emptySquares is a variable which contains the number of empty squares on the rank until the next rank."
  3.  
  4. | emptySquares fenString |
  5. emptySquares := 0.
  6. fenString := ''.
  7. 1 to: 8
  8. do:
  9. [:y |
  10. y ~= 1
  11. ifTrue:
  12. [emptySquares ~= 0
  13. ifTrue:
  14. [fenString := fenString , emptySquares printString.
  15. emptySquares := 0].
  16. fenString := fenString , '/'.
  17. ].
  18. 1 to: 8 do: [:x | (squares at: x @ y) isNil ifTrue: [emptySquares := emptySquares + 1]]].
  19. ^fenString