Skip to content

Instantly share code, notes, and snippets.

@MasterEx
MasterEx / Readme.md
Created June 21, 2014 14:36
Drawing polygons and polylines in lua/love2d with rounded corners

This is a simple module that can be used to draw polygons or polylines with rounded corners in love2d. The polygons/polylines must consist only from 90/270 degrees corners.

I wanted this functionality to draw pacman like mazes.

Example from a random pacman game:

Pacman

How it works

@MasterEx
MasterEx / example.txt
Last active May 12, 2019 09:55
Print all the substrings of a string in Bash
$ ./substrings.bash '1234567890' 133
1234567890
$ ./substrings.bash '1234567890' 10
1234567890
$ ./substrings.bash '1234567890' 9
1234567890
123456789
234567890
$ ./substrings.bash '1234567890' 8
1234567890
@MasterEx
MasterEx / main.lua
Last active July 19, 2020 00:10
Comparison of drawing pacman character both in code and by using images.
local x = 20
-- image code
local images = {}
local image
local quad
local t = 0
-- gen code
local PI_QUARTER = math.pi/4
local TWO_PI = 2*math.pi
public class OutputStreamAdapter extends OutputStream implements Appendable, Closeable {
private OutputStream os;
private CheckedOutputStream cos;
private DeflaterOutputStream dos;
private Appendable appendable;
private PrintStream pos;
public OutputStreamAdapter(OutputStream os) {
setOutputStream(os);
@MasterEx
MasterEx / ArrayTraversal.java
Last active December 19, 2021 20:50
"Overflowing the stack for fun" code examples
public class RecursiveArrayTraversal {
public static void main(String[] args) {
int[] arr = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
for(int i=0; i< arr.length; i++) {
System.out.println(i);
}
}
}