Mercurial > repos > icfp2013
changeset 2:5cf8de487ed6
Adding sizes analysis
author | Joshua Garnett <josh.garnett@gmail.com> |
---|---|
date | Thu, 08 Aug 2013 23:06:56 -0400 |
parents | cdfc5e2de435 |
children | dfc5f00c94bc |
files | tools/parse.scala |
diffstat | 1 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/parse.scala Thu Aug 08 21:08:01 2013 -0400 +++ b/tools/parse.scala Thu Aug 08 23:06:56 2013 -0400 @@ -11,11 +11,19 @@ var totalProblems = json.size var totalSize = 0 val operatorHash = HashMap[String, Int]() +val allSizes = HashMap[Int, Int]() for(p <- json) { val problem = p.asInstanceOf[JSONObject] - totalSize += problem.get("size").asInstanceOf[java.lang.Integer] + val size = problem.get("size").asInstanceOf[java.lang.Integer] + totalSize += size val operators = problem.get("operators").asInstanceOf[JSONArray] + + allSizes(size) = allSizes.get(size) match { + case Some(count) => count + 1 + case None => 1 + } + for(o <- operators) { val operator = o.asInstanceOf[String] operatorHash(operator) = operatorHash.get(operator) match { @@ -33,3 +41,8 @@ for((key, value) <- operatorHash) { println(" " + key + ":" + value) } + +println("Size Count: ") +for(key <- allSizes.keys.toList.sorted) { + println(" " + key + ":" + allSizes(key)) +} \ No newline at end of file