Skip to content

Instantly share code, notes, and snippets.

View LucasWolschick's full-sized avatar
🏃‍♂️

Lucas W. LucasWolschick

🏃‍♂️
View GitHub Profile
@LucasWolschick
LucasWolschick / tictactoe.rs
Created October 11, 2020 18:43
Very ugly implementation of a tic tac toe game in Rust
use std::io::Write;
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
enum Tile {
X,
O,
Empty,
}
impl Tile {
@LucasWolschick
LucasWolschick / brainfuck.c
Created March 12, 2022 21:34
brainfuck interpreter written in C
// Lucas Wolschick (C) 2022
// You should probably not use this as this has not been tested
// Usage: brainfuck [file]
//
// Try it with this code (available at en.wikipedia.org/wiki/Brainfuck, not mine!)
// ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@LucasWolschick
LucasWolschick / lisp.py
Created June 8, 2024 19:21
Lisp but none of the fun parts
from dataclasses import dataclass
from typing import Literal
type LeftParen = Literal["("]
type RightParen = Literal[")"]
type Number = int
type Token = LeftParen | RightParen | NumberLiteral | Identifier | Def | Eof | If | StringLiteral | LogicLiteral
@dataclass
@LucasWolschick
LucasWolschick / turing.ts
Created July 29, 2026 02:09
Turing Machine implementation with example machines and parser
const EMPTY = " " as const;
const START = "<" as const;
type Cell = typeof EMPTY | typeof START | string;
type Direction = "L" | "R";
class Tape {
private symbols: Map<number, Cell>;
private position: number;
// artisanal, handcrafted code written by a human, not by a statistical model ;)
// solution to leetcode #67
// this approach is very flexible and can be adapted to solve any leetcode problem
"use strict"; // this not needed in typescript but im leaving it in
const EMPTY = " " as const;
const START = "<" as const;
type Cell = typeof EMPTY | typeof START | string;