Skip to content

Instantly share code, notes, and snippets.

View ParadoxV5's full-sized avatar
🎮

ParadoxV5

🎮
View GitHub Profile
@ParadoxV5
ParadoxV5 / Eudora.md
Last active October 3, 2024 18:58
Eudora Fast Dig 尤多拉速挖
@ParadoxV5
ParadoxV5 / 红龙贼学习笔记.md
Last active September 20, 2024 05:51
红龙贼学习笔记(未完待续)

(Should I compose an English edition as well?)

此番学习参考了[燁魔的教学][燁魔]。🙏

她早已像我这么强。🪦 (也是,我还给她介绍了向导学徒,说明她早已出师(不是四声)。)

无限火球、点燃、火妖、“水妖”(银樽)等哀绿法虽然自闭,但是不管过度再怎么顺滑,它们也依然有不低的门槛和技术天花板。 操作者要在面临烧绳的鸭梨下考虑牌序(比如“奥术脑洞”刷夜能在复制了太多法强后穿进疲劳紫砂),技术含量比♾️🚪、♾️🧊多多了。

@ParadoxV5
ParadoxV5 / Push–Relabel Maximum Flow.rb
Last active July 6, 2024 02:37
Ruby Discord Jurassic Challenge
# frozen_string_literal: true
# Goldberg–Tarjan Push–Relabel Algorithm
# with FIFO active set and BFS pre-labeling
# * https://www.adrian-haarbach.de/idp-graph-algorithms/implementation/maxflow-push-relabel/index_en.html
# * https://en.wikipedia.org/wiki/Push%E2%80%93relabel_maximum_flow_algorithm?oldid=1230043247
# variable names are in dummies’ terminologies
class PushRelabel
class Node
@ParadoxV5
ParadoxV5 / int2bytestr.rb
Created May 25, 2024 04:07
Pack an integer to a byte-sequence string. Discussed in https://discord.com/invite/ruby-518658712081268738 #general. I dedicate this to the Public Domain.
def int2bytestr(int, bytesize = int.size)
[
# Format to hex, left-pad with `0` (big-endian) for `bytesize * 2` nibbles
sprintf('%0*X', bytesize * 2, int)
].pack 'H*' # Pack string of hex chars to string of raw bytes
end
# Demo
print "actual\t"
p int2bytestr(0x4_20_69_de_ad_be_ef_13_37, 10)
# Marker module for “my library”
module MyError end
# Built-in exception class example
ZeroDivisionError.include MyError
puts begin
1 / 0
rescue MyError => e
e
end #=> divided by 0
@ParadoxV5
ParadoxV5 / Wireworld.rb
Last active February 4, 2024 03:41
Ruby Discord Valentine’s Challenge
# frozen_string_literal: true
class CellularAutomaton
def initialize(grid)
@grid = grid
# Back Buffer
@grid2 = grid.map(&:dup)
@rules = yield self
end
def self.load(file, ...) = new(file.each_line(chomp: true).map(&:chars), ...)
def answer1(n) = n.succ
def answer2(str) = str.upcase
def answer3(n) = (0..n).to_a
def answer4 = yield + 42
def answer5(a, b = 1) = a + b
def answer6(n) = n.positive? ? (n - 1) % 9 + 1 : n
def answer7(x) = x.succ
def answer8(n) = n.digits(2).sum
def answer9(s) = s.gsub 'u-g0t-me', 'yikes'
def answer10(x = false) = @data10 = x ? 0 : @data10 ? @data10 + 1 : 1
@ParadoxV5
ParadoxV5 / Symbolic Fibonacci
Created November 28, 2023 05:28
Fibonacci calculator implemented with only `\W`s (and without realizing `Range%` is a block-taking thing)
$* << [//=~'', /$/=~'$'] << () << ->() {
$*[~(/$$/=~'$$')][
( $*[~(/$/=~'$')] += (/$/=~'$') ) - (/$/=~'$')
] ||= (
$*[~(/$/=~'$')] -= (/$$/=~'$$')
$*[~(//=~'')][] + $*[ ~(/$$/=~'$$') ][ $*[~(/$/=~'$')] - (/$$/=~'$$') ]
)
}
# Test

The Hyrulean History as a Singlular Timeline

Preface

The Legend of Zelda games presented gorgeous fantasies of the Hyrulean universe. Regrettably, Nintendo has officially declared that the events of Ocarina of Time fork the timeline into three distinct branches, only one of which develops into the Switch hits. Severing the continuity of the series’s rich lore is poor news for me and other supporters of self-consistent causality.

Fortunately, as the developers abandon the parallel universes and focus on an age over a millennia after the world’s creation, there is enough consistency and timing between the stories to realign the different sequences to a single continuous chronology. The following is my take on the Hyrule history as a singular timeline.

BOARD = {
nil => %q[SCARY?!],
'🎃' => %q[BDEFGH ],
'👻' => %q[IJKLMN'],
'🍬' => %q[OPQTUV,],
'💀' => %q[WXZ.#$:]
}
row = BOARD[nil]
File.foreach 'input.txt', chomp: true do|line|