Thursday, 10 December 2020

Classic Tetris World Championship and the evolution of competitive gaming

CTWC 2020 Group C final, Dog vs. Koryan G3.

Classic Tetris World Championship (CTWC) refers to the tournament on NES Tetris that has been flourishing in the past 10 years. Unlike modern games like Tetris Battle and Puyopuyo Tetris, the rules for NES Tetris is quite different. That's because new Tetris games must follow a given set of guidelines in order to get the trademark. 

But before that we had the Grandmaster series that used the Akira rotation system (ARS) or Sega rotation system (SRS). Even more primitively there was the Nintendo rotation system (NRS) for NES Tetris, where most modern mechanics like lock delay and wall kick did not exist. 

*For more about NES Tetris and CTWC this is a very nice introduction video.

So what's fun about this ancient system of tetris that is hard to deal with, and even theoretically not sustainable forever?

It turned the game into a really good candidate of extreme solo e-sport via score attack.

The brutalness of the classic rules ensures players to adopt already special techniques to start with, either the delayed auto shift(DAS) or hypertapping. The absence of lock delay means that the reaction time will be extremely limited. Together with the lack of hold pieces and "7 bag" pseudo randomness that requires a balance between aggressiveness and sustainability, which further boosts the difficulty of making the right decisions. The lack of wall kick and modern spins makes planning harder, but the game is a lot more accessible to general public -- you can place the pieces in a certain position if and only if you can do that with reality physics. NES Tetris, the one with the most simple rules, is simply the easiest to understand.

Extreme input requirements, balance between strategies and high accessibility combines into a potent game for extreme e-sports: unlike FPS or other multiplayer games, these are stages for soloist to show what happens when you push the game to its extreme, to the boundary between software restriction and hardware restriction. 

CTWC has been held since 2010, but it had very little attraction until recent years when memes were grown out of nowhere [boom tetris for Jeff] and a great community is eventually built. 

Throughout the years, we have observed a steady growth of the average skill level among the players.

In early years, players may start from as low as level 9, and level 19 gameplay was treated as a premium. Maxing out a game was extremely rare (in 2010 Harry was given the automatic spot just because he had a max out -- not even in a given set of time but in his gameplay history). Then in the years after the choices were usually between level 15 and 18.

[Note: simply speaking level 15, 18 and 19 are the three fastest feasibly playable speed in NES tetris. One may choose to start from higher level to gain higher score. Starting from level 18, a change to level 19 occurs at line 130, which is known as *the* transition. There is another transition to "kill screen speed" at level 29 or 230 lines from level 18. Level 29 speed were thought impossible to play for no more than a few pieces, but this has changed in recent years.]

Starting from the reign of Jonas however, flexing in level 19 had became the standard among the upper seeds. Players are expected to reach the kill screen and score above 800k regularly. 

More recently with the bloom of hypertappers, reaching the kill screen is nothing special anymore. We are not just observing players at "maxout pace" before transition, but they hold on and actually maxout occasionally. 

Among the hypertappers Joseph (@JdMfX_) is definitely one of the best. His hypertapping skills allowed him to play extremely consistently at level 19 and actually made level 29 gameplay possible. He can casually reach level 30 (10 lines into kill screen) and all the way up to level 35[]. 

He outflexed Jonas in 2018 and had a great match against Greentea in 2019.

Then in 2020...he was knocked down in the quarterfinal.

So what happened? Well, the top 8 this year is completely composed of players that are almost as good as him. His match with Huff isn't exactly the best from him, and together with same bad luck he was out. 

CTWC 2020 is entirely different from CTWC 2019. Not only that Joseph was knocked down, but all the veterans and even players ranked up high in the 2019 tourneys were taken down in early stages like Jeff (he still got a lot of booms and neck and neck commentaries though), Jonas, Svavar and Koryan. They were just taken down by players out of nowhere (that is, unless you are a close follower of the monthly tournament too).

Among these the battle between Koryan and champion Dog is the absolute must-watch. It ended up as a 3-0 sweep but the stats are just crazy. 5.9 maxouts (one 989k) and 4 1.1mils; 5.9 kill screens (one 229 lines) and 4 234+ lines (and one level 30). 1.1 mils and playing into level 29 is simply unimaginable in the past, yet it happened in real matches this year. Even more thrilling is that the last two games ended up with a score difference of about 1500 and 400 respectively. Had Koryan optimize even the slightest he could have won one or two games -- this is how close the match was. 

There are a few reasons behind this great shift in competitiveness, but they boil down to the fact that the community grew big enough to produce enough hypertappers that flooded the tournament.

CTWC gained more attraction since 2016-18 and that had paid off in recent years. A big portion of new players said that they started playing NES tetris because they watched 2016-19 CTWC. It is difficult getting people to play NES, so this is a big step forward.

They are also successful in running the online community. There are now classic tetris monthly (CTM) and other streamed tournaments. They collaborated with tetris effect which ended up with a classic tetris mode. They are getting more sponsors every year and this year they were even sponsored by Xbox. These are all signs of a flourishing community.

The final kick is of course the pandemic, which forces everybody to watch streams at home. It also forced the tournament to be held online. Being online means more were allowed into the tourneys, and more actually joined because they do not need to reach the venue physically. 

It is very important to have new players, because they promote more advanced idea. Instead of introducing new ideas, they adopt the frontline techniques and put that into mainstream among the community. Old players tend to stick with the way they played (for example Harry tend to have right well instead of left well even in competitive scenes in the past), but this isn't a problem for new players. Between DAS and hypertapping the latter is clearly more potent, so they simply start with hypertapping. 

The wave of new players comes with a side effect: the new players are significantly younger. The original player base is for sure, those who lived the NES era who are rather aged (in the perspective of gamers) in 2020. New comers are in general younger, but for competitive games this is even more extreme because reaction speed, concentration and bursting power all peaked when one is of the age of adolescents. Among CTWC top 8 the ages are 13, 14, 15, 16, 18, 18, 19 and 23 respectively, and it's quite unimaginable that players of such age are so much into a NES game.

Average age of top players decreases as the game become more competitive is nothing new after all. Just think about the top players in Osu, from 2008 where Cyclone was #1 and Alace was easily #30, to Cookiezi and Whitewolf in 2014, then to Whitecat plus many more in 2020. It becomes clear that they can really play the best when they are high school students. Similar scenarios are also observed in mainstream e-sports, although the peak varies with game genres. 

From the perspective of a long term follower (kind of), I have a mixed feeling when the community is heavily flooded with new players. On one hand they come with fleshing techniques and marvelous gameplays, but on the other hand we lose our connection with all the old players that we used to watch. 

But one thing is here for sure, CTWC 2021 next year is again what I will be looking forward to.

Saturday, 28 November 2020

Thoughts on Simon Marais 2020

Simon Marais 2020 was held on October 10, which is long ago. Due to many coincidences I and my affiliated school missed the chance to take part in the competition. At the same time I didn't have the chance to review the questions until now, so this is a very brief and irresponsible review on the exam this year.

A1: closed curve and stupid pigeonhole. 

A2: clear once you figure out how the piling interacts each other, especially when $k \mid n$ or not.

A3: nicely formulated question, although the solution reduces drastically to a bound instead of some fancy sets. The beauty of the solution lies on fact that this sum can be optimized greedily. Locally this is simply year 1 differentiation, and you will reckon that a specific geometric series will do the job.

A4: yeah it sounds fancy and intimidating, but someone may as well brute force all the way with coordinate geometry techniques. I do not see that to be more difficult than IMO-level questions that can also be defeated using co-geom brute force techniques.

B1: this is more like assignment question...not even interested to do that. Question of such depth should not even appear in these contests.

B2: oh unit fractions. This is also a nicely written question. The solution lies on the fact that you can order arrangements in $S_k$ such that raising the sum means a descent in order, which means that it does not go forever.

B3: this is the kind of question that I do not like, where you either know one trick that you easily solves the question, or you have no chance at all. We have had enough cat and mouse questions.

B4: Again, possible (a) and impossible (b).

We see that the difficulty has been pretty consistent in the past years, but we have yet to observe more abstractly formulated questions as in the Putnam exam. Questions that can be formulated rather easily, but the solution requires further thoughts. Again I strongly recommend the removal of Q1, and extend the exam into 6 questions with a more approachable difficulty ladder.

Oh well, I have had a nice afternoon solving these problems.

Tuesday, 17 November 2020





Wednesday, 4 November 2020

On the day of the 2020 US Election

 Result as of 6:07 ET.

It is now 11PM ET. Trump is looking good towards his second term, and regardless of that, the turnouts are clearly in favor of him relative to the mainstream media polls.

The question is, where is the error coming from?

I write lots of things on my blog, including politics. However in this article I really wanted to look into the statistical aspect of the problem, instead of who is more correct politically or is more capable of making America great again. This article is not meant to be extensive -- I am sure there are more statisticians or data scientists who are more capable of giving precise figures than I do. This is a record of my own observation. 

The traditional polls

In traditional statistics there are two stages in the process -- you first collect the data, then you do the inference.

When collecting the data there are two roles of course, the data collector and the samples.

On the data collector side things could be biased based on how the poll is done. These includes designing leading questions, or hinting the presupposition during the poll. While I do not have clear evidence for these -- well I did not look into the polls -- we have another potential sampling error here. That is, to sample from an unrepresentative pool.

There are a few categories where polls may look into. They either take samples from adults, registered voters or likely voters. Likely voters of course have a (much) higher chance of voting hence are more influential. A number of mainstream media polls focused on adults of registered voters only, and that seemed to be dems biased -- or maybe because they know that collecting data in this way could be biased in the favorable way so that they decided to take such method?

Responses from the crowd certainly heavily affect the outcome. First the weighing might shift from what happened in 2016 or even 2018, especially given the volatile political environment right now. Even assuming that to be constant, the big problem comes from the 2020 version of the Bradley effect -- how many voters are the so-called shy-Trump-voters who are not willing to express their opinion in the polls? People are skeptical about that, while big data and early results say otherwise. Bradley effect is clearly taking in place.

