Skip to content

Instantly share code, notes, and snippets.

View Sch3lp's full-sized avatar
🐚

Tim Schraepen Sch3lp

🐚
View GitHub Profile

Game of Thrones Kata

Rules

  1. Any living character with fewer than two living family members dies, as if their House became extinct.

  2. Any living character with two or three living family members, lives on to the next episode.

  3. Any living character with more than three living family members dies, as if by assassination.

  4. Any dead character with exactly three living family members is reanimated, as if by the Night King.

import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Function;
import static java.util.Arrays.asList;
public class Combinators {
public static <A, B, R> BiFunction<B, A, R> flip(BiFunction<A, B, R> fn) {
@janickr
janickr / conway.sql
Last active September 10, 2020 21:49
conway's game of life in SQL (postgresql) - http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
with recursive generation1(x,y) as ( --the initial board setup
select 2, 3
union
select 3, 3
union
select 4, 3
),
game(n, x, y) as (
select 1, x, y from generation1 -- generation 1 is initial board setup
union all