GliderJan Varho

Posts in category Blitz:

Otus.mod Now on Google Code

  • BlitzMax
  • Google Code
  • hg
  • Mercurial
  • modules
  • otus.mod

I have finally moved to using Google Code and Mercurial distributed VCS for my "Otus.mod" BlitzMax module collection.

The modules are currently only available through the source repository. I'm unsure if I will bother with separate downloads at all. Getting the whole set is as easy as hg clone https://otus-mod.googlecode.com/hg/ otus-mod and Mercurial is easily available on all the supported platforms (just apt-get on Ubuntu ; ).

The initial set of modules there is:

I'll add the 5+ beta modules and the ~10 alpha modules I have floating around as soon as I get them to at least compile :p

LZMA Module Version 1.01

  • BlitzMax
  • compression
  • LZMA
  • LZMA2
  • module
  • source
  • update

I updated the module to use version 4.65 of the SDK and a small refactoring in the wrapper. Next up will be version 9.x (beta) and LZMA2 support.

License: None (Public Domain) Downloads: Source: lzma.mod-1.01-source (zip, 38KB) Linux build: lzma.mod-1.01-linux (zip, 231KB) (WordPress doesn't like .tar.gz.) Windows build: May be coming... (meanwhile, Version 1.00 or build from source)

5 Card Table Generator

  • BlitzMax
  • card
  • graph
  • hand
  • MIT license
  • poker
  • search
  • source

The code for my table generator for 5 card poker evaluation is included. It is a BlitzMax file, which requires the "Cactus Kev's Evaluator" to run. Another evaluator can be used instead with some rewriting of code.

It uses a backtracking depth-first search of the problem space and merges nodes as it finds them, using a binary tree for ordering. This is fast enough for five cards - running the generator takes less than half a minute - and generates an optimal <abbr title="directed acyclic graph">DAG</abbr>. The resulting tables (after some conversions to 16-bit integers) are here.

Unfortunately, a direct conversion to seven cards using Kev's eval_7hand would take several days to run, so the 7 card problem requires a more messy approach. I'm still working on that code.

Download: gen_eval5.bmx.tar (8 KB) License: MIT (included) See also: generated tables

Remote Actors for BlitzMax (Experimental)

  • BlitzMax
  • actors
  • module

This is an experimental version of a threaded remote actor module for BlitzMax. It extends the features of my actor module with server and client actors, which pass messages through a network socket. It should allow increased parallelism for an actor based program with very little added complexity.

Included are two modules: actor.mod (1.20) and remoteactor.mod (0.10); both include docs. Also, a simple sample program is included. It should be run twice on the same computer. I didn't write proper socket flushing, so it hangs sometimes, but should be illustrative.

Install: Extract in BlitzMax/mod, build modules, rebuild docs. Download: remoteactor.mod-0.10.zip (10 KB) License: Public domain

Actor Model for BlitzMax v.1.20

  • actors
  • BlitzMax
  • concurrency
  • module
  • threading

Implementation of the actor model for BlitzMax, updated version 1.20 with better thread management and more robust locking. Works both threaded and non-threaded, though there are obviously some differences. Methods and types state when they are threaded-only. Requires a fairly recent version of BlitzMax.

Included are three simple sample programs illustrating the API. If installed as a module, also docs are included.

Install: Extract in BlitzMax/mod, build modules, rebuild docs. Alternatively, comment out module lines and import locally. Download (source only): actor.mod-1.20.zip (7 KB) License: Public domain

Actor Model for BlitzMax v.1.10

  • actors
  • BlitzMax
  • concurrency
  • download
  • module
  • source
  • threading

Implementation of the actor model for BlitzMax, updated version 1.10 with better thread management. Works both threaded and non-threaded, though there are obviously some differences. Methods and types state when they are threaded-only. Requires a fairly recent version of BlitzMax.

Uncomment the Module lines and save to mod/otus.mod/actor.mod if you want a module version. In that case you also get some documentation. Of course, you can just import it locally, too. There are three small samples to give the gist of it.

I'm working on a socket actor, which would allow one to pass messages between remote actors. I'll release a new version when (if) ready with that.

Download (source only): actor.mod-1.10.zip (6.6KB)

Update: Completely superseded by v.1.20.

Object Oriented File System Interface (BMX)

  • BlitzMax
  • file system
  • interface
  • module
  • OOP
  • public domain
  • streams

Here's an object oriented file system interface I've been using for my own projects. It's a module with source and Windows binaries. It is complete with TStream support, including OpenStream interface. It should be pretty intuitive and also includes docs.

Download: Otus.FS.zip (60 KB) Install: Extract under mod/otus.mod and rebuild docs. Copyright: Public domain

Synchronized Data Structures for BlitzMax

  • BlitzMax
  • module
  • synchronization

Synchronized list and map data structure modules for BlitzMax. Just a simple mutex-locked wrapper over the BRL types to make operations atomic. Should be compatible with old code.

Prebuilt for Windows with source. Built using 1.33rc5, but 1.32 should also work. Linux and Mac versions of BRL.Threading have a problem that will hopefully be resolved soon.

To install, extract the zip under mod/otus.mod and rebuild docs.

Download: Synchronized v1.01 (zip, 71KB) License: None/Public Domain

Simple Data Description Language

  • parser
  • BlitzMax
  • Python
  • Lua

I threw together a parser for a simple data description language in BlitzMax.  The syntax is something like that in Python or Lua, but not quite. Whitespace is always insignificant and there are no fatal syntax errors: the whole file is always parsed, and non-conforming markup is ignored (silently by default).

Sample structures: num = 1.234e-56 str = 'Hello "World"' list = [1,2,3] map = {1=2, 3=4} array = (0,1,2)

Download: otus.dataparser.zip

Install: Extract to BlitzMax/mod, build modules, rebuild docs.

LZMA Streams for BlitzMax

  • BlitzMax
  • compression
  • LZMA
  • module
  • source
  • Windows

As promised, here is a BlitzMax module based on my LZMA module that handles automatic compression of streams. By using it reading and writing compressed files is as easy as using "lzma::" as a prefix to OpenStream.

It should also work fine with other types of streams, eg. IncBin streams (using "lzma::incbin::"). It requires that the stream supports seeking, so it won't work with network streams as is.

It requires the LZMA module. Here are source and win32 versions with and without the LZMA module:

  1. Source only
  2. Source only with LZMA
  3. Windows build
  4. Windows build with LZMA

To install, unpack the zip to BlitzMax/mod. See test.bmx for a simple example.

LZMA BlitzMax Module

  • BlitzMax
  • compression
  • LZMA
  • module
  • public domain

I wrapped together a BlitzMax module for LZMA compression. It is based on LZMA SDK (version 4.62) and only has a BlitzMax wrapper written by me - the rest is someone else's work. It is completely in the public domain.

There are two releases for this. The source only version requires building modules whereas the Windows build does not (but obviously only work on Windows).

  1. Source only
  2. Windows build

To install, simply unpack the zip to BlitzMax/mod. The test.bmx file included can be used to test it works and shows how to use it. The interface is like that of Pub.Zlib which comes with BlitzMax by default.

Coming up next: LZMA streams...

MaxPre Alpha Prerelease

  • alpha
  • BlitzMax
  • download
  • MaxPre

I've pulled together a first alpha release of MaxPre - a preprocessor for BlitzMax.

It should support most syntax, but may well throw many random looking errors. It has a simple support for properties, like those in the .NET languages, through the new keyword Property. the test file will show how they work.

The zip contains maxpre.exe, which is the executable. It can be run from the command line or by drag&dropping a source file on it. Dragging the testfile.bmx on it will create testfile.pp.bmx. For it to work one of the following is needed: an environment variable BMXPATH pointing to BlitzMax or the same in bmxpath.txt.

Download: MaxPre Alpha (50KB zip)

BlitzMax Object Loader Module

  • BlitzMax
  • objects
  • public domain
  • reflection
  • source

In connection with another project of mine, I produced a BlitzMax module that allows writing and reading arbitrary objects to streams. It can also be seen as a generalization of ReadInt, WriteString and the rest. It should be useful for saving game states or creating an undo feature.

It uses the reflection module for runtime information about type structures, so it needs a quite recent version of BlitzMax, I think. The zip file below contains both a module version and a simple importable version of it, plus a test program to show how it works.

Released to the public domain - feel free to use however you please.

objectloader.zip (7 KB)