Skip to content

Instantly share code, notes, and snippets.

samorajp / template.txt
Last active Oct 22, 2020
download and import linalg
View template.txt
!wget -N
import linalg
# encoding: utf-8
import pygame
from pygame.draw import circle, line
from pygame.locals import *
import misjonarze
# Initialize the game engine
# Constants
samorajp /
Created Feb 27, 2016
Program rozwiązujący zagadkę o misjonarzach i kanibalach dla ich dowolnej liczby oraz dowolnej pojemności łódki.
def mutations(state, boat_size):
m_left, k_left, boat, m_right, k_right = state
sign, other_side = (-1, "R") if boat == "L" else (1, "L")
naive_mutations = [
(m_left + sign * m_diff, k_left + sign * k_diff,
m_right - sign * m_diff, k_right - sign * k_diff)
for m_diff in range(boat_size + 1)
for k_diff in range(boat_size + 1)
View gradient.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.