Knuckle Cracker

Creeper World 2 => Code Mission Discussion => Topic started by: mopa42 on July 19, 2011, 04:53:29 PM

Title: Weekly Map Scorer Program
Post by: mopa42 on July 19, 2011, 04:53:29 PM
I've got a program that will add up the scores for 5 code maps at once. This could be super useful for our ongoing weekly tournaments (http://knucklecracker.com/forums/index.php?topic=7410.0).
It shows scores and totals for every player in the tournament, high score rankings, stuff like that.
You could use it for any 5 code maps - there doesn't have to be an ongoing tournament.

(http://knucklecracker.com/forums/index.php?action=dlattach;topic=7477.0;attach=5130;image)
Showing the participants' scores from last week (http://knucklecracker.com/forums/index.php?topic=7411.0).


The program is written in Java. When you unzip the file, you'll see the jar file and a folder called lib [As of v0.4 lib is no longer needed]. If you have Java 6, you should be able to just double-click to run. As usual, the source code is packaged up and included in the jar file.

Feedback is welcome.

Questions of things I wasn't sure of:
- do we want to list the total times in either of the high score lists?
- are the forum-formatted things formatted nicely? I can change how the tables look, colors, etc if there is a desire.

Edit - v0.2 is out with automatic mission downloading and incomplete player hiding. See post (http://knucklecracker.com/forums/index.php?topic=7477.msg48791#msg48791) for details
Edit - v0.3 is out with map memory. See post (http://knucklecracker.com/forums/index.php?topic=7477.msg49006#msg49006) for details.
Edit - v0.4 is out with a couple minor improvements. See post (http://knucklecracker.com/forums/index.php?topic=7477.msg65659#msg65659) for details.
Edit - v0.5 is out with bug fixes and export improvements. See post (http://knucklecracker.com/forums/index.php?topic=7477.msg66897#msg66897) for details.
Edit - v0.6 is out with better importing and a fancier results table. See post (http://knucklecracker.com/forums/index.php?topic=7477.msg78816#msg78816) for details.
Edit - v0.7 is out with bug fixes and go-to-thread. See post (http://knucklecracker.com/forums/index.php?topic=7477.msg85121#msg85121) for details.
Edit - v0.8 is out with tournament memory and faster fetches. See post (http://knucklecracker.com/forums/index.php?topic=7477.msg86864#msg86864) for details.
Edit - v0.9 is out with wiki support. See post (http://knucklecracker.com/forums/index.php?topic=7477.msg91239#msg91239) for details. Download it below!
Title: Re: Weekly Map Scorer Program
Post by: Lord_Farin on July 19, 2011, 06:04:55 PM
Very awesome. As a (hobbyist) developer, I'd like to know if you use NetBeans, Eclipse or just plain notepad ;)
Maybe we could think of some sort of encoding string, that could be posted on the tournament's page, which loads the correct maps automatically.
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on July 19, 2011, 06:11:41 PM
Quote from: Lord_Farin on July 19, 2011, 06:04:55 PM
Very awesome. As a (hobbyist) developer, I'd like to know if you use NetBeans, Eclipse or just plain notepad ;)
Maybe we could think of some sort of encoding string, that could be posted on the tournament's page, which loads the correct maps automatically.

I use NetBeans (I sort of mentioned it in the Readme, but if you or anyone wants, I can make available my NetBeans project directory).
And this isn't quite automatic yet, but you can select the table announcing the week's missions and drag and drop onto the top table in my program. It worked great for the first week, but TP used a different table format this week (combining size and complexity), so it isn't as simple.
Title: Re: Weekly Map Scorer Program
Post by: Lord_Farin on July 19, 2011, 06:16:35 PM
Maybe you didn't get it correctly; I meant something like
||| map1 || size1 || compl1 ||| map2 ... compl5 |||
to be posted on the forum page, which could then be translated to the tool.
Another issue I want to mention is the inability to use paste to fill in a mission name.
As a last, I use Eclipse and therefore it might lead to strange behaviour if I started interfering with the code...
Title: Re: Weekly Map Scorer Program
Post by: Lord_Farin on July 19, 2011, 06:23:14 PM
Quote from: Lord_Farin on July 19, 2011, 06:16:35 PM
Another issue I want to mention is the inability to use paste to fill in a mission name.
This could do with having a single left mouse click having the effect of a double one, as I just discovered.
Title: Re: Weekly Map Scorer Program
Post by: Fisherck on July 19, 2011, 07:22:11 PM
Your amazing. I don't know how you do it. You make me feel very ignorant. 8)
Title: Re: Weekly Map Scorer Program
Post by: UpperKEES on July 20, 2011, 01:40:03 AM
Very nice again, Mopa! :)
Title: Re: Weekly Map Scorer Program
Post by: thepenguin on July 20, 2011, 07:41:33 AM
as of now I have to remap .jar files to java because winRAR invaded java
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on July 20, 2011, 11:15:54 AM
Quote from: Lord_Farin on July 19, 2011, 06:16:35 PM
Maybe you didn't get it correctly; I meant something like
||| map1 || size1 || compl1 ||| map2 ... compl5 |||
to be posted on the forum page, which could then be translated to the tool.

What will probably work best is to just keep using the table format of Map Name, Size, and Complexity.
I should be able to whip something up to extract the table from the first post of any Code Mission Discussion thread titled Weekly 5-Map Tournament ....
(The program already knows how to parse the map data from a table like that).

I'm also working on making paste (ctrl-v) work better
Title: Re: Weekly Map Scorer Program
Post by: Lord_Farin on July 20, 2011, 11:38:33 AM
Quote from: mopa42 on July 20, 2011, 11:15:54 AM
Quote from: Lord_Farin on July 19, 2011, 06:16:35 PM
Maybe you didn't get it correctly; I meant something like
||| map1 || size1 || compl1 ||| map2 ... compl5 |||
to be posted on the forum page, which could then be translated to the tool.

What will probably work best is to just keep using the table format of Map Name, Size, and Complexity.
I should be able to whip something up to extract the table from the first post of any Code Mission Discussion thread titled Weekly 5-Map Tournament ....
(The program already knows how to parse the map data from a table like that).

I'm also working on making paste (ctrl-v) work better
Using java.util.regex I think that with some testing the regular expression "\\[table\\].+\\[/table\\]" should work (you can test later if, for example, "
" appears five times) will extract the table.
Title: Re: Weekly Map Scorer Program
Post by: mthw2vc on July 20, 2011, 11:44:38 AM
The program probably shouldn't total up the times of people who have not completed every map.
Title: Re: Weekly Map Scorer Program
Post by: Measure on July 21, 2011, 04:59:43 PM
Quote from: mthw2vc on July 20, 2011, 11:44:38 AM
The program probably shouldn't total up the times of people who have not completed every map.

I agree with this and also think there should be a checkbox to drop players out of the results per player page if they haven't completed all missions.
Title: Re: Weekly Map Scorer Program
Post by: thepenguin on July 21, 2011, 05:25:49 PM
Quote from: Measure on July 21, 2011, 04:59:43 PM
Quote from: mthw2vc on July 20, 2011, 11:44:38 AM
The program probably shouldn't total up the times of people who have not completed every map.

I agree with this and also think there should be a checkbox to drop players out of the results per player page if they haven't completed all missions.

Agreed
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on July 22, 2011, 11:22:09 AM
Here's the first update, v0.2, with a couple fun new features that you've all requested.

- You can now hide people who haven't completed all missions. (and it doesn't list total time unless you've finished the missions)
- You can now paste, copy, and drag in the missions table. It's pretty smart about finding and loading tables if you've copied one, or just pasting one value if there's no table.
- There's a new Import tab which will automatically fetch and load weekly maps from the forum.

(http://knucklecracker.com/forums/index.php?action=dlattach;topic=7477.0;attach=5146;image)

Download the latest version from the link on the first post. (I've removed the old 0.1 download - if anyone needs it for anything, I've still got it, I just didn't want it taking up space anymore)
Title: Re: Weekly Map Scorer Program
Post by: Lord_Farin on July 22, 2011, 01:47:47 PM
Thanks for implementing these nice features. One last request would be some kind of memory that automatically brings up the last 5 maps when the application is opened (ie. the maps which were viewed before the application was closed last time). Such would make for less traffic on the servers, and it would be convenient ;)
Title: Re: Weekly Map Scorer Program
Post by: DarthVader12 on July 22, 2011, 02:12:38 PM
Great tool. This will help the tournaments so much. If I had to add one more option it would be the memory option mentioned above.
Title: Re: Weekly Map Scorer Program
Post by: Fisherck on July 22, 2011, 03:59:43 PM
I've tried but can't get anything that invloves internet connection to work for me. Not the fetch scores, import or export. I have tried reconnecting my internet, but that has not worked either... :(
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on July 22, 2011, 06:21:29 PM
Quote from: Fisherck on July 22, 2011, 03:59:43 PM
I've tried but can't get anything that invloves internet connection to work for me. Not the fetch scores, import or export. I have tried reconnecting my internet, but that has not worked either... :(
Steps to try:
- Make sure you can get scores and view the forum the normal way through a web browser.
- A firewall might be blocking java or my program in general.
- Run as administrator might help maybe
- Is there anything useful in the error message it gives?
- If you still have v0.1, can that fetch scores either?
- Try running the program with a console, since the program sometimes will print detailed errors to standard out. If you run the program with java.exe not javaw.exe (the default double-click association), there will be a console when the program runs. In a command prompt, try java -jar CodeMapTournament0.2.jar, giving a full path like "C:\Program Files\Java\jre6\bin\java.exe" if java isn't in your path (java.exe might also reside in C:\Windows\System32).
Title: Re: Weekly Map Scorer Program
Post by: Fisherck on July 22, 2011, 09:31:20 PM
Quote from: mopa42 on July 22, 2011, 06:21:29 PM
Steps to try:
- Make sure you can get scores and view the forum the normal way through a web browser.
- A firewall might be blocking java or my program in general.
- Run as administrator might help maybe
- Is there anything useful in the error message it gives?
- If you still have v0.1, can that fetch scores either?
- Try running the program with a console, since the program sometimes will print detailed errors to standard out. If you run the program with java.exe not javaw.exe (the default double-click association), there will be a console when the program runs. In a command prompt, try javaw -jar CodeMapTournament0.2.jar, giving a full path like "C:\Program Files\Java\jre6\bin\java.exe" if java isn't in your path (java.exe might also reside in C:\Windows\System32).

Well, it does not give an error message. It just does not do anything when I push the buttons... I have both versions, and neither work. I'll try some of the other stuff and see if that works.
Title: Re: Weekly Map Scorer Program
Post by: Fisherck on July 23, 2011, 10:34:51 PM
Well, now I feel rather embarrassed. Apparantly, if you don't extract it first, it will open up, but you can't fetch the scores. But once you do extract it, there is nothing wrong.... What do you know. ::)
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on July 25, 2011, 12:38:31 PM
Quote from: Lord_Farin on July 22, 2011, 01:47:47 PM
One last request would be some kind of memory that automatically brings up the last 5 maps when the application is opened (ie. the maps which were viewed before the application was closed last time). Such would make for less traffic on the servers, and it would be convenient ;)
That's easy enough.

Here's the latest update, v0.3, now with maps memory. The program stores the 5 maps you last had open into a small file named ".missions" and reads them in again when it starts up. The file is in the same folder you run the jarfile from. No problem if the file is missing / can't be accessed. If the file gets corrupted for some reason, you can just delete it and have the program re-create it.

Download it on the first post (http://knucklecracker.com/forums/index.php?topic=7477.msg48674#msg48674). (I've removed v0.2, let me know if anyone needs it for anything).
Title: Re: Weekly Map Scorer Program
Post by: Evil Roc on July 31, 2011, 09:50:40 AM
Excellent tool, thank you very much!
Title: Re: Weekly Map Scorer Program
Post by: thepenguin on July 31, 2011, 01:24:16 PM
hey, mopa, you typo'd a tooltip on the export tab (latest, not lastest)
Title: Re: Weekly Map Scorer Program
Post by: Lord_Farin on August 09, 2011, 04:52:32 PM
It seems the rounding policy for the times is different in your program than in the game, as I just scored 6:42 in CW2, which shows up as 6:43 in the program. Minor issue I'm sure, but still I thought I'd inform you.
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on August 19, 2011, 05:05:14 PM
Quote from: Lord_Farin on August 09, 2011, 04:52:32 PM
It seems the rounding policy for the times is different in your program than in the game, as I just scored 6:42 in CW2, which shows up as 6:43 in the program. Minor issue I'm sure, but still I thought I'd inform you.
Yeah, sorry about that. It was very hard for me to figure out exactly how Virgil does his rounding, because there can be several steps between the raw frame count and the rounded minutes and seconds. I've given it my best shot, but sometimes it is still off by one second. This doesn't happen very often though.
I might try to come back and fix that sometime.
Title: Re: Weekly Map Scorer Program
Post by: xoft on November 07, 2011, 04:20:18 PM
I was wondering, is the conversion routine from seed phrase (code we enter into CW2) into the level seed (32-bit int that is used by the score script) known? Any chance of sharing the formula with us other programmers? ;)

Thanks in advance
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on November 07, 2011, 04:44:26 PM
Quote from: xoft on November 07, 2011, 04:20:18 PM
I was wondering, is the conversion routine from seed phrase (code we enter into CW2) into the level seed (32-bit int that is used by the score script) known? Any chance of sharing the formula with us other programmers? ;)
Sure thing.
Hope this isn't too confidential to share, but here's what I discovered:

Take the code string, change everything to lower case, take the MD5 hash of that.
Interpret the first 4 bytes (first 8 hex digits) as an unsigned integer.
That gives you the magical seed number for the code map.

(the relevant bits from my code are in Mission.java and ScoreFetcher.java if you were looking at that)
Title: Re: Weekly Map Scorer Program
Post by: UpperKEES on November 07, 2011, 04:51:03 PM
Quote from: mopa42 on November 07, 2011, 04:44:26 PM
Take the code string, change everything to lower case, take the MD5 hash of that.
Interpret the first 4 bytes (first 8 hex digits) as an unsigned integer.
That gives you the magical seed number for the code map.

You just got to love this guy! 8)
Title: Re: Weekly Map Scorer Program
Post by: thepenguin on November 07, 2011, 04:58:43 PM
Quote from: UpperKEES on November 07, 2011, 04:51:03 PM
Quote from: mopa42 on November 07, 2011, 04:44:26 PM
Take the code string, change everything to lower case, take the MD5 hash of that.
Interpret the first 4 bytes (first 8 hex digits) as an unsigned integer.
That gives you the magical seed number for the code map.

You just got to love this guy! 8)

It says that in the source of his file ;)

QuoteThis document describes how to fetch high scores for Creeper World 2 from the server.
*** COMPLETELY UNOFFICIAL! USE AT YOUR OWN RISK! ***

If you can read this, then you know how to open jar files, so you'll probably understand the rest of what I have to say.


Basically, you query http://knucklecracker.com/creeperworld2/scoreQuery.php with various parameters in order to get a list of records in XML format.
The parameter string to the score query is in the usual format ?key1=value1&key2=value2 (or use an HTTP GET object).

The various parameters you can have are:
* gameUID = text
   s0-s19 for Days 1-20, b0-b9 for Bonus 1-10, credits for Credits, and proceduralXXXX-YZ for Code missions.
      XXXX is the decimal digits (no leading zeros) of the number representing the hash of the code string
            take the string, convert to lower case, trim leading and trailing whitespace, then get an MD5 hash. Use the first 4 bytes (first 8 hex digits) to make an unsigned integer.
      Y is the size: 0, 1, or 2 for small, medium, large
      Z is the complexity: 0, 1, or 2 for low, medium, high
   default is s0 for Day 0
* sort = text
   "scores" for sorting by Top Scores or "time" (not times) for sorting by Top Times
   default is "scores" if omitted
* userfilter = text
   whatever you type in for a user name (escaping any funny characters with the %xx code)
   default is blank if omitted
* groupfilter = text
   whatever you type in for a group filter (escaped)
   default is blank if omitted
* timefilter = integer
   0, 1, 2, or 3 for "All Time", "Last Few Days", "Last Week", "Last Month"
   default is All Time if omitted

Of these parameters, only gameUID is really required for normal use.


The document returned is in XML format without spaces so it isn't very human readable.
(If you're using a web browser, use View Source to see the XML goodies)
The format (indented) is roughly this:
<records>
<record>
   <rank>1</rank>
   <user>First Place</user>
   <score>10000</score>
   <time>8000</time>
   <plays>6</plays>
</record>
<record>
...
</record>
...
</records>

The time is given in frames (30 frames per second, and it is tricky to match the way the score viewer rounds to tenths of a second. It truncates instead of rounding in one place, but I think it must round somewhere else. Anyway, divide by 30 to get seconds)


In my program which uses this stuff, I put in a 100 millisecond delay between server requests. Short enough it's not too noticeable by people. It's not strictly necessary, but it seems like bad manners to uncover Virgil's hidden php page and the swamp it with lots of repeated queries.

Anyway, share and enjoy and be nice.
Title: Re: Weekly Map Scorer Program
Post by: xoft on November 08, 2011, 03:08:21 AM
Thanks a lot.

To clear things up even more, "funny" characters (>127) are UTF8-encoded before MD5ing, at least by the official score viewer. I might check if the game does this as well later.
Title: Re: Weekly Map Scorer Program
Post by: DethbyIT on January 05, 2012, 09:50:17 AM
Just posting to bump this up for new players.
dbit
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on February 26, 2012, 05:39:18 PM
It's been a while since I checked in on the tournaments. Looks like there's another bug I can fix.
Quote from: Lord_Farin on February 21, 2012, 03:01:00 AM
Quote from: DethbyIT on February 20, 2012, 06:52:27 PM
SC - I'm not sure why, but this one is not registering when I try to do an 'Import' with the Scorer. Just thought you'd like to know.
dbit
It's because 'February' is spelled out instead of using '2' and hyphens. But you can copy the table (from 'The Shining' up to 'Low') and paste on the missions table in the tool; this will work.
Sometimes the closing dates don't get accepted unless they are in the right format. Currently, the program expects MM-DD-YYYY format only (including the dashes). Well, we've had a couple tournaments use the European format DD-MM-YYYY, which my program misparsed, and some where the month name was spelled out to avoid ambiguity, which it didn't allow at all.
I'm going to work on an update for better (more flexible) date parsing. Should have it out in a day or two.

While I'm doing this, anyone have any other features they want added?
Title: Re: Weekly Map Scorer Program
Post by: Lord_Farin on February 26, 2012, 06:02:23 PM
I have noticed some issues where a player wouldn't get an asterisk on the scores list, despite only completing 3 or 4 maps; mainly when there weren't many contestants (like, when this person was the only one with that much times posted)
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on February 28, 2012, 10:39:26 PM
I've updated the program. Highlights of v0.4:

Download it on the first post (http://knucklecracker.com/forums/index.php?topic=7477.msg48674#msg48674). (I've removed v0.3, let me know if anyone needs it for anything).
Title: Re: Weekly Map Scorer Program
Post by: Amram on March 20, 2012, 02:13:45 PM
found two little quirks.

Tournament Results


RankPlayerTotal Score
* Did not finish all maps.

Scores recoded at 2012-03-20 13:04:28 forum time.

Scores recoded

recorded?

the current tourny I started has a map name it doesn't much like.  importing the tourny works ok, except a map name screws up pretty good.

Eureka!  I've got it.

becomes

Eureka!&nbsp; I've got it.


It seems it doesn't like double spaces, which used to be the the norm when ending one sentence, even if its just a single word.


I'll know if its importing well or not soon as we have a score for that map for it to import.
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on March 20, 2012, 10:25:02 PM
Good catch. I'm working on a fix for those issues.
Edit: looks like it is due to HTML requiring non-breaking spaces (&nbsp;) if there is more than one space between words.
Title: Re: Weekly Map Scorer Program
Post by: xoft on March 21, 2012, 04:33:36 AM
Two spaces being a norm??? Can you provide a source for that? I can't believe that.
Title: Re: Weekly Map Scorer Program
Post by: Amram on March 21, 2012, 05:43:54 AM
Quote from: xoft on March 21, 2012, 04:33:36 AM
Two spaces being a norm??? Can you provide a source for that? I can't believe that.

Its how I recall being taught in english class.  the space between words written or types was expected, and marked against if not, to be shorter than that which ends your sentences.  Its something i've never really looked back on, but I can't seem to find a good example of it now.  it does seem rare to find a webpage with sentences ended with a double space now that i actually look.

Looking now I can find plenty of examples of people on both sides calling the other wrong, but nothing i would call 'definitive'.

I can however find this:  http://www.typographyforlawyers.com/?page_id=1325
QuoteI know that many peo­ple were taught to put two spaces between sen­tences. I was too. But these days, using two spaces is an obso­lete habit. The prac­tice was passed down from the type­writer era.

Seems im just getting old.........


So, I will meet you in the middle.  I won't retract the 'norm' citation, but I will insert 'used to be the '.  Growing old sucks, you were taught, swear left right and center its correct, and find it now is actually wrong, lol.

I do still think the scorer should behave with it as it's evident it will occasionally encounter it.  I doubt this will be the last time it encounters doubled spaces.
Title: Re: Weekly Map Scorer Program
Post by: Lord_Farin on March 21, 2012, 03:44:44 PM
Quote from: xoft on March 21, 2012, 04:33:36 AM
Two spaces being a norm??? Can you provide a source for that? I can't believe that.
It appears to be a (formal) standard in English writing. The language LaTeX for (among others) production of mathematical text has it as a standard. I know this, because the same two spaces is erroneous in Dutch, and has to be manually put into the LaTeX parser by the command \frenchspacing. Now I'm quite sure that LaTeX would not put an erroneous condition into their parser as a standard. Hopefully, this provides some justification. But maybe this discussion needs to be taken to the 'random section'.
Title: Re: Weekly Map Scorer Program
Post by: xoft on March 22, 2012, 05:15:25 AM
Thank you for the explanation. I'm from Czech Republic and I've never seen such a thing even mentioned, so I guess it's some "western" weirdness, same as inches and feet instead of cm ;)
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on March 22, 2012, 02:18:21 PM
I added 0.1 to the version number of the program so now things are 25% better ;)

Highlights of the latest release, v0.5:

Download the program on the first post (http://knucklecracker.com/forums/index.php?topic=7477.msg48674#msg48674). (I've removed v0.4, let me know if anyone needs it for anything).
Title: Re: Weekly Map Scorer Program
Post by: Amram on March 22, 2012, 03:23:14 PM
Quote from: mopa42 on March 22, 2012, 02:18:21 PM
I added 0.1 to the version number of the program so now things are 25% better ;)
Rule 6 reminders: if you enter maps with repeated size/complexity combinations, the program will highlight the offending maps. It only warns - you can still enter whatever maps you want.

perfect, a safety net to prevent me from being retarded again, lol.
Title: Re: Weekly Map Scorer Program
Post by: Helper on August 07, 2012, 06:42:03 AM
@mopa42 -
Running Tournament Scorer V.5 on Windows 7, SP1.

Attempting to Import current game and getting Java warning:
"Something went wrong!"
"java.lang.NullPointerException"

MS released some patches/updates last night and I'm not sure if that is the cause.

Any thoughts/suggestions?

Thank you.
Title: Re: Weekly Map Scorer Program
Post by: J on August 07, 2012, 07:34:34 AM
Fill in the table yourself (map names, height, complexity, just do it yourself and you don't need to import tables)
Title: Re: Weekly Map Scorer Program
Post by: thepenguin on August 07, 2012, 07:39:34 AM
Running Tournament Scorer V.5 on Windows XP, SP3.
I seem to get NullPointerexception whenever I try to connect to the internet

not before, but now it seems to happen with v3 and v2 as well
Title: Re: Weekly Map Scorer Program
Post by: Helper on August 07, 2012, 07:46:24 AM
@J - Thanks.
I did the manual trick on last week's game and thought I would try the 'Import' function this week. I hadn't seen the problem mentioned here, so thought I would post it.
This week's titles are now plugged in (manually) and all of the scoring functions seem to be working as designed.

[Off-topic - when are you submitting another map...it's been a while and they are always worth playing.
:)]

@thepenguin - Thanks for testing that. I was going to try an XP box next.

I know that MS updates will often break links/functions, so maybe that is the reason.
Title: Re: Weekly Map Scorer Program
Post by: thepenguin on August 07, 2012, 07:52:27 AM
Quote from: Helper on August 07, 2012, 07:46:24 AM
This week's titles are now plugged in (manually) and all of the scoring functions seem to be working as designed.
I'm pretty sure they aren't WAD on an XP box, because they aren't working.

They are working right, just too well (PEBCAK)
Title: Re: Weekly Map Scorer Program
Post by: Helper on August 07, 2012, 02:56:29 PM
LOL!
"PEBCAK"...closely related to "PICNIC", I believe. Frequently I am an example of both.
Title: Re: Weekly Map Scorer Program
Post by: thepenguin on August 07, 2012, 06:58:06 PM
yeah, import buttons still aren't working (at all)

just the scoring functions work well
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on August 11, 2012, 12:03:00 AM
I'm working on a fix for these (and other) issues. I just don't have a lot of time right now, probably won't for another couple weeks.
For now, here's a build that probably has some import/null errors fixed.
Title: Re: Weekly Map Scorer Program
Post by: Helper on August 11, 2012, 07:22:54 AM
@mopa42 -
The fix worked - thank you.
I just tried the new version and it pulled up all of the new games.

Tournament Results



   
   
   
   
   
RankPlayerTotal Score
1.Wheatmidge58346
2.Helper57231
3.UoADeadeye42983*
4.ctuna12222*
* Did not finish all maps.

Scores recorded at 2012-08-11 10:59:47 forum time.
Title: Re: Weekly Map Scorer Program
Post by: SmileyCoder on August 24, 2012, 09:13:06 AM
Hej Mopa

Can I ask you how you retrieve the scores for your tool?

I am maintaining the thread "Do a Member" and I like to check if the maps have actually been, and was wondering how you are getting the scores?

I would then like to implement a similar method, allthough in VB (Since I don't do java :)

Hoping you can help.
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on August 24, 2012, 12:04:42 PM
Quote from: SmileyCoder on August 24, 2012, 09:13:06 AM
Can I ask you how you retrieve the scores for your tool?

There's a writeup in the source code - extract the jar file (jar = zip), then look at the docs\HOWTO-get-scores-from-server.txt file. TP also quotes it here (http://knucklecracker.com/forums/index.php?topic=7477.msg58307#msg58307).

Summary of the method: query http://knucklecracker.com/creeperworld2/scoreQuery.php?gameUID=proceduralX-YZ,
where X is the first 4 bytes of the MD5 hash of the lowercase code name, represented as unsigned integer; Y is size 0-2; and Z is complexity 0-2. Then parse the XML data.
Example: for the map "(e)" on large/high, the corresponding URL is http://knucklecracker.com/creeperworld2/scoreQuery.php?gameUID=procedural1021749350-22.
Title: Re: Weekly Map Scorer Program
Post by: SmileyCoder on August 27, 2012, 04:23:36 AM
Thank you very much. I have been trying now to recreate this in a VBA environment, but must admit my knowledge of working with byte and hex values is quite limited.

I am going to try and take it step by step, since my current approach isn't working :P

Can I ask you, for the map "(e)" what value do you get for the MD5 hash of "(e)"? so that I have something to compare with, and at least know that I got the first part right.

Once again, thank you.


For comparison, I get MD5("(e)")=3ce6a866dc8e30ae0263bdcf0ea27809

If I try to convert the first hex value "3c" to a byte I get 60
Converting the first 4 hex values, and concatanating them gives me: 60230168102

P.S. Thanks for the jar=zip tip, did not know that.
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on August 27, 2012, 11:19:39 AM
(e) -> 3ce6a866dc8e30ae0263bdcf0ea27809.
Next you convert the first 4 bytes all at once: 3ce6a866 -> 1021749350. In java I use Long.parseLong(hex, 16) to do the conversion; I don't know what the equivalent method in VBA is. I used a Long format to make sure the number was unsigned (as all integers in Java are signed).
Code (The method I use) Select

public static long getSeedFromString(String str) {
    str = str.toLowerCase().trim();
    String hex = DigestUtils.md5Hex(str).substring(0, 8);
    return Long.parseLong(hex, 16);
}

Title: Re: Weekly Map Scorer Program
Post by: SmileyCoder on August 27, 2012, 12:30:26 PM
Thank you, finally got it! I had somehow gotten the idea that you did each byte seperately. Thank you very much for your help and patience!
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on September 16, 2012, 10:14:15 PM
I found some time to work some more on this program, and now most of the import bugs are fixed. Everything is reasonably tested and polished, so I'm uploading it as v0.6. (Side note: this is now over 3000 lines of code. Wow!)

Highlights of the latest release:

Download the latest version on the first post (http://knucklecracker.com/forums/index.php?topic=7477.msg48674#msg48674). (I've removed v0.5, let me know if anyone needs it for anything).
Title: Re: Weekly Map Scorer Program
Post by: Helper on September 17, 2012, 11:29:45 AM
mopa42 - v6.0 rocks!
I just downloaded it and ran through the functions.
Exellent work and will sure make it easier to post and update scores.

Very nice work.
Title: Re: Weekly Map Scorer Program
Post by: SmileyCoder on November 27, 2012, 03:09:19 PM
Minor bug report:
An oddity occured, and I wonder if it is by intent. When viewing the rankings for this game:
Current High Scores:
1: inept_celt   45279
2: TheSmileyCoder   46824*
3: Helper   44747*
4: Ronini   30292*
5: dt42   11276*
6: Wheatmidge   11127*
7: UoADeadeye   10852*
8: rob3k   10383*

* Did not finish all 5 missions.
It shows inept_celt in first place even though he has less points then me. However when exported it looks ok:

Results Per Player


   
   
   
   
   
   
   
   
   
RankNameDinosoursGummy BearsRocketsSmartiesFuzzy PeachesTotal ScoreTotal Time
1TheSmileyCoder1170112177111831176346824
2inept_celt9929947795036623974745279160:46
3Helper1111211559105551152144747
4Ronini980410612987630292
5dt421127611276
6Wheatmidge1112711127
7UoADeadeye1085210852
8rob3k1038310383
Scores recorded at 2012-11-27 15:04:46 forum time.

I presume it is because he has completed all maps?

P.s. Love your score tool, use it every week.
Title: Re: Weekly Map Scorer Program
Post by: Helper on November 27, 2012, 03:12:49 PM
Quote from: SmileyCoder on November 27, 2012, 03:09:19 PM
It shows inept_celt in first place even though he has points then me.

I think that is probably the reason.
Finishing "Rockets" right now, so let's see what happens when I post that score.


EDIT:
Posting current results to see what they look like:
************************
Results Per Player


   
   
   
   
   
   
   
   
   
RankNameDinosoursGummy BearsRocketsSmartiesFuzzy PeachesTotal ScoreTotal Time
1Helper11112115591104710555115215579461:50
2inept_celt9929947795038591974747247155:38
3TheSmileyCoder1170112177111831176346824
4Ronini980410612987630292
5dt421127611276
6Wheatmidge1112711127
7UoADeadeye1085210852
8rob3k1038310383
Scores recorded at 2012-11-27 15:38:25 forum time.
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on November 27, 2012, 03:39:43 PM
The sorting algorithm works like this:

The first sort by number of maps played is sort of arbitrary. It made sense to me at the time, but the behavior you're seeing is consistent with that decision.
It is a little weird that the high score chart apparently doesn't do it the same way.
I'll look into it, but for now just stop outscoring people by one full map. :)
Title: Re: Weekly Map Scorer Program
Post by: SmileyCoder on November 27, 2012, 03:58:31 PM
I am a programmer myself, and I know perfectly well how things can make sense at point of writing it, but somewhere down the line 2 years after its forgotten rears its head up in some unpredicted manner. Its really an edge case, someone being able to outscore by an entire map, as I indicated I would only consider it a minor bug. Still I personally prefer to get all bug reports in, minor to major, so that I can fix the minor bugs before they become major.
Title: Re: Weekly Map Scorer Program
Post by: rob3k on November 27, 2012, 08:54:08 PM
I would love to get a copy of your netbeans project to check it out. I'll likely just poke around a bit and not much more, but I'm curious. Very slick program and intuitive. Took me about 10 seconds to figure out how to import the list of tournaments and get the scores for this week.
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on November 28, 2012, 08:00:14 PM
Glad you like it!

Here's my project directory. I don't think there's too much there that's not already in the jar, but if you use Netbeans yourself this should be the easiest way to browse around. There is some experimental/work in progress stuff here that I haven't published elsewhere yet.

Quick guide to the structure:
MainFrame is the main gui screen. Some bits of it are created from the gui builder, some are added in at run time. The internet code is in ScoreFetcher and AutoWeeklyMissionFetcher. The output buttons are handled in the Reports class. And the rest I'm sure is important in some way.

I haven't tested opening this project folder and importing into netbeans, but it should work.
Title: Re: Weekly Map Scorer Program
Post by: rob3k on November 28, 2012, 09:55:30 PM
Thanks for that!  Opened right up in my copy of netbeans. I've only begun to use netbeans - played around with tweaking a few various tutorials - but the IDE makes it easy to follow a button on down to the code behind it. Complex but very slick. Love the comments!
Title: Re: Weekly Map Scorer Program
Post by: SmileyCoder on December 05, 2012, 03:53:50 AM
Improvement suggestion:
Have a button that opens the default browser to the location of the thread used for importing tournament scores.
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on December 08, 2012, 03:26:52 AM
SmileyCoder - thanks for the feedback. I've been able to implement both of your comments. Here's version 0.7.

Highlights:

Download the latest version on the first post (http://knucklecracker.com/forums/index.php?topic=7477.msg48674#msg48674). (I've removed v0.6, let me know if anyone needs it for anything).
Title: Re: Weekly Map Scorer Program
Post by: Helper on December 08, 2012, 02:21:21 PM
mopa42 - I'm using v 7.0 for this week's game and it is working flawlessly.
Thank you.
Title: Re: Weekly Map Scorer Program
Post by: SmileyCoder on December 08, 2012, 03:52:03 PM
Thanks for the improvements. Would it be possible to store the URL of the last imported tournament during import, and have a easy link to that? (Like missions are stored) The goto tournament is nice, but usually I am only interested in the latest tournament. What usually happens for me at least, is opening up the score tool, getting scores, and based on those scores possibly going to the forum to make a post.

Now I don't know exactly how you retrieve the information, but I presume its simply scraping the first post of each thread and trying to to parse it. The function is somewhat sluggish (12 seconds last run). In terms of functionality of course I still love the tool, and will continue to use it regardless, but most of the time my only real interest is in the top 1 or 2 tournaments (last weeks/next weeks). Would it be significantly faster if it only loaded the top few tournaments, possibly with option to load all tournaments?

Nice work
Smiley
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on January 08, 2013, 11:49:27 AM
Yeah, that would make more sense to focus on the latest tournament. I worked on my program over break with that in mind, and I think it turned out pretty well.

So here's v0.8, a new update for the new year. Highlights:

Download the latest version on the first post (http://knucklecracker.com/forums/index.php?topic=7477.msg48674#msg48674). (I've removed v0.7, let me know if anyone needs it for anything).
Title: Re: Weekly Map Scorer Program
Post by: Helper on January 08, 2013, 12:03:16 PM
I just used it to post here:
http://knucklecracker.com/forums/index.php?topic=12382.0

Flawless - first time, every time.
Title: Re: Weekly Map Scorer Program
Post by: mopa42 on March 11, 2013, 12:22:55 AM
The program now supports the new wiki (http://knucklecracker.com/wiki/doku.php?id=cw2:weekly_5_map_tournament). All of the tables can be exported in wiki code format as well as BBcode. New in this version (0.9):

Download the latest version on the first post (http://knucklecracker.com/forums/index.php?topic=7477.msg48674#msg48674). (I've removed v0.8, let me know if anyone needs it for anything).