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
/* | |
Barcode Generator (EAN-13) by @denkspuren, 2014-08-27, 14:22 | |
Minor update for Processing 3, 2015-11-19, 00:44 | |
New BSD License: http://opensource.org/licenses/BSD-3-Clause | |
http://en.wikipedia.org/wiki/International_Article_Number_(EAN) | |
http://de.wikipedia.org/wiki/European_Article_Number | |
Use: Press number keys to input a sequence of digits or use | |
right/left arrow for navigation. |
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
/* Game 2048 by @denkspuren, 2014-09-11, 11:47 | |
New BSD License: http://opensource.org/licenses/BSD-3-Clause | |
This is an implementation of 2048 without animation effects. | |
Use arrow keys (left, right, up and down) to move tiles on the | |
grid. Game ends if the tiles cannot be moved anymore. | |
For the game and its history see e.g. Wikipedia: | |
http://en.wikipedia.org/wiki/2048_(video_game) |
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
// http://www.thm.de/site/corporate-design/hausfarben.html | |
// http://www.farbtabelle.at/farben-umrechnen/ | |
color THMGreen = color(128, 186, 36); | |
color THMGrey = color(74, 92, 102); | |
color THMRed = color(184, 0, 64); | |
float x, y; | |
int time; | |
int count = 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
// https://de.wikipedia.org/wiki/Rasterung_von_Kreisen#Methode_von_Horn | |
void drawCircle(int xPos, int yPos, int r) { | |
int d = -r; | |
int x = r; | |
int y = 0; | |
while (y <= x) { | |
point(xPos+x,yPos+y); // might be executed in parallel | |
point(xPos-x,yPos+y); | |
point(xPos+x,yPos-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
// textFont(createDefaultFont(12)); | |
println(millis()); | |
text("Hello World!",10,15); | |
println(millis()); | |
text("Hello again!",10,35); | |
println(millis()); | |
/* | |
On my console the output is: |
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
/* Stopwatch by @denkspuren | |
Start and Stop by pressing space-bar. | |
Program requires some startup time to load fonts | |
used by text(). | |
*/ | |
// http://www.thm.de/site/corporate-design/hausfarben.html | |
// http://www.farbtabelle.at/farben-umrechnen/ |
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
class Position { | |
int x; | |
int y; | |
Position(int x, int y) { // new Position(3,0); | |
this.x = x; | |
this.y = y; | |
} | |
void display(int radius) { | |
ellipse(x,y,2*radius,2*radius); | |
} |
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
% Implementation of Delimited Continuations in Consize, @denkspuren 2014-11-06 | |
% The words `scan` and `scanWithDefault` are helpers to built implementations | |
% for `call/dc` and `shift` by means of `call/cc`. | |
% Note: Word `\` is not treated in a special manner. It is an artefact | |
% of call/cc. With delimited continuations only, the backslash must be | |
% superseeded by an equivalent convention such as `\ <word> \`. Here, | |
% the backslash initiates and marks the end of a sequences of words | |
% pushed on the datastack without further ado. |
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 simple parser for parentheses implemented with delimited continuations | |
% using Consize, @denkspuren 2014-11-12 (Update) | |
% | |
% The implementation demonstrates parsing of brackets with delimited | |
% continuations. Since parentheses are already used in Consize, | |
% left and right parentheses are written as `((` and `))`, respectively. | |
% | |
% Take a program such as: `(( @A (( @B (( @C )) @D (( @E )) @F )) @G ))`; | |
% `@A `up to `@G` denote arbitrary code without any parentheses. As soon as | |
% word `((` is processed, `shift` starts looking for left and right |
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
color THMGreen = color(128,186,36); | |
color THMGrey = color(74,92,102); | |
final float R = 10; // `final` declares R as a constant | |
class XSlider { | |
float x_min, x_max; // Slider range to capture mouse | |
float y_min, y_max; // Slider range to capture mouse | |
float x, y; // Position of slider | |
OlderNewer