Advertisement
Guest User

Untitled

a guest
Oct 16th, 2021
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import Data.List
  2.  
  3. data Pieza = Peon|Caballo|Alfil|Torre|Dama|Rey deriving (Enum,Show)
  4.  
  5. data Color = Blanco|Negro deriving (Enum)
  6.  
  7. data Trebejo = Trebejo Pieza Color
  8.  
  9. data Fila = Uno|Dos|Tres|Cuatro|Cinco|Seis|Siete|Ocho deriving (Enum,Show)
  10.  
  11. data Columna = A|B|C|D|E|F|G|H deriving (Enum,Show)
  12.  
  13. data Escaque = Escaque Columna Fila
  14.  
  15. show1 :: Columna -> Fila -> String
  16. show1 col fil = ("ABCDEFGH"!!(fromEnum col)):("12345678"!!(fromEnum fil)):[]
  17.  
  18. data Ubicacion = Ubicacion Escaque Trebejo
  19.  
  20. main :: IO()
  21. main = putStrLn $ (show1 A Uno)
  22.  
  23.  
  24. $ ghc chess.hs
  25. [1 of 1] Compiling Main ( chess.hs, chess.o )
  26. Linking chess ...
  27. [haroldo@semiosis haskell]$ ./chess
  28. A1
  29. [haroldo@semiosis haskell]$
  30. ;-)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement