Skip to content

Instantly share code, notes, and snippets.

View ismaili-ziad's full-sized avatar

Ziad ISMAILI ALAOUI ismaili-ziad

  • Liverpool, United Kingdom
View GitHub Profile
Main = try set_counter then (count!; (decrement; Relax!; Clean!)!; Final)
Relax = root1; try no_deg else ((unmarked_edge; try {unvisited, reduce}; finish)!; unroot1)
Clean = root2; unmark_edge!; unroot2
Final = (root1; (unmarked_edge; if reduce then set_flag; finish)!; unroot1)!;
if flag then fail; delete_counter; no_deg_inv!
no_deg(x: list)
[
(n1(R), x #blue)
|
Main = (init; DFS!; try unroot else break)!; Check
DFS = try next_edge then (try {move, ignore} else (set_flag; break))
else (try loop; try back else break)
Check = if flag then fail
init(x: list)
[
(1, x #grey)
|
]
@ismaili-ziad
ismaili-ziad / find_the_string.cpp
Created April 14, 2024 17:03
find_the_string.cpp
#include <iostream>
#include <random>
#include <ctime>
#include <string>
using namespace std;
int main(void){
srand(time(NULL));
string goal = "MAJA", current;
@ismaili-ziad
ismaili-ziad / 2-colouring.gp2
Last active November 5, 2024 17:55
ICGT 2024: 2-colouring
Main = try init then (DFS!; Check)
DFS = FORWARD!; try back else break
FORWARD = next_edge; try {colour_red, colour_blue, blue_red, red_blue} else (unroot; break)
Check = try unroot else fail
init(x: list)
[
(n1, x #grey)
|
]
@ismaili-ziad
ismaili-ziad / is-connected.gp2
Created March 5, 2024 21:50
ICGT 2024: is-connected
Main = try init then (DFS!; Check)
DFS = (next; {move, ignore})!; try back else break
Check = if match then fail
init(x: list)
[
(n1, x #grey)
|
]
=>
@ismaili-ziad
ismaili-ziad / gp2c
Last active June 3, 2024 11:28
/usr/bin/gp2c
#!/bin/bash
install_dir="/opt/local/gp2c"
flags=""
code=false
output=false
while getopts ":co" opt; do
case $opt in