Skip to content

Instantly share code, notes, and snippets.

View Tachytaenius's full-sized avatar

Tachytaenius Tachytaenius

  • London
View GitHub Profile
@Tachytaenius
Tachytaenius / Final Ur.py
Created September 16, 2022 17:12
The Royal Game of Ur in Python using Ncurses
# PyUr — copyleft 2017 — is by
# Henry "wolfboyft" Fleminger Thomson, and
# licensed under the GNU GPL 3.
# Tested with Python 3.5
from random import randint
import curses
white = "White" # Constant
black = "Black" # Constant
@Tachytaenius
Tachytaenius / main.lua
Created January 7, 2020 17:26
Get rounding mode in LuaJIT
local ffi = require("ffi")
ffi.cdef("double nextafter(double from, double to);")
local small = ffi.C.nextafter(0, 1)
local modes = {
nearest_toEven = {2, 2, -2, -2},
nearest_truncate = {2, 3, -2, -3},
truncate = {1, 2, -1, -2},
ceiling = {2, 3, -1, -2},
@Tachytaenius
Tachytaenius / main.lua
Created January 5, 2019 13:46
reeeeeeeeeeeeeeeeeeee
love.graphics.setDefaultFilter("nearest", "nearest", 0)
love.graphics.setLineStyle("rough")
math = require("lib.mathsies") -- my maths lib
local assets = require("assets") --[=[
-- it's a table of tables, an example being:
shaders = {
depth = {load = function(self) self.value = love.graphics.newShader("assets/shaders/depth.glsl") end}
}
]=]
local constants = require("constants") -- a table of categories, containing values
# import pygame
import random
def get_moves(player, opponent, speed):
if speed == 0: # No move that can be made will have any effect, so why allow any?
return []
valids = []
# Get a piece.