Skip to content

Instantly share code, notes, and snippets.

@Sinthorion
Sinthorion / Makefile
Last active October 26, 2023 12:18
Game written in Makefile. Run with `make -s start`. Run subsequent command with `make -s your.command`
clean: clean.room clean.object clean.item
clean.room:
rm -f *.room
clean.object:
rm -f *.object
clean.item:
rm -f *.item
@Sinthorion
Sinthorion / WombatIntelliJ.icls
Last active March 31, 2023 21:02
Modified Wombat font for Jetbrains IDEs, optimised for PHP development
<scheme name="Wombat" version="142" parent_scheme="Default">
<option name="FONT_SCALE" value="1.0" />
<metaInfo>
<property name="created">2023-03-31T22:46:36</property>
<property name="ide">idea</property>
<property name="ideVersion">2022.2.3.0.0</property>
<property name="modified">2023-03-31T22:48:13</property>
<property name="originalScheme">_@user_Wombat</property>
</metaInfo>
<option name="CONSOLE_FONT_NAME" value="Lucida Sans Typewriter" />
# returns [num, offset]
def parse_num(input, pos)
offset = 0
num = ''
while (pos + offset) < input.size && input[pos + offset].match?(/\d/)
num << input[pos + offset]
offset += 1
end
[
Encodes the input string, until newline, to a Brainfuck program that prints this string
The BF code will use the current cell only, which is the fastest possible way to print
in Brainfuck, despite producing longer code than other methods.
registers:
- '+'/'-'/'.'
- prev
- input
@Sinthorion
Sinthorion / npp_language_wat.xml
Created October 29, 2018 18:17
Notepad++ Custom Language for WebAssembly Text format
<NotepadPlus>
<UserLang name="WAT" ext="wat" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="yes" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00;; 01 02 03(; 04;)</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@Sinthorion
Sinthorion / bfc.c
Last active October 26, 2018 16:52
BFC interpreter in C, based on Erik Bosman's BF interpreter
/*
bfc.c: A BFC Layer 1 interpreter
Based on a Brainfuck interpreter written by Erik Bosman <ejbosman@cs.vu.nl>.
Modified by Sinthorion.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@Sinthorion
Sinthorion / adv.txt
Created October 16, 2018 13:33
Minimal complete solution to the game Lost Kingdom (Brainfuck version, long room descriptions)
y
n
t1
s
e
s
s
t3
n
s
@Sinthorion
Sinthorion / tictactoe.bfc
Last active September 18, 2018 15:09
Brainfuck Tic Tac Toe - Hotseat Version (BFC syntax)
[
BF Tic Tac Toe - Hotseat Version
================================
Memory structure:
00: mode, col, row, zflag, tmp
04: flag, cell_A1, flag, cell_A2, flag, cell_A3,
0A: flag, cell_B1, flag, cell_B2, flag, cell_B3,
10: flag, cell_C1, flag, cell_C2, flag, cell_C3,
@Sinthorion
Sinthorion / bf.rb
Last active September 28, 2020 08:13
Simple Ruby Brainfuck Runner
#!/usr/bin/env ruby
require 'optparse'
options = Hash.new(false)
option_parser = OptionParser.new do |opts|
opts.banner = "Usage: bf.rb [options] <bf_file_or_string>"
opts.on '-t', '--[no-]timing', 'Track compilation and execution time' do |v|
options[:timing] = v
@Sinthorion
Sinthorion / HQ9+.bf
Last active December 5, 2018 17:04
HQ9+.bf
[ memory structure:
input string: (2n+2)
space between used as flags to mark cells; or as additional bytes for computation
DISCLAIMER: INPUT MUST BE TERMINATED BY A NEWLINE FEED OR THE PROGRAM WILL LOOP INFINITELY, and I'm too lazy to fix that
This code assumes wrapping 8-bit cells.
]
>>