comparison org/types.org @ 10:eedd6897197d

fixed spelling errors for pokemon.types
author Robert McIntyre <rlm@mit.edu>
date Wed, 02 Nov 2011 08:02:11 -0700
parents fd38763de457
children e1b7ef479bd1
comparison
equal deleted inserted replaced
9:fd38763de457 10:eedd6897197d
1 #+TITLE: Best-First Search for Effective Pokemon Types 1 #+TITLE: Best-First Search for Effective Pokemon Types
2 #+AUTHOR: Robert McIntyre & Dylan Holmes 2 #+AUTHOR: Robert McIntyre & Dylan Holmes
3 #+EMAIL: rlm@mit.edu 3 #+EMAIL: rlm@mit.edu
4 #+description: Finding interesting pokemon type combinations through Best-First search in clojure. 4 #+description: Finding interesting pokemon type combinations through Best-First search in clojure.
5 #+keywords: Pokemon, clojure, best-first search, optimization
5 #+SETUPFILE: ../../aurellem/org/setup.org 6 #+SETUPFILE: ../../aurellem/org/setup.org
6 #+INCLUDE: ../../aurellem/org/level-0.org 7 #+INCLUDE: ../../aurellem/org/level-0.org
7 8
8 * The Pok\eacute{}mon Type System 9 * The Pok\eacute{}mon Type System
9 10
21 In the Pok\eacute{}mon games, only four susceptibility values (two, 22 In the Pok\eacute{}mon games, only four susceptibility values (two,
22 one, one-half, and zero) occur. These numbers indicate particularly 23 one, one-half, and zero) occur. These numbers indicate particularly
23 high susceptibility, average susceptibility, particularly low 24 high susceptibility, average susceptibility, particularly low
24 susceptibility, and no susceptibility (immunity). 25 susceptibility, and no susceptibility (immunity).
25 26
26 - The suceptability of Flying types /against/ Ground is 0, because Ground 27 - The susceptibility of Flying types /against/ Ground is 0, because Ground
27 attacks cannot hurt Flying pok\eacute{}mon at all. The damage that 28 attacks cannot hurt Flying pok\eacute{}mon at all. The damage that
28 a Ground type attack normally does is /multiplied/ by 0 when it is 29 a Ground type attack normally does is /multiplied/ by 0 when it is
29 uesd against a Flying type pok\eacute{}mon. 30 used against a Flying type pok\eacute{}mon.
30 31
31 - The susceptability of Fire types against Water attacks 32 - The susceptibility of Fire types against Water attacks
32 is 2, because Water type attacks are strong against Fire type 33 is 2, because Water type attacks are strong against Fire type
33 Pok\eacute{}mon. The damage that a Water type attack normally does 34 Pok\eacute{}mon. The damage that a Water type attack normally does
34 is doubled when it is used against a Fire type pok\eacute{}mon. 35 is doubled when it is used against a Fire type pok\eacute{}mon.
35 36
36 - The susceptability of Water types against Water attacks is 37 - The susceptibility of Water types against Water attacks is
37 $\frac{1}{2}$, because Water type attacks are strong against Water 38 $\frac{1}{2}$, because Water type attacks are strong against Water
38 type Pok\eacute{}mon. The damage that a Water type attack normally 39 type Pok\eacute{}mon. The damage that a Water type attack normally
39 does is halved when it is used against a Water type 40 does is halved when it is used against a Water type
40 pok\eacute{}mon. 41 pok\eacute{}mon.
41 42
114 - Ghost is completely ineffective against Psychic, even though the 115 - Ghost is completely ineffective against Psychic, even though the
115 pok\eacute{}mon anime ran [[http://bulbapedia.bulbagarden.net/wiki/EP022][a three-part series]] about how Ghost 116 pok\eacute{}mon anime ran [[http://bulbapedia.bulbagarden.net/wiki/EP022][a three-part series]] about how Ghost
116 pok\eacute{}mon are the best way to defeat Psychic pok\eacute{}mon, 117 pok\eacute{}mon are the best way to defeat Psychic pok\eacute{}mon,
117 and the Red, Blue, and Yellow games each have a character who 118 and the Red, Blue, and Yellow games each have a character who
118 states "The only thing Psychic pok\eacute{}mon fear are Bugs and 119 states "The only thing Psychic pok\eacute{}mon fear are Bugs and
119 Ghosts!" This is considered to be a programning glitch. Ghost is 120 Ghosts!" This is considered to be a programming glitch. Ghost is
120 super-effective against Psychic in Generation II. 121 super-effective against Psychic in Generation II.
121 122
122 * Representing the Data 123 * Representing the Data
123 124
124 After creating the Pok\eacute{}mon types namespace, we store the 125 After creating the Pok\eacute{}mon types namespace, we store the
236 237
237 In the pok\eacute{}mon games, a pok\eacute{}mon can have up to two 238 In the pok\eacute{}mon games, a pok\eacute{}mon can have up to two
238 types at the same time. For example, [[http://bulbapedia.bulbagarden.net/wiki/Zapdos][Zapdos]], the fearsome legendary 239 types at the same time. For example, [[http://bulbapedia.bulbagarden.net/wiki/Zapdos][Zapdos]], the fearsome legendary
239 bird that can control lightning, has both the Electric and Flying 240 bird that can control lightning, has both the Electric and Flying
240 types. A pok\eacute{}mon with more than one type gains the advantages 241 types. A pok\eacute{}mon with more than one type gains the advantages
241 and disadvanteags of both types. The suceptibilitys of each type are 242 and disadvantages of both types. The susceptibilities of each type are
242 multiplied together to produce the hybrid type's susceptibilities. For 243 multiplied together to produce the hybrid type's susceptibilities. For
243 example, Electric is weak to Ground (susceptibility of 2), but Flying 244 example, Electric is weak to Ground (susceptibility of 2), but Flying
244 is immune to Ground (suceptibility of 0). [[http://bulbapedia.bulbagarden.net/wiki/Zapdos][Zapdos']] type, 245 is immune to Ground (susceptibility of 0). [[http://bulbapedia.bulbagarden.net/wiki/Zapdos][Zapdos']] type,
245 Electrig/Flying, is immune to Ground because $2 \times 0 = 0$. 246 Electric/Flying, is immune to Ground because $2 \times 0 = 0$.
246 247
247 #+srcname: types 248 #+srcname: types
248 #+begin_src clojure :results silent 249 #+begin_src clojure :results silent
249 (in-ns 'pokemon.types) 250 (in-ns 'pokemon.types)
250 251
270 "The cumulative susceptibility of the given type combination" 271 "The cumulative susceptibility of the given type combination"
271 [types] 272 [types]
272 (reduce + (map #(expt % 2) (vals (susceptibility types))))) 273 (reduce + (map #(expt % 2) (vals (susceptibility types)))))
273 #+end_src 274 #+end_src
274 275
275 Now we can work out the suceptability of [[http://bulbapedia.bulbagarden.net/wiki/Zapdos][Zapdos]] automatically. 276 Now we can work out the susceptibility of [[http://bulbapedia.bulbagarden.net/wiki/Zapdos][Zapdos]] automatically.
276 277
277 Electric is weak to Ground. 278 Electric is weak to Ground.
278 #+begin_src clojure :exports both 279 #+begin_src clojure :exports both
279 (:ground (pokemon.types/susceptibility [:electric])) 280 (:ground (pokemon.types/susceptibility [:electric]))
280 #+end_src 281 #+end_src
378 379
379 #+srcname: pokemon-search 380 #+srcname: pokemon-search
380 #+begin_src clojure :results silent 381 #+begin_src clojure :results silent
381 (in-ns 'pokemon.types) 382 (in-ns 'pokemon.types)
382 (defvar type-compare (comparatize susceptance) 383 (defvar type-compare (comparatize susceptance)
383 "compare two type combinations wrt their susceptibilities") 384 "compare two type combinations W.R.T. their susceptibilities")
384 385
385 (defn type-successors 386 (defn type-successors
386 "Return the set of types that can be made by appending a single type 387 "Return the set of types that can be made by appending a single type
387 to the given combination." 388 to the given combination."
388 [type] 389 [type]