Skip to content

Instantly share code, notes, and snippets.

View Average-user's full-sized avatar

Lucas Polymeris Average-user

  • Concepción, Chile
View GitHub Profile
@Average-user
Average-user / chess960.pl
Created December 28, 2017 22:02
Gnereator of Fischer Random Chess positions
% Using SWI-Prolog 7.2.3
% see https://en.wikipedia.org/wiki/Chess960 to understant what is this about.
:- use_module(library(random)).
even(N) :- 0 is N mod 2.
odd(N) :- \+even(N).
index_of(Xs, X, N) :- nth0(N, Xs, X).
@Average-user
Average-user / FreeTrees.hs
Last active April 21, 2020 16:22
Implementation of the WROM algorithm for Constant Time generation of Free Trees
{-# LANGUAGE BangPatterns #-}
import qualified Data.Vector as V
import System.CPUTime
import System.Environment
import Text.Printf
{- Implementation of the WROM algorithm for finding all
free trees of a given order. The algorithm is explained
here:
@Average-user
Average-user / fssp.lua
Last active June 17, 2024 05:59
Search to prove the nonexistence of a 4-states minimal time solution to the Firing Squad Synchronization Problem.
-- Computer search to prove the nonexistence of minimal time solutions
-- to the FSSP with 4-(non-boundary)states.
-- States *,g,s,f,h... are represented by 0,1,2,3,4... respectively.
-- Hosted at: https://gist.github.com/Average-user/4241ca84777ae6ed38326710d8b47da4
function initial_squad(n)
local squad = {}
squad[1],squad[2],squad[n+2] = "0","1","0"
for i = 3,n+1 do squad[i] = "2" end
return squad