- Created Wednesday, December 23rd 2015 @ 22:38:57
I am working on a Java bot and I have some precomputed data stored in a text file that I load with my Java project. It seems like when I upload my project to the servers, my Java classes are unable to find these resources. Does this have something to do with classpaths or something?
Right now I'm just planning on saving my data into Strings saved in a Java class as a workaround. But I'm just wondering if it is possible to read data files that you upload with your bot.
- Created Thursday, December 24th 2015 @ 20:33:38
You have to use the data in string method.
- Created Friday, December 25th 2015 @ 20:56:56
Ok, thanks for the tip!
- Created Wednesday, February 17th 2016 @ 18:32:58
Hi guys, I know this competition is long over now, but I am still working on it. Are either of you able to provide details on how you stored your data in a string & then most importantly, how do you read the data into a data structure (whichever structure that may be) at run time?
- Created Thursday, March 3rd 2016 @ 17:26:19
One possible way: Convert your big data structure to a byte array. Then convert the byte array to a very long string (e.g. using base64). Split the string into an array of substrings (I used max length of 30000, perhaps can be up to 65535). Auto-generate a java class that contains this array of strings. Then at startup you have some code that performs the reverse (constructs a long string from the substrings, decodes it into a byte array, etc).
- Updated Friday, March 4th 2016 @ 04:08:12
Thanks so much for answering my post! Unfortunately, as I mentioned in another thread, I'm a pretty inexperienced programmer so a lot of what you are saying I have a hard time understanding exactly what you mean. For example, I don't know what it means to use base64 to convert a byte array to a string. And, I don't know how to "auto-generate a java class". That's OK though, because I was able to figure it out on my own! I'm sure it was a very inefficient method and it took too many hours but this is what I did:
- Copy output from CFR run to Excel
- Use Excel "Text to Columns" function to separate infoset and actions into columns
- Use Excel to perform desired thresholding and purification on action strategies
- Add quotes around each line and plus sign at end.
5 Save as Comma separated file and copy and paste the whole thing directly into my Java Class.
6 Manually split the string into small enough pieces that Java can handle (about 1500 lines at a time).
7 Repeat above until all output added to class since Excel can only handle 32768 lines at a time.
8 Create code to read my string into a hashmap at runtime.
- Created Friday, March 4th 2016 @ 04:06:41
So as you can see, I think what I did in many ways is very similar to what you did. I think I just went about it in a little bit of a different way. My next step will be to create a program that reads my CFR output and performs all steps above automatically. It will save lots of time when I want to update my program from a larger run.
One more thing... I tried contacting you on Facebook too since there is no mechanism other than public posting to communicate with others. Anyway, thanks again for helping out.
- Created Friday, March 4th 2016 @ 18:40:30
Ok, it sounds like you found out how to do it. Cool that you succeeded with the CFR implementation!
If you want you can mail me, louis at shortestpath dot se