Now we look into the inference part. If we believe that the poll makers will follow the moral of statistical inference (which is a bold statement to make from what's been observed), then what could go wrong?

It's mainly about the margin of error [] -- when you give a confidence interval on the lead instead of of the poll percentage, the margin of error is doubled. That's because whatever that does not go to one party -- let's assume that the liberal party...or Kayne West are negligible -- goes to the other, creating a doubled difference. 

Alternative methods

There are a few polls who tried new methods of investigating shy voters. Trafalgar group adopted a mixed method [] in order to prevent the "social desirability gap". Democracy Institute tries to figure out the true preferences of the voters by asking extra questions like whether or not they think Trump will win, or who they think their neighbors would vote for. Although Project538 apparently does not like the method, but traditional methods are off as far as we observed. That may as well open a whole new area on studying how to obtain the true data when interviewees intentionally hides their true preferences. 

Of course there are models too. These models in nature aimed to figure out the willingness of people voting for particular candidates without really making a poll. These include the famous Primary model []. Others include a delayed correlation on media noise and so on. Some of these are also digitalized and measured on online platforms. 

Interestingly these are in general more favorable towards Trump -- some even gave predictions that are too good to be true. For example the Primary model predicted 362 -- while 300-plus isn't impossible, anything above 320 seems very unlikely. The thing is that the electoral college is not a smooth scale. Not only that the electoral votes jump according to the votes assigned to the states, it's also because states beyond 320 are all deep blue. The chance to flip any of them would be exponentially harder than the swing states. While the models are designed to reflect who will win, they may not extrapolate to landslide victories.

Models that are not done state-wise is certainly having similar problems. They failed to distinguish what happened in different states, and that could produce a huge difference when it comes to votes predictions.

One final thought

The unusually high voting rate is special for this election. Given the same poll result, the outcome with a lower voting rate will certainly be different with the outcome with a high voting rate. That is because the group of people on the edge of going or not going to vote, is also not scaled smoothly. 

This is hugely different from elections in Hong Kong, where we may comfortably assume that pro-government voters are fully utilized regardless of the overall willingness to vote. Thus any extra votes will be heavily biased to the pro-democracy side. 

Such assumption is false for the US election, because the voter composition of both parties are highly sophisticated and dynamic. We can easily give numerous reason on why the extra votes would be biased on one party or the other. 

For example, Biden supporters may say that extra votes are more likely for the dems. That's because we are observing a historical high on absentee ballots, which contains surely a lot more dem votes. 

On the other hand Trump supporters are justified to believe that the extra votes are in favour of the reps: the rally showed that Trump supporters are more active and more motivated to vote. One also raised interesting observations that covid which triggered distant learning, which reduced peer pressure from college friends who are in general leaning to the dems.

If we keep going deeper, how does the the variation depends on the default stance of the counties (or, as shown on the polls)? Or variation against county population, income, age distribution and so on? 

No matter what the answer is, we will learn much from exit polls of the current election. Together with all the new polling methods and models, there are too much for us to investigate, scientifically.

6:00 AM ET 4/11/2020 (yes, 7 hours after I started writing this, because the live feeds are overwhelmingly interesting to watch)

*At the moment WI, NV and AZ are in extremely close match. Oh this election is so interesting...

Sunday, 1 November 2020

01/11/2020: 秋番簡評



雖然本季作品數異常地高,但卻沒有發生紫羅蘭VS國家隊VS PPTP這種神仙打架的局面。本季的巨無霸當屬地城和魔劣兩部都是成名已久兼為續作,粉絲自然不會吵起來。在地城和魔劣以下的實力派亦有一大堆,每部都有自己獨特的賣點,大家專心看番也不用吵誰才是本季霸權。以下就由我來推介幾部本季有趣的番,順便說一下看了兩三集後的感想。


催眠麥克風 3/12集 7.5/10






全員惡玉 4/12集 7/10





總之就是很可愛 4/12集 8.5/10分






憂國的莫里亞蒂 4/12集 7.8/10


比照套路,主角當然要是高富帥,身邊再帶一兩個助手(華生),男女不拘。女的話必然是女主然後走戀愛路線,比如京都寺町三條商店街的福爾摩斯。(題外話,這部作品的手遊根本就是Candy crush,而且吃電吃的不行……)

然後要選一個時代的話果然還是1900年代作為世界中心的倫敦最好。處於歐洲文明黃金時代的世界中心可以滿足任何價值衝突的背景,比如封建與資本、法治和人治……像大逆轉裁判甚至是Princess Principal那樣半架空兼蒸汽龐克的動畫都以那個時代的倫敦為參照背景。




要在前幾集就斷定動畫劇情好壞很難,不過這部番的分鏡與特效處理跟全員惡玉一樣有特別下功夫,OP畠中祐的Dying Wish也是我喜歡的半古典歌劇風,而且主角還是有點病態的帥哥。光是這樣就值得追下去了吧?

成神之日 4/12集 8/10分

麻枝准終於把注意力從護士小姐姐那邊拉回來了。這次是他收下大家對他Charlotte的指教後第一部大作,是反省還是報復,尚未可知。說起來Charlotte也是Angel Beats後的報復……



不得不說,麻枝准在輕鬆搞笑方面真的沒讓人失望過。棒球那不存在的第四好球、拉麵的味精層次都讓人笑個不停,只是麻雀新役種的話我笑完頭還會開始痛起來。這種一集一個主題的日常效果真的很好,但別忘記Angel Beats與Charlotte分出高下正正在於進入胃痛部分時劇情會不會暴走。大河內一樓的Princess Principal之所以完滿結束是因為最後兩集編劇換成別人了,但是是Key社和麻枝的話當然沒法換人。所以甚麼時候胃痛,是好看的胃痛還是難看的胃痛,全在他的一念之間。





01.11.2020 滋賀

Thursday, 1 October 2020

01/10/2020: 我的桐人與網頁遊戲
















跟以前的PHP架構不同,HTML5寫出來的頁遊腳本掛機起來更方便。各種自動化系統被研發出來。從簡單的javascript指令到tampermonkey插件,從discord bot遙距控制到驗證分工,到最後新進玩家不用費多少功夫就能打出職業玩家的水準。(每次提到驗證分工我又想起clickclickclick,這種分工程度在2008也是傳奇了……)





01.10.2020 滋賀

Saturday, 18 July 2020

夢.十夜 (5) The Guild Battle




















































在每場一小時的戰鬥裡隊伍會站在3x3的方格裡保護後方的城堡。玩家可以不斷攻擊對方的陣列得分,當玩家手上所有角色HP歸零時則進入破防狀態。在前排全體破防後對方才可以攻擊下一排的玩家,如果所有玩家被破防的話對方則可以直接攻擊城堡得到大量的分數。破防的玩家可以使用AP(Action Point)回復,而攻擊本身也會消耗AP。AP會隨時間回復,但在高強度戰鬥裡大家都會一直喝藥水把AP補回去。









第十場,也就是現在,我們的對手是目標進入前十[第二檔]的強敵「奧林匹克神眾」[Gods of Olympia]。裡面全是個人活動的前排常客,但聽說隊伍比較鬆散所以沒有上一場對手那麼強。他們沒有指揮,打法以強攻為主,是一個測試戰術的好對手。


Lampbear:「( º﹃º )好像是這次活動首次滿員?」



Sora:「這是二檔獎勵啊,雖然不知道有沒有機會拿到( > <)」







一個「有趣」的非動作類即時公會,卡片入手門檻不可能太低。公主連結打的旗號就是組隊低成本(相對其他遊戲),幾乎大部分隊伍都有辦法用同一隊「meta(主流)」、同一種戰法去推王--這樣土豪的投入感便差上了許多。公連的成功是抓對最大的中低消費客群,然後設計出來的角色也很能迎合他們的胃口。但論到頂端的消費公連是遠遠不及其他大手遊的。而◯戰幻想的消費門檻應該穩站西方市場的頂端,成功聚集高消費客群的他們才有辦法以偏小的遊戲規模打進app store課金榜前三。








Wednesday, 8 July 2020

8/7/2020: TWEWY animation and Mr. Driller

First of all, the animization of The World Ends With You is something I have never dreamed of. The switch game certainly failed to reach the same height as the DS version did, both operation-wise and story-wise (on top of the original 3 weeks), but the main story, character/art design and the music design is absolutely top notch. They are basically all you need for a great animation.

Their decision to modernize Shibuya as well as the phones is a bit sad to me, because these characters really live in Shibuya in the late 2000s. The only uncertainly is how much should be shown in 12 episodes -- given that Neku grew in the span of three weeks, it would be weird if they only do the first week or two. Some extra daily interactions will be welcomed, but only if they have enough time to display the whole main story. It would be nice if the animation gives extra answer to what was not fully explained both in the DS and the switch sequel.

Here is the trailer, in case you haven't watched:


I have been playing ring fit during the lockdown everyday, but I do not plan to give a review on the game. I also bought touhou mahjong but there is not much to say either.

Instead I want to talk about Mr. Driller Drillland. Unlike the DS version this is a complete remake of the 2002 version. I haven't played the 2002 version but I definitely enjoyed the DS version so I bought the switch one once I saw that on the store.

I cleared all Lv2 and finished the Lv3 Drindy adventure. I realized the technique to clear other Lv3's but lacked the time and temper for it, so I will stop here for now.

Before commenting on the game, I have a concern when others comment on games -- why are remakes valued less?

One shall not value remakes lower just because it is a "low effort" production. The pricing of a game depends on the development cost (of course), but the rest depending on marketing consideration on how the team think the game is worth.

You can say that a remake "probably" worth less because the game cannot keep up with the recent standard, or that the change in console alters the feeling of gameplay. The World Ends with You is a good example: the heavily stylus based control of the DS game feels off when it comes to switch. The extra content is nice but also left a gap between the main story and the extra story. This is why fans are not feeling as happy as in 2008.

> My review on The World Ends With You Final Remix < 

Nintendo and Sega made their old games ported onto switch at a really low price. This is not necessarily solely about effort (actually, getting the game mechanics right for these really old games are not super easy, although Nintendo already did it once for Wii). This is also a way for them to promote their IPs, which is worth more than selling the games itself. That never justify why remakes should be sold cheap.

After some research on the original one, I would say this switch version is basically the 2002 one moved to another console, just like how it did for the PC version. It completely copied the merits and weaknesses of the original game. The weaknesses meanwhile is relatively easy to fix and these are less tolerable in 2020, so the game got a mixed review (still beating TLOU2 by a huge margin, OF COURSE!)

On the good side they preserved all the game modes in the original version, which is well rounded comparing with the DS version which is pretty much just an extension of the world drill tour. The gameplay is pretty much the same because all you need is really a D-pad and the AB buttons. I always prefer D-pad over stick when you only need four directions -- the same happens for Tetris99.

On the bad side...the game lacks any tutorial or instructions. Lv 1 is quite hard for beginners to start with even with the beginner friendly mode. It would be nice if there is a really short and easy stage like 200m or 300m (which the DS version has).

Having 3 levels are the classic setup, but the gap is pretty huge between the three. There is no in-game instruction on how you can unlock the next one either.

I also wish to see more interaction among the characters, instead of just one or two vocal lines when the level is unlocked for the first time. I also wish to use Ataru on every single level on every mode. I know they assign characters to their suitable mode...but I just like Ataru more. is really a classic 2002 game, which some parts of it can be improved to fit the 2020 taste. I still like it, but how much should it be priced? I don't know because I don't buy games every day. At least for me I would happily take the $29.99 offer.

Tuesday, 7 July 2020

Outbreak stages classification when it is out of control: July updates

This is an update on my model based on test count vs positive rate. For the introduction please refer to these articles:

1) Classification of outbreak stages by variation of test count and positive rate
2) Typical stage shifts: May updates


