From 749f59117a9546d63e15426dbd59f908edd4af87 Mon Sep 17 00:00:00 2001 From: melvinzhang Date: Fri, 6 May 2016 21:44:42 +0800 Subject: [PATCH] remove rule to generate rules.txt and scala script to normalize rules text --- Makefile | 3 -- scripts/normalize_rules.scala | 74 ----------------------------------- 2 files changed, 77 deletions(-) delete mode 100644 scripts/normalize_rules.scala diff --git a/Makefile b/Makefile index 589ad65273..831cd32743 100644 --- a/Makefile +++ b/Makefile @@ -380,9 +380,6 @@ cards/cards.xml: cards/cards.orig.xml cards/scriptable.txt: scripts/analyze_cards.scala scripts/effects.txt cards/cards.xml cards/existing_master.txt scala $^ > $@ -grammar/rules.txt: scripts/normalize_rules.scala cards/cards.xml - scala $^ > $@ - cards/magicdraftsim-sets: curl www.magicdraftsim.com/card-ratings | \ grep Kamigawa | \ diff --git a/scripts/normalize_rules.scala b/scripts/normalize_rules.scala deleted file mode 100644 index a3dd4a8c63..0000000000 --- a/scripts/normalize_rules.scala +++ /dev/null @@ -1,74 +0,0 @@ -import scala.xml.pull._ -import scala.xml._ -import scala.io.Source - -Console.err.println("loading cards from " + args(0)) -val src = XML.load(args(0)) - -Console.err.println("begin analysis") -for (card <- src \ "card") { - val name = (card \ "name").text - val cost = (card \ "cost").text - val loyalty = (card \ "loyalty").text - val pow = (card \ "pow").text - val tgh = (card \ "tgh").text - - val types = card \ "typelist" \ "type" - val rules = card \ "rulelist" \ "rule" ++ card \ "multi" \ "rulelist" \ "rule" - - val normalized_rules = rules - .filter(_.text.trim() != "") - .map(x => normalize(name, x.text)) - .foreach(x => Console.println(x)) -} -Console.err.println("complete analysis") - -//normalize the rule text -def normalize(name:String, rule:String):String = { - val nameBeforeComma = if (name.contains(',')) { - name.substring(0, name.indexOf(',')); - } else { - name - } - - val abilityWord = if (!rule.startsWith("Choose") && rule.contains('—')) { - rule.substring(0, rule.indexOf('—') + 1) - } else { - name - } - - rule - .trim - .replace(name, "@") - .replace(nameBeforeComma, "@") - .trim -} - -/* -Contains the information about the cards that is needed to play the -game. - - - - - - - - - ... - - - - - - - - ... - - - ... - - - ... - -*/