Subdomain Posts
Haskell | 2 days ago
Haskell | 5 days ago
Haskell | 6 days ago
Haskell | 6 days ago
Haskell | 6 days ago
Haskell | 6 days ago
JavaScript | 8 days ago
None | 8 days ago
Haskell | 9 days ago
Haskell | 9 days ago
Recent Posts
JavaScript | 49 sec ago
XML | 2 min ago
CSS | 2 min ago
None | 3 min ago
None | 3 min ago
None | 3 min ago
REBOL | 3 min ago
None | 4 min ago
PHP | 4 min ago
None | 5 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 08:26:43 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,str2float $ B.pack s7,str2float $ B.pack s8)]
  13. tfarm (s1:s2:s3:s4:s5:s6:s7:s8:t) = (s1,s2,s3,s4,s5,s6,str2float $ B.pack s7,str2float $ B.pack s8):tfarm t
  14.  
  15. trps p = 2 + round(p/5)
  16.  
  17. 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=\"5\" randomise=\"true\" allowLess=\"true\">"++show (trps s7)++"</troops>\n"++"</strategy>\n"
  18.  
  19. main = do
  20.   s <- readFile "0_farm_targets.txt"
  21.   mapM_ (putStr) (map (makestr) (tfarm (map (cleanstr ) (lines s))))
Submit a correction or amendment below. [ previous version ] | [ difference ] | Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: