Skip to content

Instantly share code, notes, and snippets.

View redblobgames's full-sized avatar
🥰

Amit Patel redblobgames

🥰
View GitHub Profile
@redblobgames
redblobgames / dice.cpp
Created January 23, 2017 05:28
C++11 dice rolling syntax: write 2d6 dice roll as 2_d6 c++ syntax
#include <iostream>
#include <cstdlib>
int roll_dice(int numdice, int die) {
int total = 0;
for (int i = 0; i < numdice; i++) {
total += std::rand() % die;
}
return total;
}
@redblobgames
redblobgames / .block
Last active October 17, 2016 23:00
which d3 apis do people use
license: mit
border: yes
scrolling: yes
@redblobgames
redblobgames / .block
Last active July 31, 2018 04:04
d3 unconf block
license: apache-2.0
scrolling: no
height: 1500
@redblobgames
redblobgames / .block
Last active July 31, 2018 04:03
Outside the box
license: apache-2.0
scrolling: yes
height: 900
@redblobgames
redblobgames / variant.h
Created April 30, 2016 17:20
mapbox::variant pattern matching
#include "variant/variant.hpp"
template<typename ...T> using variant = mapbox::util::variant<T...>;
namespace matchdetail {
template<typename C, typename Arg>
Arg lambda_argument(void(C::*)(const Arg&) const) {}
template<typename Other>
void lambda_argument(Other) {}