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
let rec ackermann n p = | |
if n = 0 then p + 1 | |
else if p = 0 then ackermann (n - 1) 1 | |
else ackermann (n - 1) (ackermann n (p - 1)) |
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
local function subsets(e) | |
local n = #e | |
local sub = {} | |
for i = 1, math.pow(2, n + 1) do | |
local set = {} | |
for k = 1, n do | |
if ((i >> k) & 1) == 1 then set[#set + 1] = e[k] end | |
end |
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
--- Hex to RGB function. We assume the hex color has been given following the standard #RRGGBB | |
-- @param string sHex: hex color format given in a string | |
-- @return table color: a color table following Garry's Mod way to handle color tables | |
local function hexToRGB(sHex) | |
return { | |
r = tonumber("0x" .. string.sub(sHex, 1, 2)), | |
g = tonumber("0x" .. string.sub(sHex, 2, 3)), | |
b = tonumber("0x" .. string.sub(sHex, 4, 6)), | |
a = 255 | |
} |
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
; Generated by Brainfuck, a brainfuck compiler written in OCaml | |
; @author Gabriel Santamaria <gaby.santamaria@outlook.fr> | |
; During the process, EDX will carry the cell address | |
; System calls macros | |
; write to ebx | |
%define SYS_WRITE 4 | |
; read from ebx | |
%define SYS_READ 3 |
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
; Generated by Brainfuck, a brainfuck compiler written in OCaml | |
; @author Gabriel Santamaria <gaby.santamaria@outlook.fr> | |
; During the process, EDX will carry the cell address | |
; System calls macros | |
; write to ebx | |
%define SYS_WRITE 4 | |
; read from ebx | |
%define SYS_READ 3 |
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
; Generated by Brainfuck, a brainfuck compiler written in OCaml | |
; @author Gabriel Santamaria <gaby.santamaria@outlook.fr> | |
; During the process, EDX will carry the cell address | |
; System calls macros | |
; write to ebx | |
%define SYS_WRITE 4 | |
; read from ebx | |
%define SYS_READ 3 |
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
; Generated by Brainfuck, a brainfuck compiler written in OCaml | |
; @author Gabriel Santamaria <gaby.santamaria@outlook.fr> | |
; During the process, EDX will carry the cell address | |
; System calls macros | |
; write to ebx | |
%define SYS_WRITE 4 | |
; read from ebx | |
%define SYS_READ 3 |
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
--- Loads all materials in a path | |
-- @param string path: path to analyse | |
-- @return table: a table containing every materials depending on | |
local function loadMaterials(path) | |
local files, directory = file.Find(path .. '*', 'GAME') | |
local materials = {} | |
for _, dir in pairs(directory) do -- launch the function in the other directories | |
table.Merge(materials, loadMaterials(path .. dir .. '/')) | |
end |
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
-- Adding files to client side | |
local function load_client_file(file) | |
AddCSLuaFile(file) | |
if CLIENT then | |
include(file) | |
end | |
end | |
-- Adding files to server side | |
local function load_server_file(file) |
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
let pi = 4.0 *. atan 1.0 | |
(* | |
function approx | |
Approximate the alpha value | |
(dm 2) | |
*) | |
let approx max = | |
let counter = ref 1 in | |
let result = ref (pi /. 3.0) in |