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
#include <cstdio> | |
#include <cmath> | |
#include <string> | |
#include "raylib.h" | |
#include "waterpool.hpp" | |
const int WIDTH = 160; | |
const int HEIGHT = 160; | |
using PoolType = Sapphire::WaterPool<WIDTH, HEIGHT>; |
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
#!/bin/bash | |
Fail() | |
{ | |
echo "vcvbuild.sh: $1" | |
exit 1 | |
} | |
CloneVcv() | |
{ |
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
#!/bin/bash | |
#------------------------------------------------------------------------------- | |
# | |
# glitchfix.sh - Don Cross <[email protected]> | |
# | |
# Script that builds two copies of VCV Rack 2.2.0, | |
# one from original source code, another with the | |
# following fix for a glitching issue when sending | |
# output audio to PulseAudio on Linux: | |
# |
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 math | |
import numpy | |
def randomvector(n): | |
components = [numpy.random.normal() for i in range(n)] | |
r = math.sqrt(sum(x*x for x in components)) | |
v = [x/r for x in components] | |
return v |
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
function abs(x) { | |
return Math.abs(v(x)); | |
} |
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
function v(x) { | |
if (typeof x !== 'number') { | |
console.trace(); | |
throw `Not a numeric type: ${x}`; | |
} | |
if (isNaN(x)) { | |
console.trace(); | |
throw 'NAN result'; | |
} |
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
#include <stdio.h> | |
#include <math.h> | |
double Distance(double x, double y) | |
{ | |
/* Intentional bug for illustration... */ | |
return sqrt(-1.0); | |
} | |
int main() |
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
function Polar(x, y) { | |
return { | |
angle: Math.atan2(y, x), | |
radius: Math.sqrt(x*x + y*y) | |
}; | |
} |
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
function UnitTest() { | |
const polar = Polar(3.0, 4.0); | |
const expected_distance = 5.0; | |
const diff = polar.distance - expected_distance; | |
if (Math.abs(diff) > 1.0e-12) { | |
console.error('ERROR: Excessive distance error: ', diff); | |
return 1; | |
} | |
console.log('PASS'); | |
return 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
int main() | |
{ | |
/*... blah blah blah ...*/ | |
if (error1) | |
goto handle_error; /* YUCK! */ | |
if (error2) | |
{ | |
handle_error: |
NewerOlder