AFAIK

Valar Morghulis

In this post, we are interested in finding all integer and rational solutions for a general binary quadratic equation: \[ \begin{equation} ax^2 + bxy + cy^2 + dx + ey + f = 0, \label{eq:general} \end{equation} \] for any integer coefficients \(a, b, c, d, e, f\). The equation might degenerate; we only point it out when it does but do not solve it, as it's typically easier to solve a degenerate equation.

This post mainly serves as an entry point for a series of posts and also contains a little bit of the story behind the posts. That is why this post has index 0 in the title.

Read more »

In this post, we are interested in finding all integer solutions of the following equation: \[ \begin{equation} ax^2 + bxy + cy^2 = n. %\label{eq:ibqf} \end{equation} \] where \(acn \neq 0\), \(b^2 - 4ac \neq 0\). This equation can certainly be solved using methods from the generalized Pell equation, but here, we explore other methods.

Read more »

In this post, we are interested in finding all integer solutions of Pell equation \[ \begin{equation} x^2 - d y^2 = 1, \label{eq:pell} \tag{Pell Equation} \end{equation} \] and generalized Pell equation \[ \begin{equation} x^2 - d y^2 = n, \label{eq:generalized-pell} \tag{Generalized Pell Equation} \end{equation} \] for a non-square integer \(d > 0\) and \(n \neq 0\).

Read more »

In this post, we're interested in finding any or all rational solutions of the following equation: \[ ax^2 + by^2 + c = 0, \] or alternatively, all integer solutions to the Legendre equation: \[ \begin{equation} ax^2 + by^2 + cz^2 = 0, \label{eq:legendre} \tag{Legendre Equation} \end{equation} \] where \(abc \neq 0\).

Read more »

转眼间 2024 年已经过去了……隔了好久没写娱乐相关的文章了,随便写几个作为去年的年终总结得了……(然后震惊地发现我上次写游戏已经是四年前了……)

  • Return of the Obra Dinn
  • The Case of the Golden IdolThe Rise of the Golden Idol
  • Patrick's Parabox
  • COCOON
  • ANIMAL WELL

(可能有略微剧透,手动狗头)

Read more »

前几天和 hls bibi 了一下。hls 推荐了 这个视频 给我。我是以一个批判的角度看视频的,就像我之前 review paper 一样,先把屁股坐住了再来找论据,所以大部分观点都是 biased 的,可能就是在 nitpicking。

Read more »

The cost for Power Ups has changed since version 0.7, so this post is no longer applicable.

\(\newcommand{\eps}{\varepsilon} \newcommand{\R}{\mathbb{R}}\) Vampire Survivors is a game released in early access near the end of 2021. It received 110k recommendations in one month, which is pretty amazing given its minimal aesthetics and seemingly low production costs. I also played it a lot back then, but I won't talk about its gameplay here. Instead, this post discusses the (old) Power Up mechanism and some of the math behind it.

The Power Up mechanism in Vampire Survivors is similar to Kingdom Rush's Upgrades, where you spend the gold earned during gameplay to make permanent gains (e.g., increase move speed by x%). As per the notes in Fandom, the cost for a Power Up is defined as: \[ Price = \text{InitialPrice} \cdot (1 + \text{Bought}) \cdot \left(1 + \frac{\text{TotalBought}}{10} \right), \] where \(\text{InitialPrice}\) is the initial price of the Power Up, \(\text{Bought}\) is the number of purchased ranks for this Power Up, and \(\text{TotalBought}\) is the total number of purchased ranks among all Power Ups. What's interesting is that the order in which you buy Power Ups actually matters!

Intuitively, we should purchase expensive Power Ups first. For example, IGN recommends maxing out Power Ups with the highest initial costs first. However, this is not optimal. Suppose we have two Power Ups, A and B. A has 5 ranks with an initial price of 1, while B has only 1 rank with an initial price of 2. If we max out A first, the total price is: \[ 1 \times 1 + 1.1 \times 2 + 1.2 \times 3 + 1.3 \times 4 + 1.4 \times 5 + 1.5 \times 2 = 22, \] and if we max out B first, the total price is: \[ 1 \times 2 + 1.1 \times 1 + 1.2 \times 2 + 1.3 \times 3 + 1.4 \times 4 + 1.5 \times 5 = 22.5. \]

So, here is our central topic today:

What is the optimal order for buying all Power Ups?

Read more »

几个星期前,我和朋友们去了趟湾区的后花园 Lake Tahoe,这里就随便写点东西记录一下。由于时间比较短,我们只过了一个周末,所以显得这篇文章尤为流水帐 23333

9.14

由于早上要赶路,我们八点钟就起床了。熟悉我的人都知道,这个时间点对我特别早,然而这天我却因为还在倒时差,早早就起床了。中午在 Sacramento 吃的桂林米粉,Top Choice Restaurant,味道挺不错的,而且这价格真是太让人感动了,放在湾区怕是要翻个倍。

下午我们搞了个 kayak,六个人分成三组,我和胡老师一组。划之前我们又在开玩笑说会不会翻船。脸哥信心满满,这次绝对不会翻船。然而天公不作美,天气预报告诉我们下午的风不小。这次我们租的是 Tahoe 特色透明小船,因为 Tahoe 的湖水特别清澈,透明小船就会有一种悬浮的感觉。我不由想到当年的图形学大作业了,我写了一个 AMCMCPPM 算法(自适应马尔可夫链蒙特卡洛渐进式光子映射,特别适合用来装逼),里面还有一张 渲染图 ,就和我在 Tahoe 看到的一样。

透明 Kayak
Lake Tahoe (from Sand Harbor)

和我们同行的还有两个导游,估计是来保护我们的。而导游的 kayak 很特别,可以用脚踩着划,所以我们就看到导游一边刷手机,一边划 kayak,而我和胡老师死命划,划的手臂累死了,却只能望其项背。不过速度不重要,重要的是,我和胡老师友谊的小船,在不断进水!一个浪打过来,船头迎浪而上,浪过以后,船头重重打到水面上,激起的浪花落入船中,而我们还没有办法把水排出去。更要命的是,这还是个正反馈,已经进的水越多,船就越沉;船越沉,就越容易进水,再这样下去,我和胡老师就要上演泰坦尼克号了……我们试图在湖中泼一下水出去,但是看起来效果不大,最后我和胡老师一致决定:离目的地不远了,赶紧在船沉之前划到目的地,然后下船排水。可喜可贺,我和胡老师终于逃离了这艘 sinking boat……

返程下船的时候岸边浪很大,胡老师在前排我在后排,导游帮我们抓着 kayak 我们就可以下船了。在这里我犯了一个致命错误,初中物理书上经常提到的,为什么水比看上去的浅?我看着挺浅的,就自信一脚踏下去,直到没过了腰才后悔莫及,甚至一个浪冲过来,我的拖鞋都差点无了……

整体而言,这次 kayak 体验挺好的,风景也不错,但是问题在于周围没啥设施,我们走出来后脚底一堆沙子,但是周围没有一个水龙头可以冲一下脚,就很难受……

划了 kayak 后,我们就去吃饭了。由于我们也不期望 Incline Village 这边有啥好吃的餐厅,我们就在 Google Map 上随便看看了。环顾一圈,我们找到了一家 炸鸡店,评分高达 4.9,堪称是 Incline Village 评分最高的餐馆。于是我们就一致决定是它了。没想到的是,这家炸鸡店做的特别慢,而我们还准备去 Cave Rock 去看日落,就只好在车上吃了。

Cave Rock 那边不是很好停车,我们几个人先下车之后有人去停了车。Cave Rock 那里一堆大石头,坡度不小,手脚并用才好上去,幸亏这里石头很实,踩上去不会晃悠。由于就在湖边上,拍的日落还挺好看的。刚日落的时候云是灿烂的金黄色,太阳落下去后云变成了赤陶色,甚至有种不真实的模糊感。lzy 和 tjc 来的比较晚,想爬上去的时候已经比较黑了,担心安全就没上去了,特别是下山比上山还危险。

Cave Rock 上的晚霞
爬 Cave Rock

爬完 Cave Rock 后我们就去买了点东西,给明天的活动准备一下,然后租的 AirBnB 休息了。说起来这一段时间刚好 Incline Village 有山火,好像就在我们租的 AirBnB 旁边。经过 lzy 缜密分析查资料,最后决定风向应该是远离我们的方向。要是突然风向变了,睡到一半被烟薰起来就尴尬了。

9.15

胡老师起了个大早,开始给大家做早餐。昨天晚上胡老师机智地买了 bacon,这样就可以不用买油了,可以用 bacon 的油来煎鸡蛋。我也来大显身手,然后煎糊了 sausage……

今天的第一站是 Ed Z'berg Sugar Pine Point State Park。公园地上一堆松果,你说的我都懂,可是为啥松果这么大?胡老师大为震撼,决定捡一个松果给汤姐做礼物。胡老师又注意到这松果上有些粘液,还有种奇特的芬芳,然后意识到这就是传说中的松脂吗……而且这个公园叫做 Sugar Pine Point State Park,那想必这里的松树都是 Sugar Pine 咯,有没有勇士来尝尝是不是真的是甜的 2333

Sugar Pine 树上有一些小地衣

这个公园里还有一个网红景点,是一段废弃铁轨延伸进清澈的湖水里。说实话第一次看的时候感觉就这?但是拍了照之后再加几个滤镜修修图感觉还挺不错的……

铁轨,湖,与云

第二站是 Emerald Bay State Park。今天的风明显比昨天大,我在 Vikingsholm Trail Head 被风吹的不行了,但是这里的风景确实不错,从这里能看到 Fannette Island。理论上附近还有一个 Eagle Fall,到了之后实在让我大跌眼镜,就这???别说是 Fall 了,你说这是个 Creek 我都将信将疑……

Lake Tahoe (from Emerald Bay State Park)

然后我们就去了 Heavenly。这里有个大缆车,可以通往一个高处的观景台(Heaven?)。不得不说,站得高看得远,湖景能一览无余,虽然票价要 $75……但从另外一方面来说,高处不胜寒,我还穿了一件短袖,风还呜呜的吹,冻死我了。缆车的终点是一个游乐园,我们只玩了其中一个项目,就是一个可以自己控制速度的过山车。说是能自己控制速度,但是对我这种不高的人不太友好,我需要弯腰用力才能把速度加满,不然就只能慢慢游了。

Lake Tahoe (from Heavenly)

不知不觉已经到晚饭时间了。晚上我们吃的是 Edgewood Restaurant,一家 fine-dining 餐馆。这里环境挺好的,一个很大的落地窗可以看外面的湖景。说起来我一直在思考为啥湖面上有两种颜色,一种是正常的蓝色,一种是棕色,还成带状分布,最后得出结论:这带状分布的棕色是镜子反光出来的我们背后的墙上那一条棕色装饰带……

吃完饭后我们就跑路了,天黑了不好开夜路。路上我们正聊着天(@胡老师和 tjc),我突然发现外面的晚霞超好看,脸哥便拍下了这张晚霞照片,比昨天的还好看,梦幻的粉红色:

回家路上拍的晚霞
0%