Help needed for a Gunnery Sim competition result viewer

Greetings all.

I hope that someone here can help

For a Gunnery competition in our Sim Turret at GHRVPK I need something to show the scores and standings for each of 40 contestants. Contestants is split into 4 groups.

About the Sim Turret

I have LibreOffice and my first thought is to use a Calc spreadsheet with 3 sheets. It could be that a Base database would be better suited, but I have no knowledge about databases whatsoever.

I would like a document, that automatically sort the standings per group and totally as the different scores are filled in.

Here is how I imagine sheet 1 Contestants to be:

Note the scores priority. If there are equality in a score section, the next prioritised score determines the placement and so forth.

Here is how I imagine sheet 2 Results per Group to be:

Here is how I imagine sheet 3 Total results to be:

While Group 2B is in the sim, Group 2A is being shown around the facility and Group 1A and 1B is getting rides in our vehicles. Then Group 2A goes into the sim and Group 2B gets shown around while 1A and 1B is still riding. Then Groups 1A and 2B is shown around or in the sim while Groups 2A and 2B are getting rides.

I should have asked sooner as I would like to do a run trough with the document with the helpers on Tuesday 18 April.

It could be pushed until Tuesday 25 April, but the event is the day after, so I would like to avoid that especially if something is not working correctly.

I have included the example LibreOffice spreadsheet made for the pictures in a 7-zip file
Gunner competition GHRVPK 40 contestants.7z (11.1 KB)

Happy Simming


This looks like a fun coding challenge! No promises, but I might give this a shot tomorrow. I think I won’t be able to finish it and I probably need more details after looking at it to get further.
But for starters, a quick demo with a sheet to enter scores and another to show them sorted should be easy1. That should help.

1: the author of this comment routinely underestimates the time it takes to complete a coding task and you should apply a correction factor of ~ π2


“We don’t do this because it’s easy we do it because we totally underestimated the task and now are totally stuck!”


I thought this would be a good opportunity to learn some Excel-fu but quickly gave up on that. Easiest solution is probably to do it all by hand with copy and sort.

Sorted, per group

You can select the inputted data, then go to Data → Sort and select the column by which you want to sort the data. You can even select a second column as tiebreaker.

Sorted, all

You can either hide the columns, or set up some columns to the right, out of screen, to display the value of the cells where you did the input per group, but without the spaces / headers between.
Just enter the formula =A8 in a cell and copy/paste/edit as necessary.

Then copy the values from there, paste them elsewhere, and again do sort.

“Look ma, no hands!”

However, if you really hate using the mouse, then you can use this python script I made. Read the README for instructions:


Ahaha and me (and I do hard physical yardwork)


Thank you Freak

After some difficulties I figured out how to use you script.

It was only when I saved the example file as an ods and then saved a copy as a csv file I could get it to work.

Here are the 2 group results



And the All result

There are a couple of parametres that I forgot to mention and that is how the scores are valued.

Here is a picture that shows which are Highest is best and Lowest is best. None is best for Fratricide.

If it is possible I would also prefer that the standings are best from the top.

I have included the spreadsheet with values made for the picture.

The points and times are pretty close to what wee will get from Steel Beasts.

Gunner competition GHRVPK contestants sort test.7z (12.6 KB)

Happy Simming

1 Like

I told you using built-in sort would be easier! :stuck_out_tongue:
Glad you appreciate the script though.

OK, I can add a calculation based on all columns for the “final score” to sort by, but you’ll have to be more specific than that.

We can add the formula to the script, but you can also easily do it in the sheet itself, using a hidden column to sort by.

Without maths, we can simply sort by score and have one of the other columns as tiebreakers.

But I see you want them all to be weighed. You assigned a “priority” to each column. But that still does not translate to a formula 1 on 1.

Is 5000 user score and 1 fratricide better or worse than 4000 user score and no fratricide?

I guess to narrow it down, let’s just make a linear model to calculate a total score taking everything into account,
and you can tell me how much score we should:

subtract per fratricide: …
subtract per unit of time used: …
add per kill: …
subtract per 10% off from 100% accuracy: …
subtract per unit of time to kill: …

This is just a proposal, we can also make it more complicated: for example, we can halve the total score for every fratricide committed.

If you give me some initial ideas for these numbers, I’ll put them in the spreadsheet so you can see if the total score ranking does what you would expect and you can tweak the numbers more or ask for different rules etc.

