Help needed for a Gunnery Sim competition result viewer

Sorry, I completely missed that. I think I scanned the message while I was sleepy and somehow thought all was good.

I had a look now. Was able to reproduce what you described. When running the command from run_sort.bat in a cmd terminal, I see that it logs an error due to an empty string not being a valid number (fratricide column) Added the proper handling of that.

@UncleZam Thanks for the offer! Luckily the problems are quite simple. Most of the effort in this exercise (as usual in programming) seems to be to figure out the exact requirements. Dots, comma’s, empty is zero, etc.

Because of that, I will let you do the translation to Danish yourself, @DanTDBV . I have put the column names in variables at the top of sort_players.py in this version, and you can change them to whatever you like. Just make sure they are the same as in the csv’s that you provide. The text between the '' is what you should change, not the caps lock part, that is the name of the variable.

######################## Put the column names here #############################
COL_NAME = 'Name'
COL_SCORE = 'User Score'
COL_TIME = 'Time'
COL_KILLS = 'Kills'
COL_HIT_P = 'Hit %'
COL_ATK = 'ATK Seconds'
COL_FRATRICIDE = 'Fratricide'
################################################################################

For example:

######################## Put the column names here #############################
COL_NAME = 'Navn'
COL_SCORE = 'Karakter'
COL_TIME = 'Tid'
COL_KILLS = 'Nedkæmpet'
COL_HIT_P = 'Træf %'
COL_ATK = 'GTN sekunder'
COL_FRATRICIDE = 'EBS'
################################################################################

Btw, Python uses UTF-8 strings by default, so you can use all the æ ø å you like (as long as LibreOffice is also OK with that).

I have not removed the time tiebreaker yet because I am not sure if you actually want that or are proposing it to simplify the script.
If you want to remove the time tiebreaker, you should be able to do that just by removing lines 60, 61 and 73 from that same file:

60:        if self.time != other.time:
61:            return self.time > other.time
73:            and self.time == o.Time

SortScores-master v3.zip (42.5 KB)

1 Like

I just realized that programming a script for a task like this nowadays is a bit like knitting your own shawl: machines like @HAL can probably do a task like this better and faster but it’s a fun way to spend time making something.

1 Like

Yeah, but at the current stage it would likely take more time to instruct the AI than do it yourself. Also, one has to babysit AI for expected result.

But maybe in the future AI might be more dependable. Not scared for my job yet :see_no_evil:

1 Like

Agreed. I do feel lucky that I got started in the field a few years ago and got that experience in doing “manual” programming

1 Like

@Freak

I still can’t get it to work.

I have discovered that the decimals values in Time and ATK was messing up the saved csv files.

It looks to me like the commas denoting the decimals in the spreadsheet are doing the messing.

Because of the sparse time I would like for now to remove Time and ATK from the equation.

I have changed the categories to Danish and I have tried to remove the self.time and ATK lines from the sort_players.py file.

I have tried saving csv’s with the Export to csv script I modified and doing it manually. I have included both results in the csv files saved by script and csv files saved manually folders.

SortScores v3
SortScores-master v3.7z (47.1 KB)

Export to csv script
ExportToCsv Macro.7z (766 Bytes)

The effort is very much appreciated. I am roughly limited to change a few specific values in specific lines of code.

Happy Simming

1 Like

I’ll do that later. In the meantime, please check that you are selecting tab as a separator on csv import and export.

Hm, your csv’s look good. If you could send me some example csv’s with the GTN og Tid kolonner included, then I’d love to see what goes wrong there.

This version seems to be working with the more limited dataset:

SortScores-master v4.zip (13.1 KB)

And yes, I did make a mistake related to the UTF-encoding of the Danish characters :man_facepalming:. But this one is working now

@Freak

It works for me to. After I copied the run_sort.bat file over from v3.

As for the decimal values. It turns out that it is the csv import values. If I turn off comma as a seperator it works fine. I added some decimal values to the Nedkæmpet column and the same happens as with the Danish with times csv’s.

No Comma

Comma

I have included my newest example files in the 7.zip fil.

SortScores-master v4.7z (24.6 KB)

Happy Simming

1 Like

@Freak

We had the event this Wednesday and it went very well.

The Steel Beasts gunnery competition was a hit and SortScores worked perfectly.

It made the process so much easier.

Thank You so very much Freak! Very much appreciated.

I need to relax during the weekend and come over the lack of sleep I have had for the last week.

It is the first time I have been responsible for an event like this and I have mostly been on my own, so it has been draining. Some elements barely clicked together the night before. Very stressful.

Now I just need to relax.

Then I would like for us to re ad the 2 time categories and figure out the best way to prioritise the categories.

It would be a very helpful tool for future competitions in our simulator.

Once again Thank You!

Happy Simming

3 Likes

Thanks for the update! I am very glad it worked and made your day a bit easier.

It was a fun problem and I wish I spent more time programming but I tend to not do it a lot unless I can help myself or someone else with something tangible. So thank you!

I learned some valuable lessons along the way. One of which is that I should have just used the .ods file as input directly.

And ehm, I did not actually remove the time categories in the latest version of the script. I just made them optional. They are still used if they are present in the input csv.

So whenever you want to continue with this, just add them to the input csv’s and don’t forget to put in the correct column names into the script and it will hopefully sort them with the rules you sent previously.

If I remember and get around to it, I will change the script to grab the input straight from the ods file.

Let me know if you want any more changes

1 Like