Evaluating Poker Hands

Found a really good challenge over on www.codewars.com. Evaluating poker hands. I opted to use C#’s dictionary feature to map dealt cards with numerical values that can be compared. The hardest part was remembering all the rules and evaluating all the edge cases – player wins on highest card when both players have 4 higher value cards the same (eg “JD TS 8C 4H 3D” vs “JH TC 8S 4D 2C“).

Continue reading »

JTable – Detecting User Edits

So, I want to present the SQL database tables to the end user for editing in my Roms Manager program.  I’ve got the first table displaying in it’s edit window with the SQL backend correctly queried: I’ve strugged to get the propertyChanged listner to properly give me what I need from cells being edited and changed.   Then I found this excellent post over at: https://tips4java.wordpress.com/2009/06/07/table-cell-listener. A nice table listener class to import into my application package. Just added the following code to the table and I suddenly had easy access to the underlying table data for manipulation: Action action = […]

Continue reading »

Emulation Rom Manager

I’ve been interested in system emulation for a number of years now. One thing that is always a bit of a pain is managing the rom files that go with these programs. Applications exist such as EmulationStation and Launchbox but they solve the problem to varying degrees of success. Launchbox is the most complete system I’ve come accross but it is fairly complex and focused too much on the emulators rather than the games. EmulationStation is far easy to set up, using XML files, but again more focused on launch the emulators than organising or cataloguing the games. Indeed, EmulationStation […]

Continue reading »

Using Dictionaries – Summarising Text

A nice challenge over on Reddit for summarising text. It’s a nice simple idea. Take in some text, one or more paragraphs, and automatically pull out 2 or 3 key sentences from the text that give a good overall summary of the contents of that text. The key is, after ignore a small list of common words like “and”, “or”, “I”, “of”, etc, to count the occurances of each unique word and then score each sentance based on the words it contains. Higher scoring sentences will naturally contain more higher scoring words and thus be more relevent and key to […]

Continue reading »

Reddit Easy Challenge #312

Today’s easy challenge was to write a convertor between 90’s ‘leet-speak’ and english. A pretty simple challenge. As with all easy challenges I choose PASCAL as my weapon of choice. The basic implementation was through a single function that converted between characters sets one at a time: userout := Concat(userout, Convert(userin[idx])); The first task was to deal with leet character that are made of multiple symbols ( (\) = N ): I then looped through three arrays of characters doing 1:1 comparisions and spitting out the oposite charater to the one entered:

Continue reading »