Skip to content

Instantly share code, notes, and snippets.

View Caaz's full-sized avatar

Daniel Cavazos Caaz

View GitHub Profile
@Caaz
Caaz / Start.java
Created November 10, 2017 03:51
Slightly Simple Hangman
import java.util.Scanner;
public class Start {
public static void main(String[] args) {
Hangman game = new Hangman("Hello");
System.out.println("Welcome to Hangman. Make sure to guess letters.");
while (!game.isCompleted()) {
System.out.println(game);
game.getInput();
}
@Caaz
Caaz / compile-p8.pl
Created December 24, 2017 21:55
Compile pico-8 carts into one file!
#!/usr/bin/perl
use warnings;
use strict;
use v5.10;
no warnings 'experimental::smartmatch';
die("No argument provided for file\n") unless($ARGV[0]);
die("No file at $ARGV[0]\n") unless(-e $ARGV[0]);
unless($ARGV[1]) {
my $cart_name = $ARGV[0];
@Caaz
Caaz / polygon.lua
Created January 7, 2018 12:15
Rendering polygons in pico-8
-- require partials/class.lua
class.polygon = class{
new = function(this,args)
merge(this,{
points = {},
lines = {}
})
merge(this,args)
this:rasterize()
end,
@Caaz
Caaz / map.lua
Created January 8, 2018 00:42
Map class for pico-wars
-- require partials/class.lua
-- require picowars/tile.lua
-- require partials/binary.lua
local maps = {
-- require logs/picowars_map.p8l
}
class.map = class{
new = function(this)
merge(this, {
tick = 0,
@Caaz
Caaz / countvowels.js
Created January 26, 2018 20:55
You're all dumbasses
var answers = {
isk(arr) {
let vowels = 0;
for (e of arr) {
if (e.constructor === Array) vowels += answers.isk(e)
else {
let m = e.match(/[aeiou]/gi);
vowels += m === null ? 0 : m.length;
}
@Caaz
Caaz / main.js
Created January 30, 2018 23:24
Controller shenanigans
const HID = require('node-hid')
const Bitfield = require("bitfield")
const SimpleADB = require('simple-adb').SimpleADB;
require('log-timestamp')
const sadb = new SimpleADB();
const devices = HID.devices()
const device = new HID.HID(devices[0].path)
const names = ['zr','zl','r','l','x','a','b','y','null','null','record','home','cr','cl','plus','minus']
const keymap = {
@Caaz
Caaz / compile.log
Created February 5, 2018 06:09
All the files required by picowars
Sun Feb 4 22:06:55 2018 -- Compiling...
Requiring ichor.lua from games/picowars/picowars.p8
Requiring camera from games/picowars/picowars.p8
Requiring war.lua from games/picowars/picowars.p8
Requiring player from /home/caaz/.lexaloffle/pico-8/carts/games/picowars/war.lua
Requiring class.lua from /home/caaz/.lexaloffle/pico-8/carts/games/picowars/player.lua
Requiring world_ui from /home/caaz/.lexaloffle/pico-8/carts/games/picowars/player.lua
Requiring table/merge from /home/caaz/.lexaloffle/pico-8/carts/lib/world_ui.lua
Requiring map from /home/caaz/.lexaloffle/pico-8/carts/games/picowars/war.lua
@Caaz
Caaz / swipe
Created February 13, 2018 22:24
Swipe right every second
while sleep 1
do adb shell input swipe 50 400 1000 400
done
@Caaz
Caaz / dungeon.lua
Last active March 3, 2018 11:26
Dungeon generation code
init = function(this)
this.minimap = {}
this.tiles = {}
local limit = 32
for x = 1, limit do this.tiles[x] = {} end
local snap=function(point)return{flr(point[1]/2)*2+1,flr(point[2]/2)*2+1}end
local new_room = function()
local dim = snap({rnd(6)+3, rnd(6)+3})
dim[1]-=1 dim[2]-=1
@Caaz
Caaz / stringshenanigans.cpp
Created April 29, 2018 05:33
messing with vectors
#include <iostream>
#include <string>
#include <regex>
#include <vector>
#include <sstream>
using namespace std;
bool ci_compare (char a, char b) {return tolower(a)<tolower(b);}