Skip to content

Instantly share code, notes, and snippets.

@zishun
zishun / solve_lights_out.py
Created October 17, 2019 12:36
Brute force solution of the game [Lights Out](https://en.wikipedia.org/wiki/Lights_Out_(game))
import numpy as np
import time
from tqdm import tqdm
def click2board(i, j, N):
board = np.zeros((N,N), dtype=int)
board[i,j] = 1
if i > 0: board[i-1,j] = 1
if i < N-1: board[i+1,j] = 1
# OpenMesh-Python Cheat Sheet
'''
documentation: https://openmesh-python.readthedocs.io/en/latest/
OpenMesh-Python official repository:
https://www.graphics.rwth-aachen.de:9000/OpenMesh/openmesh-python
C++ documentation:
https://www.openmesh.org/media/Documentations/OpenMesh-Doc-Latest/a04099.html
Installation:
* pip install openmesh # https://pypi.org/project/openmesh/
@zishun
zishun / eigen_matrix_io.cpp
Last active March 26, 2024 14:01
Eigen dense/sparse matrix binary file IO
#include <iostream>
#include <fstream>
#include <random>
#include <Eigen/Dense>
#include <Eigen/Sparse>
namespace Eigen {
// https://stackoverflow.com/a/25389481/11927397
template<class Matrix>