This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |