Skip to content

Instantly share code, notes, and snippets.

View rmartinho's full-sized avatar

R. Martinho Fernandes rmartinho

View GitHub Profile
@rmartinho
rmartinho / game.md
Last active August 29, 2015 14:06
A game of Nomic run by denizens of the Lounge<C++>.

Lounge<Nomic>

Immutable Rules

101. All players must always abide by all the rules then in effect, in the form in which they are then in effect. The rules in the Initial Set are in effect whenever a game begins. The Initial Set consists of Rules 101-116 (immutable) and 201-213 (mutable).

102. Initially rules in the 100's are immutable and rules in the 200's are mutable. Rules subsequently enacted or transmuted (that is, changed from immutable to mutable or vice versa) may be immutable or mutable regardless of their numbers, and rules in the Initial Set may be transmuted regardless of their numbers.

103. A rule-change is any of the following:

@rmartinho
rmartinho / frontier-magic.md
Last active October 7, 2015 13:38
Beyond the Frontier Magic

The [Frontier Magic rules][wizards rules] created by Wizards are a good start but not as fun as we had expected. So we made up new rules based off of the same idea. These are those modified rules.

Terrain

TODO: more complete description of the terrain

Home row

The home row is a row between a player and the land cards.

@rmartinho
rmartinho / halcyon.md
Last active October 10, 2015 14:58
Halcyon

This document is an informal collection of design ideas for the Halcyon programming language. This document in in permanent draft status; do not take anything you read here as final. There are no plans to ever actually implement the ideas here; they're listed only for future reference.

Wants

  • Static, strong typing

    Type errors at runtime are stupid.

  • Type inference

@rmartinho
rmartinho / sarray2d.h
Created October 26, 2012 17:04
Two-dimensional array with dimensions determined at compile-time
// Two-dimensional array with dimensions determined at compile-time
//
// Written in 2012 by Martinho Fernandes
//
// To the extent possible under law, the author(s) have dedicated all copyright and related
// and neighboring rights to this software to the public domain worldwide. This software is
// distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
@rmartinho
rmartinho / darray2d.h
Created October 26, 2012 17:05
Two-dimensional array with dimensions determined at runtime
// Two-dimensional array with dimensions determined at runtime
//
// Written in 2012 by Martinho Fernandes
//
// To the extent possible under law, the author(s) have dedicated all copyright and related
// and neighboring rights to this software to the public domain worldwide. This software is
// distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
@rmartinho
rmartinho / arrays.h
Last active October 12, 2015 02:48
Simple functions for better usage of arrays
// begin() and end() functions for arrays (C++03)
//
// Written in 2012 by Martinho Fernandes
//
// To the extent possible under law, the author(s) have dedicated all copyright and related
// and neighboring rights to this software to the public domain worldwide. This software is
// distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
@bananu7
bananu7 / bit_ops.cpp
Created February 15, 2013 20:32
Bit operations from Robot
template <int Size>
struct uint_least : uint_least<Size+1> {};
template <>
struct uint_least<8> : identity<u8> {};
template <>
struct uint_least<16> : identity<u16> {};
template <>
struct uint_least<32> : identity<u32> {};
template <>
struct uint_least<64> : identity<u64> {};
@rmartinho
rmartinho / flavoured_strings.cpp
Created March 23, 2013 13:50
Using char_traits to get strong string aliases.
#include <string>
#include <iostream>
namespace dessert {
template <typename Tag>
struct not_quite_the_same_traits : std::char_traits<char> {};
template <typename Tag>
using strong_string_alias = std::basic_string<char, not_quite_the_same_traits<Tag>>;
using vanilla_string = std::string;
@rmartinho
rmartinho / fast.c++
Last active December 16, 2015 02:39
“I want it as fast as possible”
int main(){}
@rmartinho
rmartinho / rad.md
Last active April 9, 2019 00:37
Randall Munroe's Radiation Dose Chart

(presented in units of time of exposure to background radiation)

You can find the original chart here. I added some other values; additional sources can be found at the bottom.

Description Dose
Sleeping next to someone 7m
Living within 50 miles of a nuclear power plant for a year 13m
Eating one banana 15m
Living within 50 miles of a coal power plant for a year 45m