22/03/2018

[Windows] Blood Bowl 2 offline league manager

If you are a fan of Blood Bowl and purchased either Blood Bowl 2 or Blood Bowl 2: Legendary Edition on PC, you might be - as many others - extremely disappointed at the lack of an offline (hotseat) league option.

This command line tool provides capability to edit - AT YOUR OWN RISK - the SQLite database where team and player information is stored so that, with a bit of paper tracking, you can update the stats after a friendly match.

This tool is not a cheat/trainer!, it only allows you to edit offline team data, much like the "Custom team" feature of the Legendary Edition, except that feature is only usable at team creation.
This tool is based on the rules found in the Blood Bowl Living Rulebook version 6 and might NOT reflect the actual rules implemented in the game - yet, since I saw some rule tables in the DB, and need to investigate further there..

This tool is an alpha version!, it works without hiccups - but its a barebone tool with some open todos and limitations and the user experience can be further improved, but it works as a starting point if you, like me, crave this feature! :)

You can find the BBManager project on my GitHub and download the compiled jar as well.

Please refer to the project README to find out how to use the tool.

05/03/2018

[Java] Find if two strings are interleaved

A string is the result of interleaving two other strings if it contains ALL characters from both strings in the same order as they appear in the source strings. When determining which character to place in the interleaved string, it is possible to choose each time 0+ characters from either string!

Eg:
ABACCA is the interleaving of ABC and ACA -> AB, A, C, CA
ABACAC is also the interleaving of ABC and ACA -> AB, AC, A, C
ABAACC is NOT the interleaving of ABC and ACA -> AB, A, we expect now a C but find an A instead

The 0+ choice makes things a bit hard, contrarily to the O(N) case where we could pick only 1 character from each string at a time.
It means we might create the result string in more than one way and need therefore to examine all the possibilities before returning our verdict.

03/03/2018

[Java] 0/1 knapsack problem with dynamic programming

Some time ago we saw a good heuristic for the 0/1 knapsack problem, but it was a heuristic and as the testing demonstrate, there are cases where the optimal solution is missed.

The only way to determine the actual optimal solution is to consider all possibilities and therefore compute a 2D (or more, depending on the constraints) matrix which we would later scan to identify which items have been chosen to reach the computed optimal solution.
The matrix rows indicate the items and the columns indicate all weights from 0 up to the maximum bag capacity.