comparison org/types.org @ 9:fd38763de457

added links for the pokemon
author Robert McIntyre <rlm@mit.edu>
date Wed, 02 Nov 2011 07:35:57 -0700
parents 4f9ef752e2f0
children eedd6897197d
comparison
equal deleted inserted replaced
8:4f9ef752e2f0 9:fd38763de457
6 #+INCLUDE: ../../aurellem/org/level-0.org 6 #+INCLUDE: ../../aurellem/org/level-0.org
7 7
8 * The Pok\eacute{}mon Type System 8 * The Pok\eacute{}mon Type System
9 9
10 The Pok\eacute{}mon type system consists of seventeen different 10 The Pok\eacute{}mon type system consists of seventeen different
11 \ldquo{}types\rdquo{} (Rock, Grass, Ice, Psychic, Ground, Bug, Flying, 11 /types/ (Rock, Grass, Ice, Psychic, Ground, Bug, Flying, Fire,
12 Fire, Fighting, Dark, Dragon, Poison, Water, Ghost, Normal, Electric, 12 Fighting, Dark, Dragon, Poison, Water, Ghost, Normal, Electric, and
13 and Steel) that interact like an extended version of 13 Steel) that interact like an extended version of Rock-Paper-Scissors:
14 Rock-Paper-Scissors: for example, the Fire type is strong against the 14 for example, the Fire type is strong against the Grass type but weak
15 Grass type but weak against the Water type. In the table below, we've 15 against the Water type. In the table below, we've recorded the
16 recorded the relative strengths of each of the types in the 16 relative strengths of each of the types in the Pok\eacute{}mon type
17 Pok\eacute{}mon type system; the number in each cell indicates how 17 system; the number in each cell indicates how effective an attack of
18 effective an attack of the type in the row is against a 18 the type in the row is against a Pok\eacute{}mon of the type in the
19 Pok\eacute{}mon of the type in the column. We call these numbers 19 column. We call these numbers /susceptibilities/.
20 /susceptibilities/.
21 20
22 In the Pok\eacute{}mon games, only four susceptibility values (two, 21 In the Pok\eacute{}mon games, only four susceptibility values (two,
23 one, one-half, and zero) occur. These numbers indicate particularly 22 one, one-half, and zero) occur. These numbers indicate particularly
24 high susceptibility, average susceptibility, particularly low 23 high susceptibility, average susceptibility, particularly low
25 susceptibility, and no susceptibility (immunity). 24 susceptibility, and no susceptibility (immunity).
46 2000 in America, and is known as the /Generation I Type System/. The 45 2000 in America, and is known as the /Generation I Type System/. The
47 modern pok\eacute{}mon type system was introduced in 2000 with the 46 modern pok\eacute{}mon type system was introduced in 2000 with the
48 introduction of pok\eacute{}mon Gold and Silver, and has been in use 47 introduction of pok\eacute{}mon Gold and Silver, and has been in use
49 ever since. It is called the /Generation II Type System/. 48 ever since. It is called the /Generation II Type System/.
50 49
51 Here are the the definitions of the two type systems. 50 The definitions of the two Type Systems are included below.
52 51
53 * Generation I and II Type System Data 52 * Generation I and II Type System Data
54 53
55 ** Generation II Type System 54 ** Generation II Type System
56 #+label: pokemon-matchups 55 #+label: pokemon-matchups
110 - Poison is super-effective against Bug (normal in Generation II). 109 - Poison is super-effective against Bug (normal in Generation II).
111 - Bug is regularly effective against Ghost (super-effective in 110 - Bug is regularly effective against Ghost (super-effective in
112 Generation II). 111 Generation II).
113 - Ice is normally effective against Fire, (not-very-effective in 112 - Ice is normally effective against Fire, (not-very-effective in
114 Generation II). 113 Generation II).
115 - Ghost is completely ineffective against Psychic. This is considered 114 - Ghost is completely ineffective against Psychic, even though the
116 to be a programning glitch. 115 pok\eacute{}mon anime ran [[http://bulbapedia.bulbagarden.net/wiki/EP022][a three-part series]] about how Ghost
117 116 pok\eacute{}mon are the best way to defeat Psychic pok\eacute{}mon,
118 117 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 Ghosts!" This is considered to be a programning glitch. Ghost is
120 super-effective against Psychic in Generation II.
119 121
120 * Representing the Data 122 * Representing the Data
121 123
122 After creating the Pok\eacute{}mon types namespace, we store the 124 After creating the Pok\eacute{}mon types namespace, we store the
123 tables of susceptibilities above in =pokemon-table-gen-one= and 125 tables of susceptibilities above in =pokemon-table-gen-one= and
231 with key/value pair access. 233 with key/value pair access.
232 234
233 * Interfacing with the Data 235 * Interfacing with the Data
234 236
235 In the pok\eacute{}mon games, a pok\eacute{}mon can have up to two 237 In the pok\eacute{}mon games, a pok\eacute{}mon can have up to two
236 types at the same time. For example, Zapdos, the fearsome legendary 238 types at the same time. For example, [[http://bulbapedia.bulbagarden.net/wiki/Zapdos][Zapdos]], the fearsome legendary
237 that can control lightning, has both the Electric and Flying types. A 239 bird that can control lightning, has both the Electric and Flying
238 pok\eacute{}mon with more than one type gains the advantages and 240 types. A pok\eacute{}mon with more than one type gains the advantages
239 disadvanteags of both types. The suceptibilitys of each type are 241 and disadvanteags of both types. The suceptibilitys of each type are
240 multiplied together to produce the hybrid type's susceptibilities. For 242 multiplied together to produce the hybrid type's susceptibilities. For
241 example, Electric is weak to Ground (susceptibility of 2), but Flying 243 example, Electric is weak to Ground (susceptibility of 2), but Flying
242 is immune to Ground (suceptibility of 0). Zapdos' type, 244 is immune to Ground (suceptibility of 0). [[http://bulbapedia.bulbagarden.net/wiki/Zapdos][Zapdos']] type,
243 Electrig/Flying, is immune to Ground because $2 \times 0 = 0$. 245 Electrig/Flying, is immune to Ground because $2 \times 0 = 0$.
244 246
245 #+srcname: types 247 #+srcname: types
246 #+begin_src clojure :results silent 248 #+begin_src clojure :results silent
247 (in-ns 'pokemon.types) 249 (in-ns 'pokemon.types)
268 "The cumulative susceptibility of the given type combination" 270 "The cumulative susceptibility of the given type combination"
269 [types] 271 [types]
270 (reduce + (map #(expt % 2) (vals (susceptibility types))))) 272 (reduce + (map #(expt % 2) (vals (susceptibility types)))))
271 #+end_src 273 #+end_src
272 274
273 Now we can work out the suceptability of Zapdos automatically. 275 Now we can work out the suceptability of [[http://bulbapedia.bulbagarden.net/wiki/Zapdos][Zapdos]] automatically.
274 276
275 Electric is weak to Ground. 277 Electric is weak to Ground.
276 #+begin_src clojure :exports both 278 #+begin_src clojure :exports both
277 (:ground (pokemon.types/susceptibility [:electric])) 279 (:ground (pokemon.types/susceptibility [:electric]))
278 #+end_src 280 #+end_src
438 440
439 #+results: 441 #+results:
440 : [:dark :ghost] 442 : [:dark :ghost]
441 443
442 Dark and Ghost, which additionally has the property of having no 444 Dark and Ghost, which additionally has the property of having no
443 weaknesses to any other type, is the best type combo in terms of 445 weaknesses to any other type, is the best type combo in terms of
444 susceptance. 446 susceptance.
445 447
446 The Dark and Steel types were introduced many years after 448 The Dark and Steel types were introduced many years after
447 pok\eacute{}mon started. In addition to the additional types, the 449 pok\eacute{}mon started. In addition to the additional types, the
448 pok\eacute{}mon games gained a few new rules concerning some of the 450 pok\eacute{}mon games gained a few new rules concerning some of the
449 matchups of the original types. Therefore, it's also interesting to see what 451 matchups of the original types. Therefore, it's also interesting to
450 type combination was most powerful before those types and new rules were introduced. 452 see what type combination was most powerful before those types and new
453 rules were introduced.
451 454
452 The easiest way to do this with my setup is to just rebind the 455 The easiest way to do this with my setup is to just rebind the
453 =pokemon-gen-two= table to the =pokemon-gen-one= table. Since 456 =pokemon-gen-two= table to the =pokemon-gen-one= table. Since
454 everything that references this variable is a function and we're not 457 everything that references this variable is a function and we're not
455 doing anything too crazy with lazy-sequences and late-binding, this 458 doing anything too crazy with lazy-sequences and late-binding, this
582 #+end_example 585 #+end_example
583 586
584 Electric and Normal are among the best types with which to start the 587 Electric and Normal are among the best types with which to start the
585 game, since they have the fewest weaknesses among all the types. 588 game, since they have the fewest weaknesses among all the types.
586 589
587 At the beginning of the pok\eacute{}mon games, players are given a choice 590 At the beginning of the pok\eacute{}mon games, players are given a
588 between the Fire pok\eacute{}mon Charmander, the Water pok\eacute{}mon Squirtle, or 591 choice between the Fire pok\eacute{}mon [[http://bulbapedia.bulbagarden.net/wiki/Charmander][Charmander]], the Water
589 the Grass/Poison pok\eacute{}mon Bulbasaur. 592 pok\eacute{}mon [[http://bulbapedia.bulbagarden.net/wiki/Squirtle][Squirtle]], or the Grass/Poison pok\eacute{}mon
593 [[http://bulbapedia.bulbagarden.net/wiki/Bulbasaur][Bulbasaur]].
590 594
591 #+begin_src clojure :exports both :results verbatim 595 #+begin_src clojure :exports both :results verbatim
592 (sort-by pokemon.types/susceptance [[:fire] [:water] [:grass :poison]]) 596 (sort-by pokemon.types/susceptance [[:fire] [:water] [:grass :poison]])
593 #+end_src 597 #+end_src
594 598
595 #+results: 599 #+results:
596 : ([:water] [:fire] [:grass :poison]) 600 : ([:water] [:fire] [:grass :poison])
597 601
598 As can be seen, the Water pok\eacute{}mon Squirtle is the most solid 602 As can be seen, the Water pok\eacute{}mon [[http://bulbapedia.bulbagarden.net/wiki/Squirtle][Squirtle]] is the most solid
599 choice starting out, insofar as susceptance is concerned. 603 choice starting out, insofar as susceptance is concerned.
600 604
601 ** The Worst Pok\eacute{}mon Types 605 ** The Worst Pok\eacute{}mon Types
602 606
603 #+srcname: weak-types 607 #+srcname: weak-types
701 whether there is actually a solution. 705 whether there is actually a solution.
702 706
703 In the [[./lpsolve.org][next installment]], I'll use =lp_solve= to solve this problem in 707 In the [[./lpsolve.org][next installment]], I'll use =lp_solve= to solve this problem in
704 a different way. 708 a different way.
705 709
706
707
708 * COMMENT main program 710 * COMMENT main program
709 #+begin_src clojure :noweb yes :tangle ../src/pokemon/types.clj :exports none 711 #+begin_src clojure :noweb yes :tangle ../src/pokemon/types.clj :exports none
710 <<header>> 712 <<header>>
711 #+end_src 713 #+end_src
712 714