Skip to content

Instantly share code, notes, and snippets.

View the-bokya's full-sized avatar

Ayush Chaudhari the-bokya

View GitHub Profile
@the-bokya
the-bokya / conway.py
Last active June 19, 2024 19:09
A parallel implementation of Conway's Game of Life in Python for the terminal (it makes those cute gliders sometimes!).
import os
import random
import time
import copy
# import threading
class Game:
def __init__(self, n: int):
@the-bokya
the-bokya / bf.hs
Last active March 7, 2023 16:21
A Brainfuck interpreter in Haskell. (Note: It lacks the input ',' command). Pipe in the Brainfuck code through STDIN.
import Data.Char
-- Cmd is the tree containing the commands in sequence.
data Cmd = Cmd Char Cmd | Loop Cmd Cmd | Empty deriving Show
-- Brain is the main datatype that is processed throughout the program.
-- It has a strip of numbers with a pointer to point to the index on it
-- making it a Turing Machine. It also carries with it the output to be
-- piped out to standard output.
data Brain = Brain [Int] Int String deriving Show