Class ConvertRules

java.lang.Object
edu.wisc.game.engine.ConvertRules

public class ConvertRules
extends Object
This class is used for a one-off project: converting the list of rules found in Kevin's GUI (stored in a JSON file there) to text files describing rules in a similar, but slightly different, format used by our server.
  • Constructor Details

  • Method Details

    • main

      public static void main​(String[] argv) throws IOException, RuleParseException
      Reads Kevin's file such as Games.21-38.json, and converts it to Game Server rule set files.
      {"id":"XTkJxZg3w","version":"0.0.0",
       "games":{
           "9cSFaI_Kp":{"id":"9cSFaI_Kp","boardObjectsArrays":[],"name":"TD-01","ruleArray":"wN2Z5TaTz","useRandomBoardObjects":true,"numRandomBoardObjects":7,"restartIfNotCleared":true},
           "51PK72Yeg":{"id":"51PK72Yeg","boardObjectsArrays":[],"name":"TD-02","ruleArray":"EG_KL7GZR","useRandomBoardObjects":true,"numRandomBoardObjects":7,"restartIfNotCleared":true},
        ... },
       
       "ruleArrays":{
           "un4Q-9EI":{"id":"un4Q-9EI","stringified":"(10,square,*,*,[1,2]) (10,*,blue,10,[2,3])\n(*,*,*,*,[ps,pc])\n(*,*,*,*,[(p+1)%4])","name":"1"},
           "G6jrd4pUG":{"id":"G6jrd4pUG","stringified":"(*,*,*,*,[Nearby])","name":"try-01"},
           "DdG1IEUys":{"id":"DdG1IEUys","stringified":"(*,*,*,Farthest,*)","name":"farthest"},
      ....
      }
      }
      
      Throws:
      IOException
      RuleParseException