Skip to content

Wireworld 1.0.2

Latest
Compare
Choose a tag to compare
@daneelsan daneelsan released this 22 Jan 19:19
· 44 commits to master since this release

libWireworld

libWireworld is a shared library containing the functions Wireworld`Library`WireworldStepImmutable and Wireworld`Library`WireworldStepMutable.

Usage:

state = {
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{3, 3, 2, 1, 3, 3, 3, 3, 2, 1, 3, 0, 3, 3, 2, 1, 3, 3, 3, 3, 2},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{3, 3, 2, 1, 3, 3, 3, 3, 2, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};

Wireworld`Library`WireworldStepImmutable:

Dynamic @ WireworldPlot[state = Wireworld`Library`WireworldStepImmutable[state]]

Wireworld`Library`WireworldStepMutable:

Dynamic[WireworldPlot[state], UpdateInterval -> 0.]
While[True, Wireworld`Library`WireworldStepMutable[state, 100]]

These functions remain experimental for the moment and they are not used by WireworldEvolve nor are documented.

zig build

Adds a new way of building the libWireworld library using zig build.

zig version # 0.9.0
zig build

The library will be stored in LibraryResources/$SystemID/:

ls LibraryResources/MacOSX-ARM64 # libWireworld.dylib

One can also cross compile specifying the target:

zig build -Dtarget=x86_64-linux
ls LibraryResources/Linux-x86-64 # libWireworld.so

The mapping between zig targets and $SystemID is:

{
	"Linux-x86-64" -> "x86_64-linux",
	"MacOSX-x86-64" -> "x86_64-macos",
	"Windows-x86-64" -> "x86_64-windows",
	"MacOSX-ARM64" -> "aarch64-macos",
}