A little more specific. Okay. Hmmm….

I don’t know how this affects the difficulty of the project.

This may be messy.

The User Score is the most important. Unless it is dumped to the bottom if there is a fratricide.

If there are more with an equal User Scores, Number of Kills should determine the placement.
If both of these are equal, Time should determine the placement.
If these 3 are equal, Hit % should determine the placement.
If these 4 are equal, ATK should determine the placement.

1 in Fratricide should put users on the lists below all users without Fratricide, but be sorted in the same manner.

The score and other items are calculated by Steel Beasts. The six items is shown on the score page when the scenario is finished and are ready to be filled into the spreadsheet. (Probably by hand from a picture taken of the outside monitor on the turret by somebody else than me.)

The score page in English with the sources marked with red.
(This was my best run trough since I made the scenario and I didn’t use dynamic lead!)

The scores settings page (In Danish)
SB Pro PE Scores settings

The following example shots are in Danish

Time ran out

Used a lot of shots

Fratricide Hit the Ambulance

Hope this is helpful

Happy Simming

1 Like

Thanks, this is perfect! I’ll update the script this weekend.

As an aside, you won’t be surprised to hear that figuring out exactly what the software should do (requirements gathering) is often the most difficult part of a software project.

The pseudocode you gave me above is as clear as requirements can get, really well done!

@DanTDBV One more question: should all players with 2 in fratricide get scored below players with 1 in fratricide, etc.?
Or is there only a two-way split: any fratricides or no fratricides?

@Freak There is only a two-way split as the ambulance is the only other vehicle on the player side.

So it is 1 or no fratricide.

1 Like

OK I wrote the sorting code, just gotta wrap up writing some tests to be sure it behaves as you specified and then I’ll update it in Github.

@DanTDBV Updated. Took more effort than I thought as I ran into issues with parsing and serializing types and decided to fix them the ugly way. I am reasonably sure now that it works as intended, but have a look at the example sheets and test whatever you like. I can probably easily fix it if something’s wrong, it’s finding the bugs that’s the tricky part.

Incidentally, I might be looking for new employment soon, so I’d like to hide this from my public page when you’ve downloaded it :slight_smile:

@Freak Downloaded now. I will be testing tomorrow as I am heading to bed.

Thanm you for your effort. It is very much appreciated.

Well the bed could wait.

I did some testing and I could not get the new sorter to work.

I get a pycache folder with a sort_players.cpython-311.pyc file in it and no files in the sorted folder.

I have tried the same 4 csv files in the old build and it works there.

I created a 4 sheet Example_input_sheet Test.ods file from your Example_input_sheet.ods file to create the csv files from.

I have included both builds and the files created in the zip. Old version v1 and new v2. (83.7 KB)

1 Like

Sleep has been eluding me.

I found a LibreOffice macro that I after some difficulties could convert to output the 4 sheets as 4 csv,s with the correct parameters and they are now working with v1.

I have included the macro.

Now I have to find the bed!
ExportToCsv Macro.7z (766 Bytes)

1 Like

Greetings Freak

To be honest, apart from understanding that it takes effort to solve, I have no idea what ”issues with parsing and serializing types and decided to fix them the ugly way” means.

I have been thinking if it could be a help if we took out Fratricide from the equation?

It should still be entered in the spreadsheet, but could it be a nonfactor when sorting the scores?

We could also take out time as it is already considered in the User Score.

I should also have asked sooner, but I would like it in Danish. Blushing.

English Danish Danish if æøå gives problems
Name Navn

User Score Karakter

Kills Nedkæmpet Nedkaempet

Time Tid

Hit % Træf % Traf %


Fratricide EBS

Non factor text field below the contestant fields with description of GTN and EBS like:

GTN = Gennemsnitlig tid til nedkæmpelse x sekunder

EBS = EgenBeSkydning

What do you think?

Happy Simming

Is the script not working as intended? I fixed the issues I found. Sorting should work as you described before. Please send me examples of things not working as you want. Also you should @ me or send me a direct message, I almost missed this message.
And translation is simple.

Hey, if you need extra pair of eyes with this, I am happy to help with the Python part (review etc). Or maybe it would cause more overhead in this late stage, your call if it’s a good idea.

1 Like

In the earlier reply that starts with “Well the bed could wait.” There is a description of what is happening and all files are included in the file attached to that reply. I hope that is helpfull.

1 Like