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
'A gravity simulation of the solar system written in QuickBASIC | |
'Similar to something I wrote way back when I was still in school | |
'Units are km, kg and s | |
'Type declarations | |
TYPE vector | |
x AS DOUBLE | |
y AS DOUBLE | |
z AS DOUBLE | |
END TYPE |
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
Array.prototype.equals = function (that) { | |
if (!Array.isArray(that)) { | |
return false | |
} | |
if (this.length !== that.length) { | |
return false | |
} | |
for (var i = 0; i < this.length; i++) { | |
if (this[i] !== that[i]) { | |
return false |
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
# A Brainfuck interpreter | |
from sys import argv, stdin, stdout | |
with open(argv[1], "r") as file: | |
# preparation | |
code = [] # the code without comments | |
codepointer = 0 | |
data = 65536 * [0] | |
datapointer = 0 |
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
from threading import Thread | |
from time import time | |
W = 1 # white | |
E = 0 # empty | |
B = -1 # black | |
# Tuples of two integers are used for coordinates. The first integer is rank, | |
# the second integer is file. Offsets are changes in coordinates as a result of | |
# moves. The following offsets describe rook-like and queen-like motion. |
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
from collections import deque | |
# This is a demonstration of the recursive descent algorithm used to implement | |
# interpreters for a programming languages. As an example, Tiny BASIC is | |
# implemented here but of course the same technique can also be used to | |
# implement other languages as well. | |
# | |
# https://en.wikipedia.org/wiki/Tiny_BASIC | |
# |
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
import pygame | |
# units are kg, km and s | |
class Vector: | |
def __init__(self, x, y, z): | |
self.x = x | |
self.y = y |