We have seen the potential of this model predicting the case trend in the next few days, but it does not give strong indication on whether we are shifting to the next stage. Even if we are to make predictions based on the model, there is one important assumption that we made.

We assume that the government would thoroughly eliminate the local infection chain to the point that only isolated cases would occur after a certain time.

This is certainly false when from what we have seen in the last two months. These countries are divided into two categories: either they lack the ability to eliminate the virus (passive herd immunity), or they try to strike a balance between public health and economy, which miserably failed. This will be the main theme of my July update.

Just like the May update, we present the trend since late March or whenever data is available, but data after May 10 will be shown in bold.


Countries that cannot control the virus at all

When the virus was spreading in South-East Asia and Africa, we feared that the pandemic could be out of control because of a less hygienic environment and less efficient/reliable government etc. This turned out not the case -- Africa is too hot for the virus, and SE Asia actually did a good job controlling the damage. Thailand and Vietnam did particularly good, for example.

But when it arrived South America such worry finally came true, as the virus easily spreads among the passionate (in other words, unhygienic) Latinos. The whole South America is quickly approaching towards herd immunity, not because they wanted to, but they have no other choices at all. The hospital was of course overloaded, and the government lacked the ability to response. The living habit of South Americans would only accelerate the infection. Rumors were in Brazil where gangs asked residents to stay at home and isolate themselves -- although unlawful this could really the be the right thing to do against the virus.

Confirmed cases for Columbia and Costa Rica exploded around late May when the shock wave finally arrived South America. Despite the slow increase in testing scale, we see no signs of things under control, at all. Columbia has been testing left and right, but they still need more -- at least 5 times of the current scale -- if you compare with other big European countries like France.

South Africa is the singularity in Africa because its climate is quite different from the rest of Africa, which is bad because they are in winter now. But the bigger problem was that the government wanted to restart the economy so they lifted lockdown too soon. Daily confirmed cases doubles every 1 or 2 days since then, and the tragedy follows from slow reaction of the government. That is a pity -- we thought they did enough to shoo off the virus, but one mistake and it was all over.


Countries that cannot eliminate the virus

When everything is under control, the next step is to eliminate the virus locally so that the economy can reboot without creating more infection. However part of the population is always kind of disobedient. They get themselves infected and eventually get others infected as well. It has been a dilemma in western countries: rebooting the economy earlier implies that you will never get the virus eliminated, and it builds a constant pressure on the health care system as well as everything else. Most countries chose economy anyway, and we are observing more of these "long tail" infections.

The fact that Japan successfully suppressed the virus on the edge of a widespread infection shows their high standard of public health maintained. This is however, not necessarily true in every single corner of the country. Most recently reported cases in Japan are actually happening in the food and service sectors -- in particular pubs, (erotic) salons, maid cafe and so on.

It would really be a hard decision to shut these shops again. The industry is extremely fragile and already took a heavy blow in the past 3 months. On the other hand, infections are likely to happen in these places again as long as the virus is not exterminated completely, that they could be forced to shut indefinitely.

Russia as well as Singapore and some other middle-east countries are of another story. The infection is confined to the circle of foreign labours, whose are socially isolated from the general public and have a below-average living standard. Given their status in the host countries, it was deemed not worthy to eliminate the virus within those communities, so an alternative is to isolate all these workers as a whole, and hope that herd immunity would develop eventually there.

The United States case is so complicated... each states has its own problems. First of all the protests. Regardless of their motives, this is bad for disease control. Secondly lockdown was lifted a bit too early in some states like Florida and Arizona. The southern states also received an influx of patients from Central and South America, where things are apparently uncontrollable. Imposing the lockdown again is the right choice, but protests and the effects from neighboring countries would drag back the effectiveness of the lockdown.


For the rest of the world, UK is apparently reopening its border for most travelers knowing that their own immunity is good the point where taking ill travelers is of no big deal anymore. We are also observing relaxation of border control among countries that eliminated the virus like Taiwan and New Zealand. It would be fun to observe half of the world recovering, and the other half still fighting hard against the virus.


[1] Total confirmed cases vs total tests conducted, retrieved 5 July 2020.

Sunday, 24 May 2020








Wednesday, 6 May 2020

Model on outbreak stages classification: May updates

It has been 20 days since I last posted my analysis on the pandemic using a test count vs positive rate model. Here are some quick updates, particularly from those countries that I posted last time.

For graphs below, the "new parts" are indicated by a thicker line, starting from Apr 15 up to 5/6 May.

For further reference this is my first analysis

Classification of outbreak stages by variation of test count and positive rate


Stage 2->3

Pretty scary, right?

Strictly speaking, the positive rate that we are using is not the positive rate respective to the group we tested. Instead it is the ratio between confirmed case and testes case on that day.

In wealthy countries, tests are supposed to be done now within hours since we do not rely on DNA tests anymore, so such statistics would somehow reflect the positive rate of the day. In less developed countries however, this is less reliable.

Theoretically, a "positive rate" of above 1, even after smoothing, is possible though not sustainable. It means some delayed tests returned positive. Apparently this is not the case for Ecuador here. In the raw stats, both the test count and the confirmed count spikes quite often -- a big spike that cannot be wiped out by taking week average.

But such fault does not change the trend after all. We can see that Panama enters stage 3 with their extended tests. Meanwhile Ecuador could be still in stage 2 considering that the last spike only occurred 1 week ago (11183 -> 22719 on 27/4), we are still experiencing the drop as the spike moves out of affection. The daily confirmed case shows no signs of improvements, so I doubt things are under control for now.

Mexico is actually another country with spikes in their raw data so that the positive rate rockets above 1. The more worrying news is, they failed to expand the testing scale to cope with the emerging cases!

Stage 3->4

Once countries enter stage 3 it is almost sure that the countries did take proper measures, so as long as they do not lift the lockdown too early things will go improve.

Italy's 50000 daily test count is enormous given its size, but also understandable given how bad the outbreak was. It is certainly working and the positive rate drops vertically. She's in the end of stage 3 and will enter stage 4 once the testing capacity is in excess.

Indonesia is seeing similar improvement. Early spikes are due to religious events, but there was never an uncontrolled outbreak. With their testing capacity gradually improving they will enter stage 4 soon, too.

Stage 4

These are models for reference -- what happens after gaining full control over the virus?

Estonia is a rare example in Europe that avoided a full-scale outbreak. She's able to slowly put out the virus with constant testing.

New Zealand, who announced an early lockdown, is close to a full elimination. She's now ready to re-open again, but the test is not going to stop anytime soon to prevent any accident.

Updates on large countries

Canada was under the risk of favoring weather for the virus, but she proved that proper antivirus measures definitely helps regardless of the environment. I would say it is stage 2 to 3.

US is definitely improving. Not necessarily nationwide but at least for most states, including New York. We expect similar development for the rest of the states, but things may change if the governor decides to lift the ban early. US is surely in stage 3.

Russia: I mentioned last time that it is weird to see the outbreak with extensive tests -- the test count is even comparable with US! But now we know why is that the case. It is the poorly treated foreign labours, similar to what happened to Singapore (but well, Singapore provided no data). Russia is in stage 1 to 2.

Japan and UK

Two countries that are not tackling the virus like the rest of the world, so I was really curious what would happen next after I wrote my last analysis. Here are the result.

UK: well, apparently their limited hospital capacity did not limit their will to test more. They drop along the "isotherm" (green line) meaning that they have a constant rate of daily confirmed case, but the outbreak potential is slowly declining because there are less hidden patients now. Unfortunately the damage has been done, and UK is one of the most severely infected country in Europe. UK is in stage 3 and it takes some time before they reach stage 4.

Japan: probably the only well-developed country that does not really like testing. Although the emergency state order is not as restrictive as in other countries, the society slowly adopted the right measure and the outbreak somehow dies down. Everything seems to work in wonder, but I would not say Japan is out of danger really...


So that's all for me today. I don't think another update is necessary, but we will see. With outbreaks currently occurring in South America, the globe's economic nightmare is far from over.


[1] Total confirmed cases vs total tests conducted, retrieved 6 May 2020.

Friday, 1 May 2020

夢.十夜 (X4.5) Hot Spring Trip












