changeset 8:4f9ef752e2f0

more cleanup and better docstrings for clojure functions
author Robert McIntyre <rlm@mit.edu>
date Wed, 02 Nov 2011 07:01:49 -0700
parents d6b8dab05d9d
children fd38763de457
files org/types.org
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/org/types.org	Wed Nov 02 06:48:40 2011 -0700
     1.2 +++ b/org/types.org	Wed Nov 02 07:01:49 2011 -0700
     1.3 @@ -76,7 +76,7 @@
     1.4  | steel    |      1 |   .5 |    .5 |       .5 |     1 |   2 |        1 |      1 |      1 |      1 |       1 |   1 |    2 |     1 |      1 |    1 |    .5 |
     1.5  
     1.6  The rows are attack types, while the columns are defense types.  To
     1.7 -see the multiplier for a pokemon attack against a certain type, follow
     1.8 +see the multiplier for a pok\eacute{}mon attack against a certain type, follow
     1.9  the row for the attack type to the column of the defending type.
    1.10  
    1.11  ** Generation I Type System
    1.12 @@ -372,7 +372,7 @@
    1.13  
    1.14  
    1.15  Now that we have a basic best-first-search, it's convenient to write a
    1.16 -few pokemon-type specific convenience functions.
    1.17 +few pok\eacute{}mon-type specific convenience functions.
    1.18  
    1.19  #+srcname: pokemon-search
    1.20  #+begin_src clojure :results silent
    1.21 @@ -476,7 +476,7 @@
    1.22  : [:ghost :psychic]
    1.23  
    1.24  Ghost and Psychic also manages to have no weaknesses to any of the original
    1.25 -types. 
    1.26 +types, using the old Generation I rules. 
    1.27  
    1.28  #+begin_src clojure :results output :exports both
    1.29  (clojure.pprint/pprint
    1.30 @@ -545,8 +545,8 @@
    1.31  
    1.32  ** Explanations for Common Pok\eacute{}mon Strategies
    1.33  
    1.34 -Many people start out a battle with either a normal pok\eacute{}mon or an
    1.35 -electric pok\eacute{}mon, and here's some justification for that choice.
    1.36 +Many people start out a battle with either a Normal pok\eacute{}mon or an
    1.37 +Electric pok\eacute{}mon. Here's some justification for that choice.
    1.38  
    1.39  #+srcname: weaknesses
    1.40  #+begin_src clojure  :results silent
    1.41 @@ -619,6 +619,9 @@
    1.42    (not (every? #(< 0 %) (vals (susceptibility type)))))
    1.43  
    1.44  (defn type-successors-weak
    1.45 +  "Generate ways to weaken the given type combination.  Discard type
    1.46 +  combinations that either strengthen the given type combination or
    1.47 +  that make it stronger"
    1.48    [limit type]
    1.49    (set (if (<= limit (count type)) '()
    1.50  	   (filter #(< 0 (type-compare-weak type %))
    1.51 @@ -626,7 +629,8 @@
    1.52  
    1.53  (defn pokemon-type-search-weak
    1.54    "Search among type-combos no greater than length n, limited by limit
    1.55 -steps of best-first-search."
    1.56 +   steps of best-first-search.  Find the weakest type combination
    1.57 +   possible in terms of susceptance."
    1.58    ([n] (pokemon-type-search-weak n Integer/MAX_VALUE))
    1.59    ([n limit]
    1.60       (first (last