Subdomain Posts
Haskell | 1 day ago
Haskell | 5 days ago
Haskell | 5 days ago
Haskell | 5 days ago
Haskell | 5 days ago
Haskell | 5 days ago
JavaScript | 7 days ago
None | 7 days ago
Haskell | 9 days ago
Haskell | 9 days ago
Recent Posts
None | 14 sec ago
INI file | 23 sec ago
Z80 Assembler | 37 sec ago
None | 50 sec ago
None | 51 sec ago
PHP | 1 min ago
None | 1 min ago
MySQL | 1 min ago
None | 1 min ago
Bash | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Anonymous on the 31st of Jan 2010 06:08:25 PM Download | Raw | Embed | Report
  1. module Main where
  2. import Data.Char
  3. import Text.ParserCombinators.Parsec
  4. import Data.ByteString.Lex.Double
  5. import qualified Data.ByteString.Char8 as B
  6.  
  7. str2float x = case (readDouble x) of
  8.   Nothing -> 0
  9.   Just (k,rest) -> k
  10.  
  11. cleanstr s = [ n | n <- s , n/='\r']
  12. tfarm (s1:s2:s3:s4:s5:s6:s7:s8:[]) = [(s1,s2,s3,s4,s5,s6,s7,str2float $ B.pack s8)]
  13. tfarm (s1:s2:s3:s4:s5:s6:s7:s8:t) = (s1,s2,s3,s4,s5,s6,s7,str2float $ B.pack s8):tfarm t
  14.  
  15. makestr (s1,s2,s3,s4,s5,s6,s7,s8) = "\n<strategy class=\"Farmizzator\" desc=\"Farm"++s1++ "\" enabled=\"true\" uid=\""++s2++s3++"\">\n"++"<target x=\""++s2++"\" y=\""++s3++"\" movement=\"attack\" rate=\""++show (37/s8)++ "\"/>\n"++"<troops type=\"Clubswinger\" min=\"3\" randomise=\"true\" allowLess=\"true\">10</troops>\n"++"</strategy>\n"
  16.  
  17. main = do
  18.   s <- readFile "0_farm_targets.txt"
  19.   mapM_ (putStr) (map (makestr) (tfarm (map (cleanstr ) (lines s))))
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: