Apelife is an αcτµαlly pδrταblε εxεcµταblε implementation of Conway's Game of Life. It's a ~1kloc demo of the Cosmopolitan C Library enables build-once run-anywhere C development of TUI interfaces that can optionally link a WIN32 GUI too within the same statically-linked binary.
TUI Demo
Here's what ./apelife.com
(see download page) looks like if you run it on Linux, Mac, FreeBSD, or OpenBSD. It has excellent support for XTERM mouse integration, which allows you to draw, drag, and zoom. The source code is implemented by just printing plain old ANSI escape codes. You don't need ncurses at all to build something like this. All that's really needed is a single termios ioctl() call.
GUI Demo
Here's what apelife.com
looks like if you run it on Windows. It's possible to use cosmopolitan.a
to have a special case condition for launching on Windows, e.g.
if (IsWindows()) {
Gui();
} else {
Tui();
}
Please note that special casing Windows isn't necessary. If we simply get rid of the WIN32 code by way of dead code elimination, then it'll actually run on the Windows Command Prompt as a TUI application, since cosmpolitan libc polyfills Unix APIs to WIN32 automatically.
if (0 && IsWindows()) {
Gui();
} else {
Tui();
}
Please proceed to the download page to get started!
from Hacker News https://ift.tt/2WRNWox
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.