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 java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
public class Node { | |
int start; | |
int end; | |
Node suffixlink; | |
HashMap<String,Node> children = new HashMap<>(); | |
public Node next; |
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
public boolean containsSuffix(String str) { | |
Node node = root; | |
while (true) { | |
if (str.isEmpty()) { | |
return node.children.isEmpty(); // return node.isleaf | |
} | |
node = node.children.get(String.valueOf(str.charAt(0))); | |
if (node == null) { | |
return false; | |
} |
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
# @e[limit=2] | |
tag @e[limit=2] add todo | |
tag @e[tag=todo,limit=1] add current | |
tag @e[tag=current] remove todo | |
execute as @e[tag=current] run say 1 | |
execute as @e[tag=current] run say 2 | |
tag @e[tag=current] remove current |
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
-- adrodoc55/setmultimap.lua | |
local pkg = {} | |
function pkg.put(multimap, key, value, hashfunction) | |
hashfunction = hashfunction or str | |
local set = multimap[key] or {} | |
local hash = hashfunction(value) | |
set[hash] = value | |
multimap[key] = set |
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
local pkg = {} | |
function pkg.give() | |
if spell.owner then | |
spell:execute('give %s golden_pickaxe 1 0 {hammer:true}') | |
end | |
end | |
function pkg.stop() | |
spell:execute('kill @e[type=wol:spell,tag=adrodoc.hammer]') |
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
require 'mickkay.wol.Spell' | |
tetris = {} | |
tetris.delay = 10 | |
tetris.origin = Vec3(453985, 80, -888253) | |
tetris.width = 10 | |
tetris.height = 20 | |
tetris.rotationCenter = Vec3(0,-1,0) | |
local upperCenter = tetris.origin + Vec3(tetris.width//2 + 1, tetris.height-1, 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
function EventQueue:clear() | |
while self:pop(0) do end | |
end |
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
-- adrodoc55/claiming.lua | |
require "mickkay.wol.Spell" | |
local setmultimap = require "adrodoc55.setmultimap" | |
local cities = require "mickkay.cities" | |
local datastore = require "mickkay.datastore" | |
local pkg = {} | |
local store |
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
-- gist.a532a79bc8ceb459a21f23e4a17e084c.scribble | |
if adrodoc55 == nil then | |
require "gist.5812f439642a1d4a9d89cdb75b38a13a.adrodoc55" | |
end | |
function scribble(eventType) | |
local q = Events.register(eventType) | |
for e in q.next do | |
print(str(e)) |
NewerOlder