Advertisement
Guest User

Untitled

a guest
Nov 28th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Oz 3.76 KB | None | 0 0
  1. fun{CheckMap Map}
  2.    fun{CheckVal Val}
  3.       if {Float.is Val} then true
  4.       else
  5.      case Val
  6.      of plus(A B) then ({CheckVal A} andthen {CheckVal B})
  7.      [] minus(A B) then ({CheckVal A} andthen {CheckVal B})
  8.      [] mult(A B) then ({CheckVal A} andthen {CheckVal B})
  9.      [] 'div'(A B) then ({CheckVal A} andthen {CheckVal B})
  10.      [] cos(A) then {CheckVal A}
  11.      [] sin(A) then {CheckVal A}
  12.      [] tan(A) then {CheckVal A}
  13.      [] exp(A) then {CheckVal A}
  14.      [] log(A) then {CheckVal A}
  15.      [] neg(A) then {CheckVal A}
  16.      else false
  17.      end
  18.       end
  19.    end
  20.    fun{CheckForm Form}
  21.       if {Float.is Form} then true
  22.       else
  23.      case Form
  24.      of plus(A B) then ({CheckForm A} andthen {CheckForm B})
  25.      [] minus(A B) then ({CheckForm A} andthen {CheckForm B})
  26.      [] mult(A B) then ({CheckForm A} andthen {CheckForm B})
  27.      [] 'div'(A B) then ({CheckForm A} andthen {CheckForm B})
  28.      [] cos(A) then {CheckForm A}
  29.      [] sin(A) then {CheckForm A}
  30.      [] tan(A) then {CheckForm A}
  31.      [] exp(A) then {CheckForm A}
  32.      [] log(A) then {CheckForm A}
  33.      [] neg(A) then {CheckForm A}
  34.      [] ite(A B C) then ({CheckForm A} andthen {CheckForm B} andthen {CheckForm B})
  35.      [] eq(A B) then ({CheckForm A} andthen {CheckForm B})
  36.      [] ne(A B) then ({CheckForm A} andthen {CheckForm B})
  37.      [] lt(A B) then ({CheckForm A} andthen {CheckForm B})
  38.      [] le(A B) then ({CheckForm A} andthen {CheckForm B})
  39.      [] gt(A B) then ({CheckForm A} andthen {CheckForm B})
  40.      [] ge(A B) then ({CheckForm A} andthen {CheckForm B})
  41.      else false
  42.      end
  43.       end
  44.  
  45.    end
  46.    fun{CheckPrim Prim}
  47.       case Prim
  48.       of primitive(kind: RuP) then case RuP
  49.                   of road then true
  50.                   [] building then true
  51.                   [] water then true
  52.                   else false
  53.                   end
  54.       else false
  55.       end
  56.    end
  57.    fun{CheckPrimPok Prim}
  58.       case Prim
  59.       of primitive(kind: PuP) then case PuP
  60.                   of pokemon then true
  61.                   [] arena then true
  62.                   [] pokestop then true
  63.                   else false
  64.                   end
  65.       else false
  66.       end
  67.    end
  68.    fun{CheckTrans Trans}
  69.       case Trans of translate(dx:Dx dy:Dy 1:Ru)
  70.       then ({CheckVal Dx} andthen {CheckVal Dy} andthen {CheckR Ru})
  71.       else false
  72.       end
  73.    end
  74.    fun{CheckTransPok Trans}
  75.       case Trans of translate(dx:Dx dy:Dy 1:Pu)
  76.       then ({CheckForm Dx} andthen {CheckForm Dy} andthen {CheckP Pu})
  77.       else false
  78.       end
  79.    end
  80.    fun{CheckRot Rot}
  81.       case Rot of rotate(angle:Angle 1:Ru)
  82.       then ({CheckVal Angle} andthen {CheckR Ru})
  83.       else false
  84.       end
  85.    end
  86.    fun{CheckScale Scale}
  87.       case Scale of scale(rx:Rx ry:Ry 1:Ru)
  88.       then ({CheckVal Rx} andthen {CheckVal Ry} andthen {CheckR Ru})
  89.       else false
  90.       end
  91.    end
  92.    fun{CheckSpa Spa}
  93.       case Spa of spawn(tmin:Tmin tmax:Tmax 1:Pu)
  94.       then ({CheckForm Tmin} andthen {CheckForm Tmax} andthen {CheckP Pu})
  95.       else false
  96.       end
  97.    end
  98.    fun{CheckR Ru}
  99.       case Ru
  100.       of H|T then
  101.      case H
  102.      of primitive(kind:A) then ({CheckPrim H} andthen {CheckR T})
  103.      [] translate(dx:Dx dy:Dy 1:Ru) then ({CheckTrans H} andthen {CheckR T})
  104.      [] rotate(angle:Angle 1:Ru) then ({CheckRot H} andthen {CheckR T})
  105.      [] scale(rx:Rx ry:Ry 1:Ru) then ({CheckScale H} andthen {CheckR T})
  106.      else false
  107.      end
  108.       [] nil then true
  109.       else false
  110.       end
  111.    end
  112.    fun{CheckP Pu}
  113.       case Pu
  114.       of H|T then
  115.      case H
  116.      of primitive(kind:A) then ({CheckPrimPok H} andthen {CheckP Pu})
  117.      [] translate(dx:Dx dy:Dy 1:Pu) then ({CheckTransPok H} andthen {CheckP Pu})
  118.      [] spawn(tmin:Tmin tmax:Tmax 1:Pu) then ({CheckSpa H} andthen {CheckP Pu})
  119.      else false
  120.      end
  121.       [] nil then true
  122.       else false
  123.       end
  124.    end
  125. in
  126.    case Map
  127.    of map(ru:Ru pu:Pu) then
  128.       if ({CheckR Ru} andthen {CheckP Pu})
  129.       then true
  130.       else false
  131.       end
  132.    else false
  133.    end
  134. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement