Skip to content

Instantly share code, notes, and snippets.

@progheal
progheal / DiscordFriendRequest.md
Last active October 17, 2025 12:14
Things to note when sending me friend request on Discord

English Version

I've received enough friend request from total stranger without mutual server recently, so here are some things to note if you would like to send me one:

  1. Unless I know who you are, Friend Requests will be rejected after an unspecified amount of time.
  2. If you would like to let me know who you are, send me DM and explain why I should know you.
    • If you know me via some mutual friend (on or off Discord), you should definitely send me DM first.
    • In other words: just sending me friend request without DM is equal to nothing.
  3. If I can't see I have mutual server with you for whatever reason (for example, you really don't have mutual server with me):
  • The amount of time before I reject your Friend Request will be shorter.

In this document, "cycle" means North-West-South-East move once, and "loop" means the repeating pattern after some amount of cycles are run. "Loop length" the number of cycles needed to obtain the loop, and call a pattern "length X loop" meaning it will repeat the end state after every X cycles.

So, here's my basic item. Call it Q0.

.##.
#.O#
#..#
.##.
@progheal
progheal / 000Guestbook.md
Created November 30, 2023 08:03
留言板

開這裡當做一個暫時的留言板好了。如果沒有其他方法聯絡得到我但正好有 github 帳號的話可以在這裡留言。 我會不定時上來巡一下,所以不保證我什麼時候會看得到。

TODO: 弄個好一點不用登入 github 的接收訊息處


This is a temporary guestbook. If you have no other way of contacting me but happened to have a github account,

@progheal
progheal / tally.js
Created October 8, 2023 14:56
《西瓜遊戲得分裡的數學》(https://blog.cruciferslab.net/?p=1535) 的模擬程式
function randomFruit()
{
return Math.floor(Math.random() * 5);
}
const FruitInfo = [
{apple: 1/32, point: 3.09375}, // 櫻桃
{apple: 1/16, point: 5.1875}, // 草莓
{apple: 1/8, point: 7.375}, // 葡萄
@progheal
progheal / CubeFolding.md
Last active December 22, 2022 20:03
Advent of Code 2022 Day 22: Monkey Maps, cube folding algorithm

Let's start from our designated starting point, the "top left" of the first cube face, going right. This means we are going clockwise along the edge of the net.

We want to trace the edge and trying to match the "edge cells", which is represented by a cell, and its direction when we traversed them clockwisely. Using the sample as example, the first edge is (1,9,>). If the current edge does not match other edge, we simply push that into a stack.

We go along the edge, stopping every N times to determine which turn do we take on the net. This is done by going one step out and check myself and my left.

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
struct Op
{
int xm, xM, ym, yM, zm, zM, sw;
};
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <iterator>
#include <algorithm>
using namespace std;
@progheal
progheal / 2021_AprilFool_dragoncoin.txt
Last active April 2, 2021 21:05
龍窩 2021 魚人節挖幣 (?) 活動
為了讓 gist 的標題有點意義所以加的檔案
@progheal
progheal / factsqrt.cpp
Created January 10, 2021 13:59
Timc 2021 新年題 Q3
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <tuple>
using namespace std;
// switch the comment below to see log printed to stderr
//#define LOGERR(x) x
#define LOGERR(x)

Let's analyze all these digits. We classify the appearing position within the number it begins, with the rightmost being 1. For example, the 111 in 41118 is said to be at position 4, while the cross-number 777 between 72977 and 72978 is said to be at position 2. The input size is n.

000

Because 000 cannot cross number (no number starts with 0), the position of 000 is at least 3. For position p, the other digits of the number can be combined to count them; for example, numbers for n=5 and p=4 are 10000, 10001, 10002, ..., 90009, 100000; there are 100 - 10 + 1 = 91 of them.

It is easy to deduct that there's 10^{n-3}-10^{p-3}+1 ways to have 000 in position p. Adds up all of these for p from 3 to n, we have
![(n-2)\times10^{n-3}-\sum_{p=3}^n 10^{p-3}+(n-2)=(n-2)\times10^{n-3}-\underset{n-2}{\underbrace{111\dots1}}+(n-2)](http://latex.codecogs.com/gif.latex?%28n-2%29%5