Skip to content

Instantly share code, notes, and snippets.

@daemonfire300
Created November 13, 2012 22:59
Show Gist options
  • Save daemonfire300/4069011 to your computer and use it in GitHub Desktop.
Save daemonfire300/4069011 to your computer and use it in GitHub Desktop.
rowV :: Int -> Picture
rowV n
| n == 1 = black
| n `mod` 2 == 0 = beside white (rowV (n-1))
| otherwise = beside black (rowV (n-1))
rowVe :: Int -> Picture
rowVe n
| n == 1 = white
| n `mod` 2 == 0 = beside black (rowVe (n-1))
| otherwise = beside white (rowVe (n-1))
-- reines Schachbrett ohne Figuren
brett :: Int -> Int -> Picture
brett cols 0 = white
brett cols row
| row == 1 = above (rowV cols) (brett cols (row-1))
| row `mod` 2 == 0 = above (rowVe cols) (brett cols (row-1))
| otherwise = above (rowV cols) (brett cols (row-1))
{- Row Beispielfunktion mit Figuren, d.h. man ersetzt einfach die Row funktionen mit den Row-Figuren Funktionen austauschen und entsprechen in der brett funktion nochmals prüfen ob überhaupt eine Row-Figuren Funktion genutzt werden soll -}
rowVeWithFigures :: Bool -> Int -> Picture
rowVeWithFigures color n
| n == 1 = over white rook
| n == 2 = beside (over black knight) (rowVeWithFigures color (n-1))
| n == 3 = beside (over black knight) (rowVeWithFigures color (n-1))
| n == 4 = beside (over black knight) (rowVeWithFigures color (n-1))
| n == 5 = beside (over black knight) (rowVeWithFigures color (n-1))
| n == 6 = beside (over black knight) (rowVeWithFigures color (n-1))
| n == 7 = beside (over black knight) (rowVeWithFigures color (n-1))
| n == 8 = beside (over black knight) (rowVeWithFigures color (n-1))
| n `mod` 2 == 0 = beside black (rowVeWithFigures color (n-1))
| otherwise = beside white (rowVeWithFigures color (n-1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment