Хламидомонада / Говнокод #16405 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
map_of_enemy :: [[Int]] -> [[Int]]
map_of_enemy [] = []
map_of_enemy list = (iniciar (0) (0) (list))

iniciar :: Int -> Int -> [[Int]] -> [[Int]]
iniciar a b list = if(a == (length list)-1) then [rango a 0 list]
               else [rango a 0 list]++[(iniciar (a+1) 0 list)]

rango :: Int -> Int -> [[Int]] -> [Int]
rango a b list = if (b==(length list)-1 && (((list!!a!!0)==(list!!b!!0)) &&     ((list!!a!!1)==(list!!b!!1)) && ((list!!a!!2)==(list!!b!!2))))
             then [0]
             else if (b==(length list)-1 && (((list!!a!!0)/=(list!!b!!0)) || ((list!!a!!1)/=(list!!b!!1)) || ((list!!a!!2)/=(list!!b!!2))))
             then (rango2 a (list!!b) list)
             else if (((list!!a!!0)==(list!!b!!0)) && ((list!!a!!1)==(list!!b!!1)) && ((list!!a!!2)==(list!!b!!2)))
             then [0]++(rango a (b+1) list)
             else (rango2 a (list!!b) list)++(rango a (b+1) list)

rango2 :: Int -> [Int] -> [[Int]] -> [Int]
rango2 a b list = if ((verif [(list!!a!!0)+(list!!a!!2),(list!!a!!1)+(list!!a!!2)] [(list!!a!!0)-(list!!a!!2),(list!!a!!1)-(list!!a!!2)] (b))) then [1]
              else [0]

verif a b c = if (((c!!0) < (a!!0)) && ((c!!0) > (b!!0)) && ((c!!1) < (a!!1)) && ((c!!1) > (b!!1))) then True
          else if (((c!!0) < (a!!0)) && ((c!!0) == (b!!0)) && ((c!!1) < (a!!1)) && ((c!!1) == (b!!1))) then True
          else if (((c!!0) == (a!!0)) && ((c!!0) > (b!!0)) && ((c!!1) == (a!!1)) && ((c!!1) > (b!!1))) then True
          else False

Haskell
OMG mode on

Запостил: kegdan kegdan, (Updated )

Комментарии (17) RSS

Добавить комментарий

Помни, guest, за тобой могут следить!

    А не использовать ли нам bbcode?


    8