隨著最後一個音符結束,她重重地呼出一口氣並回過神來。屏幕上顯示的分數是982750,比自己的P B(Personal Best高了四萬多分。對於這首遊戲最難曲目之一來說這應該是無比漂亮的成績了。





































房間裡提供的是煎茶和蕎麥茶、「山之茶屋」提供的則是咖啡與紅荼。比較意外的是這裡也有提供德國老牌Ronnefelft的茶。這家德國老字號給我的印象是經典的味道,沒想到他們的香氣配搭上也有自己的一套。Feel Relaxed裡面有經典安寧配搭矢車菊與黑莓葉,南非茶則比紅茶更切合放鬆這個主題。最有趣的是茶裡亦有橙的香氣,橙色的茶色幾乎使人以為自己在喝橙汁。要我說的話,大概就是Mariege Freres的Midnight in Paris的變種吧?







少年嘆了一口氣,轉身去泡了壺新的Feel Relaxed。






大壓制戰(Grand Conquest)是火紋英雄的活動之一。玩家被隨機分配到一個池裡面再分成三隊,以回合制進攻別隊領地的活動。玩家可以按自己實力選擇挑戰的難度,難度越高分數越高,打出來的分數會加到自己選擇的領地上,也會加到該領地週遭(neighbour)的領地上。玩家在整局的戰鬥總次數是有限的,但每回合的戰鬥次數則沒有限制。每回合結束時領地上分數較高的隊伍就能在該回合佔領該領地並得到土地分數,某隊在一個領地領先太多的話也會立刻宣告佔領,且該回合剩下的時間沒法在該領地戰鬥。最後勝利的隊伍會依照各隊土地佔領變化決定。


































不過這本來就是她一拍腦袋想出來的產物,也虧她可以想象到這個程度。話說回來FEH我已經快存到1000石了。新出的炎帝池本來我都忍不住抽下去了結果第一抽就出等了很久的織部翼。難道我真的要等到新風花雪月角、或者八月的Choose Your Legend活動才一口氣拼+10嗎?



Thursday, 23 April 2020

Classification of outbreak stages by variation of test count and positive rate


2 facts about the pandemic: the first is that masks do help. The second is that testing efficiency is crucial in controlling the disease due to the distinct feature of the virus that most infected are asymptomatic. The first fact is easily measurable by measuring its effect on $R_0$. The second fact however is not.

The constant $R_0$ is largely autonomous which is independent of nation parameters and current status but hygienic condition. Testing efficiency depends on amount of (reliable) testing kits you can get, which varies a lot among countries and in different time.

In order to investigate this we would like to plot testing efficiency against positive rate because we can divide the pandemic within a country into stages.

(I was inspired by the typhoon kinetic energy vs max wind plot. That was studied in a completely different way though...)

The parameters

Horizontal axis: log(daily test count)
Vertical axis: Daily confirmed cases/daily test count

We collect data from [1] and show some plots for countries with 50+ confirmed cases for more than 15 days (with the exception for some countries whose started announcing their test count very early on).

The daily count is smoothed by taking a 7-day average instead, to average out the weekly fluctuation.

The stages

If we plot log(testing capability) against positive rate we can observe the following stages:

Stage 0 - the isolation period. No signs of uncontrolled outbreak. Testing efficiency varies due to global trends in different time.

Costa Rica: isolated case from time to time and the virus never really rooted in the nation.

Taiwan: the country that did the best really. Fully masked citizens (with sufficient and affordable masks) and proper quarantine policies. Most cases are imported and identified immediately.

Character on the plot: wandering around and affected by random events rather than the exponential trend.

Stage 1 - the outbreak period. Testing capability expands but can't keep up with the growth in suspected cases so positive rate grows as well.

Typical examples as of now: part of South America (Brazil, Mexico), Russia

The most recent outbreak occurs in Brazil but they provide no testing data so I picked Hungary and Mexico here.

Character on the plot: as the positive count grows exponentially the testing capability simply cannot keep up with the growth. That results in a raise (kind of log-linear) in both testing scale and positive rate.

Stage 2 - the peak period. The testing capability is now able to keep up with the urgent needs. It stays steadily on the graph.

Typical examples as of now: part of South America, US

Character on the plot: the testing capability expands to the point the infection rate is primarily control and peaks for a while. On the plot it wanders around for a moment.

Stage 3 - the expand detection period. The reduction in new patients allow countries to put their effort on testing less suspected cases. The amount of confirmed cases may peak as much as the previous stage but the positive rate will drop while testing count increases. The curve on the graph drops along an "isotherm" that represents a given number of daily confirmed cases.

Typical examples as of now: Europe and Southeast Asia

Character on the plot: the testing capability expands further that more asymptomatic patients are identified. The curve first slides along an "isotherm" that represents a constant number of daily positive case then drop further. (From here we can see that the positive rate is in some sense a leading indicator than the positive rate!)

Stage 4 - the elimination period. By picking out most asymptomatic patients the spreading speed of the virus is greatly reduced. Countries may reduce their testing speed slightly with positive rate also dropping to a very low rate.

New Zealand: she did a marvelous job by announcing a decisive lockdown very early with citizens closely following the rules.

South Korea: after the initial outbreak, South Korea is one of the countries that applied large scaled quick testing. Together with high-tech tracing they successfully (almost) eradicated the virus. KBO is opening soon, too!

Character on the plot: when the daily new case drops drastically the testing pressure is reduced greatly. The testing target turns to the general public, but it will not be as frequent as before.

The large countries

First let us look at the plot for large countries. As you can see from the stage 2 graph the testing scale is affected by the population but there is not a simple way to scale it down -- it depends on the wealth, technological level and governance controlibility of the nation. So for now a better way to look at that is to compare just the large countries.

Canada: Stage 1-2? Not heavily infected yet, but worries are there an outbreak may occur anytime as the right climate is arriving.

Turkey: Stage 2-3. The outbreak almost peaked and should go down soon.

US: Stage 2. Due to population distribution we can hardly say the whole country is in a similar state. New York is definitely improving but some other states are still in bad form. The overall count seemed to be stabilized anyhow.

Russia: Stage 1. That is the most interesting case. They started large scale detection early on...yet they failed to prevent an outbreak. To this there are several explanations. First the testing accuracy may not be as good as the wealthy western European nations (although the kits are mostly from China anyway...). Secondly they may not be testing the right people -- most tests are conducted in the densely populated cities, but the patients simply spread the virus from its western border which is too hard to "defend". It is rather easy to close the Russia-China border, but closing border on the west is extremely hard.

The outliers 

Most countries followed this pattern, except for a few. The two main outliers are UK and Japan:

UK(aka the herd immunity): Stage 1. Yeah we now know that herd immunity is a joke and the government never really tried to implement that. However they are being dragged down by their inefficient NHS system -- they are not able to transform into a state-of-war medical system. They are also not expanding their testing capability enough. Sick people are simply asked to stay home unless their feel like they are going to suffocate. Hidden patients simple floating around the whole city and spreading virus swiftly. Although with lockdown already announced, the case count may not grow like Italy [see the stage 3 graph] -- but it is just the official number. The horribly high positive rate is sampled from seriously sick patients, hinting that the actual infected count is a lot higher. God knows when will it ends?

Japan(aka the Olympic host): Stage 1-2. They are finally willing to act a bit more after announcing the delay of the Tokyo Olympics. It is however too little too late, as the virus is already spreading independently in most large cities. Japan is also one of the few countries who is not willing to test widely, due to social pressure rather than government policy. They seemed to have controlled the spreading partially, after finally being able to shoo officers away from commuting alongside with partial lockdown and emergency state declaration. They also have better hygiene in general comparing with Europeans so the situation is apparently better -- until the uncontrollable outbreak begins.


So, are there anything we can tell from this plot?

- Testing more is an effective way controlling the outbreak. First on the suspects or people that had direct contact with confirmed patients, then on the sick during outbreak, and lastly on general population to eliminate.

- There aren't many countries that did not expand the testing scheme for those providing data. UK and Japan are in fact the only two -- UK is in a very bad state; Japan is worsening but they seemed to gained a little control with multiple alternate measures.

- This plot is a leading indicator comparing with the confirmed count and even more with the death count. However it gives less of a clue on when the peak period is over.

- The plot will be a stronger indicator if one manages to normalize the confirmed count by countries' capability, condition and population. In such way we can standardize and define clearly the classification of stages. The stages are still clear by identifying their shape though.

At least we feel happy that most countries are willing to test more, and adopting correct measures like lockdown, applying social distance and wearing masks, unlike what WHO claimed.

Well, that's all for me today. I hope everyone is safe during the lockdown again.


[1] Total confirmed cases vs total tests conducted, retrieved 17 Apr 2020.

Monday, 30 March 2020

Calculating area enclosed by intersections

A small math question today.

Given a unit sphere and an arbitrary ellipsoid, calculate the surface area of sphere inside the ellipsoid.

Without loss of generality, we may assume the unit sphere to be centered at origin, then the question depends solely on the 6 parameters defining the ellipsoid, $c_i, \alpha_i$ for $i=1,2,3$ in $\sum (x_i-c_i)^2/\alpha _i ^2 = 1$. Without thinking too much about existence of analytic solution in terms of the parameters, we want to look for ways to calculate or at least approximate the problem.

My own solution is based on the famous Gauss-Bonnet theorem:
$\int _M KdA + \int _{\partial M} \kappa _g ds = 2\pi \chi (M)$

The curvature of a unit sphere is constantly 1, and the Euler characteristic of a disc is 1. As long as you can calculate the geodesic curvature you get
$|M| = 2\pi - \int _{\partial M} \kappa _g ds$.
The intersection is a union of finitely many closed curves we can just calculate one by one.

A simple example would be as follows:

Consider the intersection between $x^2+y^2+z^2=1$ and $(x-1)^2+y^2+z^2=1$. The intersection $\Gamma$ is given by $x = \frac{1}{2}$ and $y^2+z^2 = \frac{3}{4}$. This is a circle of radius $\frac{\sqrt{3}}{2}$ with geodesic curvature $\frac{1}{\sqrt{3}}$. Therefore we have $\int _{\Gamma} \kappa _g ds = \pi$, so $|A| = 2\pi \pm \pi$ depending on the orientation. The surface area can be verified using the formula from Archimedes $|A| = \pi (h^2+a^2)$.


Of course, obtaining the parametrization is sometimes too difficult. Are there any easier ways to approximate the answer? Here are two suggestions from my friends.

- Monte Carlo based: sample points on the surface of the sphere and check whether it is in the ellipsoid.

- Integral approximation: similar to Monte Carlo but instead we split the sphere into pieces using spherical coordinates, then the required area is the integral over the indicator function of the ellipsoid.

And of course we can get an estimation using the Gauss-Bonnet approach. Let us call the sphere $S$ and the ellipsoid $E$. We start from a point of intersection, say $x$. The curve goes in the direction $v\in T_xS \cap T_xE$, the intersection of the tangent spaces of the two objects at $x$. We know the intersection must be of dimension 1 because if the two objects are cotangent at the point then the intersection is a point which generates no area after all.

Obtaining this direction is simply algebra, where we find the intersection between two subspace. With this direction we can numerically obtain a closed curve. There is a gap here because we may not go back to the starting point using numerical approximation. We just assume by smoothness (well sphere and ellipsoid are very nice objects) by doing fine enough approximation things would work (actually I believe we can prove this but I am not an expert in numerical methods) -- then we have an approximated curve of intersection.

From here we can calculate its length as well as its geodesic curvature, and the estimated area follows.

Gauss-Bonnet seems quite universal even if we generalize sphere and ellipsoid to other bounded closed $C^{\infty}$ objects because they are manifolds anyway. The only worry being whether we can get a closed curve without any global features that promises convergence.


Well this is just a funny little problem that I enjoyed during the lockdown. I feel like I should write some maths before I go back to my creation whether it is literature, music or research.

Meanwhile I hope everyone is alright during the pandemic -- whether you call it COVID-19, or Wuhan virus. Stay indoor, and stay healthy.

Monday, 9 March 2020

⑨/3/2020 Cirno's ⑨th Anniversary







YuFu - Holy Moon是自己進入太鼓界的鑰匙,做出自己最高水準似乎理所當然。


然後是IOSYS的算術教室。在東方大舉進攻音遊的世代,這首歌只是眾多東方音遊曲之一,甚至不在最熱門之列。論熱度IOSYS本身的魔理沙大盜、昆布與Usatei都在算術教室之上;其他團如Silver Forest、EastNewSound、Sound Holic等同時也有不少經典大作。除去James鬼畜圖和數學這兩個因素之外實在很難找到我對這張圖特別滿意的原因。是梗嗎?當年我還沒涉足東方,也聽不懂日文呢。


Cirno's Perfect Math Class [Wmf's Taiko]



上面那張是在11年2月5日ranked,⑨年後的2020正是做算術教室⑨週年的好時機。但⑨年後的我,做譜風格早已被「污染」:難度通漲所引致主流風格的偏移、1/6以上的混用、K社音遊的亂來風格等,潛移默化地成為了自己一部分。當我想用自己現有風格造出相近的效果時卻發現自己怎也再寫不出那種感覺。明明連打的紅藍轉換不再限於1/2拍上,自己卻發現dkkdk kkkdd這類連打放哪都不對;明明大家對串圖的接受程度比以前更高,我的成品卻比以前少了快150個音符。


不論如何,這張⑨週年版的譜面即使沒達到我心中的水準[8.5/10],要拿個不錯的分數還是可以的。我會給目前的成品7到7.5分吧。圖包等Guest diff到齊以後就會一併上傳。

Cirno's Perfect Maths Class: The 9th Anniversary Edition [Wmf's 2011 Taiko]

說句題外話,C97的高質量原創音樂其實不少。但因為它們不屬於東方或其他主流同人,外人接觸它們的機會比較少。在這裡我力推古典歌劇風的love solfege,主唱綾野えいり的歌劇腔與意大利人都對她讚譽有加: