summaryrefslogtreecommitdiff
path: root/src/utils/FrequencyMap.scala
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2014-11-26 00:41:34 -0800
committeriximeow <me@iximeow.net>2014-11-26 00:41:34 -0800
commit8b3cc4835c4c77df9f207bd342ffd024f0f726e7 (patch)
tree4035899e39897dbbbf3ccbfd96624fe1980fb2b2 /src/utils/FrequencyMap.scala
parent62f1fe9b3ec2a5c05c49acbf47356c28a9b73f61 (diff)
Rest of challenge 6
also hacking junk around the frequency maps.
Diffstat (limited to 'src/utils/FrequencyMap.scala')
-rw-r--r--src/utils/FrequencyMap.scala12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/utils/FrequencyMap.scala b/src/utils/FrequencyMap.scala
index fffdabe..e18fd46 100644
--- a/src/utils/FrequencyMap.scala
+++ b/src/utils/FrequencyMap.scala
@@ -14,7 +14,7 @@ class FrequencyMap(mapargs: Map[Char, Double]) {
if (c.isLower)
mappings.get(c)
else // TODO remove the bias here
- mappings.get(c.toLower).map(_ * 0.0002) // bias HARD against uppercase spam. should make this a per-map setting.
+ mappings.get(c.toLower).map(_ * 0.0004) // bias HARD against uppercase spam. should make this a per-map setting.
def diff(other: FrequencyMap): Double = {
// pseudoscience here
@@ -38,7 +38,7 @@ class FrequencyMap(mapargs: Map[Char, Double]) {
def diffAt(c: Char, charFreq: Double) =
Math.pow(c match {
case ' ' =>
- squared(0.10 - charFreq)
+ squared(0.09 - charFreq)
case '{' | '}' | '`' | '|' | '^' =>
squared(0.000001 - charFreq) // { } | and ` are very unlikely irl
case '[' | ']' =>
@@ -46,13 +46,15 @@ class FrequencyMap(mapargs: Map[Char, Double]) {
case '"' | '\'' =>
squared(0.00001 - charFreq) // " or ' are 100% unlikely 90% of the time
case '~' | '+' | '=' | '<' | '>' | '/' | '\\' =>
- squared(0.00000175 - charFreq) // math is weird kids
+ 1 //squared(charFreq) //squared(0.00000125 - charFreq) // math is weird kids
case ';' | ':' | '-' | '*' | '(' | '&' | ')' | '_' =>
squared(0.000003 - charFreq) // getting into more common punctuation
case '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' =>
squared(0.000002 - charFreq) // numbers are KINDA uncommon
- case '$' | '%' | '#' | '@' | '!' =>
- squared(0.00002 - charFreq) // more punctuation...
+ case '$' | '%' | '#' | '@' =>
+ 1 //squared(0.00002 - charFreq) // more punctuation...
+ case '!' =>
+ squared(0.6 - charFreq)
case '.' | ',' =>
squared(0.00007 - charFreq) // and the last of the punctuations
case '\n' | '\r' =>