Skip to content

Instantly share code, notes, and snippets.

@samorajp
samorajp / gradient.ipynb
Created October 2, 2015 19:43
linear regression
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@samorajp
samorajp / misjonarze.py
Created February 27, 2016 15:04
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,
other_side,
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)
# encoding: utf-8
import pygame
from pygame.draw import circle, line
from pygame.locals import *
import misjonarze
# Initialize the game engine
pygame.init()
# Constants
@samorajp
samorajp / template.txt
Last active October 22, 2020 20:08
download and import linalg
!wget -N https://raw.githubusercontent.com/anagorko/linalg/main/linalg.py
import linalg