Created
May 10, 2012 15:45
-
-
Save bgnori/2654031 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn block-categoly | |
;FIXME, stupid implementation. | |
;available options: | |
; :vacant :enterable :combustible | |
;usage: | |
; (block-categoly :vacant :enterable) => #{} of vacant and enterable | |
; (block-categoly :enterable :vacant) => #{} of vacant and enterable | |
; | |
[&keys] | |
(let [c (set keys) | |
data | |
[[Material/AIR #{:vacant :enterable}] | |
[Material/WATER #{:vacant :enterable}] ;flowing | |
[Material/LAVA #{:vacant :enterable}] ;flowing | |
[Material/FIRE #{:vacant :enterable}] | |
[Material/STATIONARY_WATER #{:enterable}] ; not vacant, we can have it. | |
[Material/STATIONARY_LAVA #{:enterable}] ; may be we need "obtainable" instead of "vacant" or unobtainable. | |
[Material/WEB #{:combustible :enterable}] | |
[Material/BROWN_MUSHROOM #{:combustible :enterable}] | |
[Material/RED_MUSHROOM #{:combustible :enterable}] | |
[Material/RED_ROSE #{:combustible :enterable}] | |
[Material/YELLOW_FLOWER #{:combustible :enterable}] | |
[Material/WHEAT #{:combustible :enterable}] | |
[Material/PUMPKIN_STEM #{:combustible :enterable}] | |
[Material/MELON_STEM #{:combustible :enterable}] | |
[Material/VINE #{:combustible :enterable}] | |
[Material/GRASS #{:combustible :enterable}] | |
[Material/DEAD_BUSH #{:combustible :enterable}] | |
[Material/SUGAR_CANE #{:combustible :enterable}] | |
[Material/LEAVES #{:combustible}] | |
[Material/MELON_BLOCK #{:combustible}] | |
[Material/PUMPKIN #{:combustible}] | |
[Material/WATER_LILY #{}] | |
[Material/CACTUS #{}]] | |
] | |
(set (take-nth 2 | |
(filter (fn [pair] | |
(clojure.set/subset? (last pair) keys)) data))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment