The title comes from Sunless Sea, an adventure game where the player explore the dark sea of unknown. However, it has nothing to do with that game.

The translation of Japaneses words are done with best effort, in another word, there is no any kind of guarantee that the translation is official or consistent with the official one.

This article contains spoilers, which may harm or even completely ruin your experiences, here’s a non-exhaustive list: Hikari no Umi no Apeiria(Apeiria of the Sea of Landscape) Steins;Gate Eiyuu Densetsu Sen no Kiseki(Legend of Heroes: Trails of Cold Steel) Planetarian ~ Chiisana Hoshi no Yume Newton to Ringo no Ki(Newton and the Apple Tree) Eden *(spoiler: it is not spoiled)

Progress with heed.

Preface

This post does not contain what you’d expect from a typical game review – the overall plot, the execution, the voice casts and so on, because it is kinda lame to write something that is already on the Internet, especially for a year-old game like Apeiria(although I myself is the reason why this post is delayed for half a year).

So instead, the post focuses on elements and ideas, either central or peripheral to the game, and expands these concepts further. This strategy makes the post a little out of focus, and here’s another reason for it: the game is in a sense mediocre, because it does not exceeds one’s expectation.

I don’t mean the game is bad. On the contrary, Apeiria is a good combination of popular concepts and has a capturing story. After all, if the game is really not good enough, I wouldn’t even bother to post an article about it, let alone go through iterations in this six months. The point is, however great the game is, Apeiria is just a galgame, nothing more, nothing less.

It is hard to define what makes an art piece unique, but for a game, drawing moustache on character’s face and claiming the originality would be unique for the blatant copyright infringement. For a game, it could have great arts and music, humanly characters, a catching plot, or a thought-provoking theme. Kikiyama’s free game Yume Nikki(Dream Diary), for example, features exploring exotic scenes with an unrealistic art style, whereas The Last of Us, an action game by Naughty Dogs, portrays humanity in a postapocalyptic world. And that’s one of the reasons why they receive acclaims from the fans.

That being said, people’s mileages can greatly vary, and there’s no universal standard for good or bad games. So this post is not about judging whether a game is good or not, but just a peek into the core of the game.

No Sense Online

Note: it comes from Only Sense Online, an online lightnovel by Aroha Zachou(literally Chairman Aloha) later published in print. AFAIK this lightnovel does not feature OreTueee.

The story of Apeiria happens in 2035, and people profit from the highly developed VR technology and AI research. Reiichi Kirishima, works together with his friends to build the VRMMORPG Second. The second is a fantasy world of sword and magic. One may suspect fantasy makes up most of the game, just as Reki Kawahara’s lightnovel Sword Art Online, and most online novels do. However, the story puts emphasis on both the real world and the virtual one. But the best part is, the two seemingly contradicting themes are tactfully merged in the end of the game.

Back to the fantasy world. Usually to make a party, we need members of these sorts:

  1. Short- and/or mid-range attackers. They are usually deployed to defend the party members behind. Examples are thieves, swordsmans, lancers, and fighters. There should better be a tank to take the damage.
  2. Long-range attackers or scouts. They can discover enemies early, leaving enough time for preparation. Their attacks won’t be countered by short-range enemies. Archers, for example, belong to this category.
  3. Mages. If physical attack and magical attack are largely different in ways of effects and costs, then mages are needed to ensure a more comprehensive scope of attack.
  4. Healers or supporters. Their importance is never overemphasized.

Take Falcom’s Legend of Heroes: Trails of the Cold Steel I as a motivating example, we have:

  1. Short-/mid-range: Rean(tachi), Laura(double-handed sword), Fie(dagger/gun), Jusis(knight sword), Gaius(spear)
  2. Long-range: Alisa(bow), Machias(shotgun), Eliot(staff), Emma(staff)
  3. Mages: Emma, Eliot
  4. Healer: Eliot, Emma

In this game everyone is able to use arts(what magic is called in this game), therefore the main difference between mages and others is that mages have higher magic attack/defence stats. So Eliot and Emma are not required as mages(though they are required as healers).

Trails of the Cold Steel allows only four characters in the battle, with two substitute members, there are at most 6 members in the party most of the time. Let’s see how Falcom arranges the party in each chapter to make sure it is balanced:

  1. Rean(S), Alisa(L), Eliot(H), Laura(S)
  2. Rean(S), Emma(H), Fie(S), Machias(L), Jusis(S)
  3. Rean(S), Gaius(S), Jusis(S), Alisa(L), Emma(H)
  4. Rean(S), Laura(S), Fie(S), Machias(L), Eliot(H)
  5. Rean(S), Laura(S), Jusis(S), Emma(H), Millium(S)
  6. Rean(S), Alisa(L), Eliot(S), Machias(L), Fie(S), Crow(S)

Though there’s another system restricting the selection of members: there are four types of normal attack damage: slash, pierce, thrust, strike. Normal attacks from different characters have varied affinities to these types. For instance, Rean’s tachi attack has a high slash affinity, while Laura’s affinity to both slash and strike is high. And different enemies can be easily unbalanced by different types of attack damages. So the damage throughput could be increased by using the right person to attack the enemies, leading to more unbalancing and link attacks. Though the system is marginal since the bosses can hardly be unbalanced(they don’t have this kind of weak point), the affinities of the characters are carefully arranged to make sure all four types are covered in the above party setups.

However, in Apeiria, we see an unprecedented bias of party member roles. The constitution of the party is like this:

  1. Reiichi: short/mid-range attacker, main damage output, can revive himself and buff teammates
  2. Miu: sniper and healer. So roughly speaking, she’s Ana from Overwatch, while being a tsundere younger sister.
  3. Kuon: swordswoman, tank(she have a spell to call out an inpenetrable shield)
  4. Mashiro: thief, able to exchange money for rare items
  5. Apeiria: mage, persumably a DPS(second to Reiichi), unavailable most of the times.

As we can see Reiichi is ridiculously overpowered – he himself is a whole team. I guess it is probably due to the story. If my memory serves me right, the party is like the following in different times:

  1. Reiichi, Miu, Kuon, Mashiro, Apeiria
  2. Reiichi, Miu
  3. Reiichi, Kuon
  4. Reiichi, Mashiro
  5. Reiichi, Miu, Kuon, Mashiro

Nanami and whatever are taking up much less a role, so they aren’t counted. Discussion about them can be left to the post about the game’s spinoff Casablanca no Kishi(Knights of Casablanca), if there is one.

Given this plot requirement, the usual party makeup does not make any sense, because Reiichi will have no chance of survival, turning the Second into souls-like games, and Apeiria into Re:zero. Powering up the heroines could be a good idea, but that will render the last fight, a one-on-one fight with the last boss unimpressive.

This kind of unbalanced protagonist is mushrooming in lightnovels these years. With the uprise of coarse grained net novels, the use of such template is hitting new high. Let’s yell out some of the catch phrases:

Shuujinkou saikyou(protagonist the mightiest)!

Ore tueeee(I’m so stroooong)!

Such settings bring about some benefits. One of them is that the story can always be kept under control. There’s no need for ex machina, because the overpowered protagonist themself is the ex machina. Another is that a group of readers are usually happy about it. Admittedly I was one of them.

Apeiria of Love and Desire

Note: it comes from Aiyoku no Eustia. Ai means tarnish rather than love, while yoku means wings instead of desire.

In August’s visual novel Aiyoku no Eustia, we have multiple routes, from Ellis the pharmacist to Eustia, the main heroine in the story. Unlike other galgames, in Eustia, the common route does not branch to personal routes at the same time. It first has a branch off to Ellis’ route, then Fione’s, on and on, and in the end Eustia’s. Such a structure allows huge savings, since one thing in one route needn’t be reintroduced in another. Moreover, it makes all routes sequentially related, so the player can regard the story as a well-structured whole, rather than 5 separate ones.

Another visual novel created by Laplacian, Newton and the Apple Tree, has the same flow of story. However, the game forces the player to go into Ravi’s route once before progressing to the Japanese, the maid, and Alice.

However, it is not as simple as spreading out to personal routes sequentially. There should be key events to set the backgrounds of the personal routes apart. In Nitroplus’ adventure (text) game Steins;Gate, the D-mail is the key. If Rintarou sends the D-mail to Firis, the whole landscape of Akihabara will not be the heaven of otakus, but still a street of electronics. Therefore, the common route before and after this branch into Ferris’ route differs significantly.

Apeiria is also a galgame that has such a structure. However, it integrates all routes into one. As a side-effect, choices are eliminated, and we have a truly linear storyline. But here comes the problem: how can we avoid conflicts of different routes? Even we can manipulate the protagonist’s feelings for the heroines, we cannot simply take things in the previous route as unhappened.

To resolve the conflict, Silky’s Plus Dolce resorts to the good old time leap: if we can revert to the time before the personal route begins, then everything works perfectly. Therefore, in the end of routes the protag leaps to one year before the current time, losing almost all his memories, including the ones with the heroine.

However, there is no elixir, and the seemingly powerful time traveling has its side-effects, that is the time paradox. In Steins;Gate, to avoid the time paradox being happening, Rintarou has to stab Kurisu while avoiding bumping into his past self, when he goes back in time to save Kurisu. Sorry, but my poor wording makes it sounds a little silly.

Apeiria goes further than that: rather than not touching the paradox, it provides a new theory to get over it. The theory states it is not the case what one does now has no impact on the past. When we travel to the past, the future is not undone: it affects now so that everythin will converge to what has happened in the future.

Like this one, there are many theories presented in Apeiria about time, causality and so on. Just like the Koujin Nanase part of manga Kyokou Suiri(In/Spectre), although every theory, in itself, is unsound, it has its reasonable parts. And in the showdown, all rational parts are combined to make the final, sound theory.

Mechanic Princess in the Dying World

Note: it comes from the light novel Kakeyuku Toshi no Kikai Tsukihime, wherein a robot girl meets her end.

Everyone knows an awful lot about the greatness of AI, but much less about its correct use. Fortunately, we have Silky’s Plus Dolce to point out the right way: to make one’s own girlfriends.

It is a reiterated theme - there are already works about having android girls or something like that as protagonists or heroines. In manga Mahoromatic, the main heroine Mahoro is a female android, previously soldier, who comes to Misato’s house after knowing she has only a year left. Visual Arts Key’s visual novel Planetarian: The Reverie of a Little Planet features Yumemi Hoshino, a female robot narrator in a discarded planetarium. In the anime series Plastic Memories, we have android Isla(Aira) working with Tsukasa, the protagonist, to retrieve androids that are near the end of their life.

It seems not really good – they nurtured a stereotype about androids and robots – they are powerful but vunerable, they have short lifespan, they have difficulties understand human emotions, so on and so forth.

And the real bad thing is that Apeiria, one of the main heroine, and the center of the whole story, does not at all fall out of these stereotypes.

  • Power: she hacks tens of billions of computers around the world to make her Apeiria Network.
  • Vulnerability: she has not once successfully repelled Thinker’s virus attack. And when the Apeiria Network is hacked, she cannot disconnect herself from the network to avoid being disabled.
  • Short lifespan: near her own route, she has only one year to live(it’s Mahoro!)

Exception

Note: it comes from the movie Inception, maybe.

Tired and bored after a day’s work, we may want to escape the real world, and embrace a virtual one. So one may imagine a switch mechanism for it: switch on, and we’re in the realm of imagination, and off, back to the real world.

But such a kind of mechanism overlooks the interplay of this two worlds. Usually one playing a game is aware of its virtual nature, and is not separated from the outside. Take Ready Player One for example, control of the character in game is also affected by the lost of balance in the real world. So the virtual world can be greatly influenced by the real world, but it is often not the same the way around.

With this asymmetry taken into consideration, a layered structure seems better to express this kind of relationship. Here we adopt the idea of a stack. The virtual domain is on the top, while the reality is in the bottom. The virtual world dominates our feelings when present, but we fall back to earth upon exiting the imaginary.

So the reality-virtuality dichotomy can be expressed by a stack of size 2, let’s call it world stack from now. The real world is the first element of the world stack, and also the only element if we’re in reality. But if we dive into the virtual world, like OASIS, then we push the game onto the stack, and there’s two elements: the virtual world on top of the real world.

And it is easy to extend the world stack to allow more than 2 elements.

In a chapter of Douglas Hofstadter’s book Gödel, Escher, Bach: an Eternal Golden Braid, Achilles and the tortoise travels in and out Escher’s works by drinking blue and red phials. The travelling is done in a similar manner: going deeper into prints is like the push an item onto the stack, while going out out of the piece of artwork is like popping elements of the stack. And the world we are directly feeling is the top element of the stack.

Though it bears resemblance to the stack data structure, the world stack has a definitive difference: we do not know how many elements are in the stack at any time. So here’s the problem: how can we know if the top element of the world stack is the real world? In other words, how can we tell if the world we’re right in real or not?

We can check this by popping out elements, if there’s nothing to pop, then the world stack is empty, and the last world we popped is the real one. But note that popping out real world usually means one’s death. One never knows if the red pill is authentic before he washes it down. So we do not know if the current world we’re living is real, the only thing we know is since the real world is at the bottom, if we find out the current world is virtual, we can always pop out of it without getting ourselves killed.

But the safety to pop out does not mean it is doable. For example, it is claimed that people in heaven never dies. So people are not able to access the world beyond heaven, just like the girls cannot come out of the screen.

To solve this problem, Apeiria introduces a world structure similar to the stack model, but is different in its essence. In the game, the top and the bottom of the stack are connected, therefore the way in becomes the way out.

Verdict

Apeiria is a interesting combination of popular topics – AI, virtual reality – on the good old basis of Sci-Fi and fantasy. Unlike in Sword Art Online, where one is constant aware the world’s nature, Apeiria weaves a story across the borderline of reality and fantasy, which makes it capturing and different.

Comment and share

梦日记 01

in writing

#1

阳光透过五楼的窗户毫无遮拦地洒进教室。怠惰的蝉鸣,时不时夹杂在下课的吵闹声中。

教室里,有的同学摇晃着椅子和他人交谈;有一些在一张桌子旁围成一圈,看不到在做什么。有的人靠在窗边,朝着运动场的方向眺望,似乎在寻找什么。

看着黑板上的粉笔字,他感到一阵目眩。

这时,一个同学注意到了他,向他打了声招呼。他呆住了,没有反应。他不认识这位同学。

而且他满脑子里只有一件事。

20年之后,他又回到他以前就读的这座高中了。

#2

她放学后会去练弓。

但他不会射箭,辅助新手练习的射箭俱乐部的同学也不在。不过他不关心。他只对她感兴趣,所以他就跪坐在一旁看着。

他知道这所学校其实没有射箭俱乐部,也知道这个国家的人不会像他这样坐。他没想那么多。

当夕阳将要消失在远处教学楼的阴影中的时候,她开始收拾东西准备离开。

她没有向他搭话。她几乎不向任何人搭话。

他犹豫着是否要追上那提着包消失在门后的背影。

但他没有站起来。他的腿有点麻了。

#3.A

他的奶奶对他说过,爱一个人,就应该保护她的尊严。

他的奶奶也可能没对他说过这句话。她住在几百公里外的乡下,葡萄藤长得繁盛的地方。他几个月才会和她见一次面。

他暗自下定决心,如果这句话不是他奶奶说的,那他就自封为名言家。

名言家就是说名言的专家。比如说奥斯卡・王尔德,就是过去一位有名的名言家。

人总是在自己方便的时候想出一些名言,来作为自己的行动的理由。

想着这样的名言,他忍着发麻的腿,向着两位弓箭部的成员,一瘸一拐地走去。

向着背地里嘲笑她的两人走去。

#4

起因往往会是一些微不足道的事情。

望着街道另一头渐渐下沉的太阳,他走在放学后的路上。

沿街没有买小吃的小摊,到深夜才能看到这些推着小车的摊贩的身影。

他忍着饥饿,想着晚饭吃什么。

“嘿。”

他定住了。他认得几米之外,向他招手的这个人。

这个人和他穿着同样的校服,但在太阳光的对比下,显得有些暗。

20年前,记不清为什么了,他和这个同班同学的关系不太好。说是不太好,但连讨厌也算不上,就只是单纯的平行线,没有一点交集。

高中毕业之后,两人也分道扬镳了。

你,也回来了吗?

他嘴唇动了动,又随着口水一起,将这句话咽了回去。因为看着他的这个人的笑脸上,带着一抹感伤。

#3.B

他紧紧抱住了面前的她。

“我喜欢你!”他喊道。

他没有说下一句话。

在他怀里的她没有回过头来,也没有说话。

在他的眼前,一切都慢慢融解在金色的光芒中。

写在最后

我总有一些后悔的事。

不过有一些人,他们无忧无虑、达观岸然,他们对过去,对自己无怨无悔。

所以这里还是把人给划掉,改说我总有一些后悔的事好了。

回头看自己这些年,总感觉有一些后悔,有一些不甘:有的事情,自己本可以做得更好;如果那时候能那样,那说不定现在也不会这样了。

但即使这样感慨,也不会有任何改变。

无论是多么美好的梦,都有醒来的时候。

而新一天的太阳,照常会升起。

写在最后的后面

说好写 Apeiria 的感想的,结果鸽了5个月。这次可能要鸽到红瞳的后面了。

Comment and share

Last Day

in writing

It was unreal, but it felt real.

We are facing a giant dragon – given that all dragons are large – to fight our ways up the tower.

The tower of Yggdrasil is still looking down upon the world from the center today. Modeled after the boundary tower in Amakusa, Tokyo, which is the birthplace of a phenomenal VRMMO game, Yggdrasil is a lofty tower, too.

Like a needle piercing into the space.

A crystal one, though, to fit in the overall fantasy art style of the Second. And like the boundary tower, Yggdrasil boasts a whole lot of floors – 1000 of them, to be exact – crammed with all kinds of monsters and challenges.

And we are the first one to set our feet on the tenth floor. It is almost cliche to put some strong monster in the floors of ten’s multiples, and the AI is clearly sticking to this common practice when creating the Second.

One dragon was already beat when we first enter this tower, that is, the mother dragon. It was quite a tough one: it even nearly managed to suffocate us by burning out all the oxygen with its breath. But now, after countless battles, our team is invincible, and the dragon doesn’t stand a chance.

Whoosh! its sweeps the ground with its left claw, but in vain. It took too much damage to maintain its swift actions. Time to deliver the last strike. I called out to my little sister.

“Miu! Covering fire!” “Gotcha!”

The dragon roared in pain as the bullet penetrates the dragon’s eyes. The monster raises its head, it want to cast a breath.

“Kuon!” “Needless to say!”

Kuon cast the spell, which forms a shield protected all of us from the devastating breath. I looked to Apeiria, and she knows what I’m gonna do in an glimpse.

“You are powered up, owner, get in there!”

I run forward towards to dragon, to deliver the final blow.

“Mashiro, come back!” “Roger!” The little silouette who’s attacking with combos jumps back, agile like a humming bird.

A few steps forth, I get face to face with the hideous monster. Time for my ultimate sword.

“1/8!”

Eight beams spreads out in an instant, all of them punching the dragon, lighting the last moment of this floor master.

With a death agony, the large figure collapsed to the ground and dispersed.

After I confirmed the death of the dragon, other party members come to me.

“Miu, good shot.”

“Of course. Who you think I am?”

And I turned to my childhood friend.

“Kuon, your spells are of great help, too.” “Reiichi, it is okay to depend more on your older sister, you get it?”

“Well done, Mashiro.” “Eeh?! Th-th-thank you!” The introverted junior is still shy about compliments today.

“Apeiria.” I hugged the girl with silver hair. “You are the best.”

“Owner, plus, hug, equals, happiness.” The girl in my embrace replied with her monotonic voice, but with a tinge of delight.

“Hentai…” Complaints comes from the little sister with a cold-eyed gaze.

“…”

“Owner?”

“…”

It feels real, but it is unreal.

My eyes are open now. It’s not inside the magnificent crystal tower. Not but my monochromatic bedroom.

The window is wide open. A gust of December’s chilly wind breaks in, across my face and between my fingers.

“It’s … cold.” The wind must receive a summons for trespassing.

Today Apeiria will set off to Second, which has been already a hell. No one could return from that world of death. But there are no other options: she should have gone there a year ago, and this probation is as much as I could get.

The digital clock says it’s 7. I step into my slippers and out of my bedroom.

There is already one up.

“Good morning, owner.” The silver-haired girl notices me.

“Morning, Apeiria.” I try to make myself sound more energetic.

The dried-up response echoes in the empty house. There is nobody besides the two of us.

Miu isn’t here. She isn’t in this world any more.

She was disposed by her mother. Miu was created as a clone of that woman, who has been haunted by the shadows of her aborted child.

I walk to the kitchen, Apeiria is preparing the breakfast.

“A few minutes and it will be done, owner.”

The breakfast time in Kirishima’s is filled with silence. The clashing sounds of utensils reverbrate in the room.

After I’m done with the meal, I speak to Apeiria.

“It’s the last day, isn’t it?”

“Affirmative, owner.”

“Then let’s hang out.”

We first arrives at the AI circle in the school. Full name “Lovable AI Circle”, the circle has had two members – I, the founder, and Mashiro, who I forcibly dragged in. After I created Apeiria here, the five of us have had a lot memories here – making the VR MMORPG Second, and playing it together as a team. But Mashiro is not here.

She is dead from radiation in Boundary’s beta test, when the machine suddenly malfunctioned.

A double-slit box sits on the table. When I turn it on, it’s still showing interference pattern.

The DNA computer is turned off now. Apeiria is accidentally created from it when a lightning cut off its power about a year ago. And I managed to get her a body by hacking the genetic research facility.

There is nothing to do here. After the door is shutted with a huge noise, and silence dominates the school again.

Next stop is the boundary tower. Usually it was once full of people, especially when Boundary was in tests. After that accident, people are showing concerns about safety issues of the VR games, and the development of Boundary is put to a halt.

“Owner, will we be seeing Kuon?”

“Forget about it.”

Kuon’s father is the creator of the Boundary, so the family lives on the top floor of the boundary tower. One year ago, She had a quarrel with her mother, who fell unconscious soon afterwards and died days later. And Kuon never had a chance to apologize. Since then, I haven’t got in contact with her as much.

After having lunch in Asakusa, we decide to return.

Bang, and the door closed. It’s the familiar living room today.

The digit clock in the phone says it’s already 2pm. So the separation is only a few hours away.

In this year, we’ve been to everywhere we are able to go, done everything we are able to do. I promised to teach her what is love, but things are not going as expected.

Sometimes I doubt if I’ve made the right choice: is it fine to hold her back here, who is not supposed to be born and hated by the world, for a year? Is it right to spend so much time together, only to make the parting more heartbreaking?

And who is Thinker after all? Is he the observer who’s been peeking into this world? Why does the observer want to do with Apeiria?

I take out my phone from the pocket. In it there are the mails sent by my future self.

“There are two Thinkers.”

“The observer is human.”

And things like that. I pondered about these things again and again, but to no avail. This time I try again to find out what it means.

The observer … is human …

Wait.

The viruses, the time loop, the disappearing interference pattern.

The observer is human.

The appearing viruses in the house just confirm my thought.

It feels real, but it is unreal.

“Apeiria! Run!” I grab her hand and run for the door.

“Affirmative. What’s the heading, owner, by the way, why are viruses here?” She replies with a mite of bewilderment.

The answer to the first is clear. The way out is the way in.

Since we cannot rely on Apeiria network and the nanobots now, there is only one way into the Second.

“The boundary tower!”

Comment and share

rec-4-12-2018

in life

Artificial Intelligence

Resolution

If $l_i \Leftrightarrow \neg m_j$, then:

$\frac{l_1 \vee \cdots l_k \ \ \ \ m_1 \vee \cdots \vee m_n}{l_1 \vee \cdots \vee l_{i-1} \vee l_{i+1} \cdots \vee l_k \vee m_1 \vee \cdots \vee m_{j-1} \vee m_{j+1} \cdots \vee m_n}$

If there is a empty clause after a resolution, it means there are conflicts.

$$ \frac{p\ \ \ \neg p}{\square} $$

Resolution algorithm to prove $\alpha$ within KB:

  1. Generate CNF of the knowledge base $KB\wedge\neg\alpha$
    • CNF: $(l_{1,1}\vee l_{1,2} \vee \cdots \vee l_{1,n_1}) \wedge (l_{2,1}\vee \cdots \vee l_{2,n_2})\vee\cdots \vee (l_{m,1}\vee\cdots\vee l_{m,n_m})$
    • Also called k-CNF if $n_1 = n_2 = \cdots = n_m = k$
  2. Repeat resolution process for every new rule
    1. If there is no new rule, $\alpha$ cannot be proved.
    2. If there is an empty literal, then stop and $\alpha$ is proved

Complexity: exponential

Expressiveness: better (not restricted to Horn clauses)

Propositional logic

Jargons

Use functions, predicates to represent relationships:

  • A is a person -> $Person(A)$, Person: predicate
  • Person a has a crippled left leg -> $Crippled(LeftLegOf(a))$, LeftLegOf: function (it’s OK since a human has only one left leg) Formally,

Term ::= Function ( Term {, Term}* ) AtomicSentence ::= predicate ( Term {, Term}* ) …

Model

Forgot that.

Networking

Cisco’s proprietary software, packettracer, couldn’t be downloaded without enrolling in its network course.

IOS

  • use enable to enable the thing
  • show interfaces to have a look at all interfaces, show interface [interface].
  • show vlan to show vlan
  • configure terminal to open the configuration in terminal
  • (config) interface [interface] to select an interface

Dynamic Trunking Protocol

A proprietary protocol invented by Cisco to negotiate trunking on a link between two VLAN-aware switches.

There is several modes for it:

  • access: puts the ethernet port into non-trunking mode and negotiates to convert the link to a nontrunk one, disregarding the neigboring port
  • trunk: puts the ethernet port into trunking mode and negotiates to convert the link to a trunk one, disregarding the neigboring port
  • dynamic auto: willing to trunk, will be trunk if the neighboring port is dynamic desirable or trunk
  • dynamic desirable: actively willing to trunk
  • nonegotiate: disable DTP. No wonder, it is not compatible with dynamic modes.

Except nonegotiate, all modes are triggered by (config-if) switchport mode [mode]. Switch to no-negotiate mode using (config-if) switchport nonegotiate.

Use a no before the statement to do the opposite thing, like:

(config-if) no shutdown: set up the link (config-if) no switchport nonegotiate: turn on DTP

Computer Graphics

Blurring is often used in computer graphics, like, to create HDR(high dynamic range) bloom, depth of field or other post process effects.

HDR bloom: since the real-world camera cannot focus perfectly, so it will convolve the incoming image with an Airy disk. What about the Airy disk? Know what a spot of light looks like in our eyes? That would be one. A perfect lens with a circular aperture would make it because the diffraction of light.

This effect is not noticeable when it is not so bright. However, with more light we can see the blurred edge of the bright part of the image, taken by a camera. And computer graphics tries to reproduce the same effect by blurring.

You can think up an approach instantly: take the average of neighboring blocks, like below:

$$ \begin{bmatrix} 1/9&1/9&1/9 \\ 1/9&1/9&1/9 \\ 1/9&1/9&1/9 \\ \end{bmatrix} $$ By all means this is bad. It will seem block-ish.

A better one is Gaussian blur. It uses the Gaussian distribution as the weight of neighboring pixels to calculate the average, or more accurately, do the convolution. The weight matrix, like the one above, is called kernel.

A 3x3 Gaussian kernel is like:

$$ \begin{bmatrix} 1/16 & 1/8 & 1/16 \\ 1/8 & 1/4 & 1/8 \\ 1/16 & 1/8 & 1/16 \\ \end{bmatrix} $$

Some other kernels are here.

It also can be used before downsampling: Gaussian blur gets rid of the sharp edges in the image, thus after downsampling, it will free the image from aliasing like moire patterns. Aliasing happens because of the poor sampling makes different signals indistinguishable, and some high frequency signals might get in the way after sampling. So a low pass filter need to be applied before sampling.

Task: sample => downscale image Reason of problem: high freq. signal => ? Problem: aliasing => moire pattern Solution: low pass filter => blurring

And yes, Gaussian blur is also a low pass filter, with a Bode plot like a parabola. Possibly it seems obvious at first sight: Gaussian distribution has a factor $e^{-\frac{x^2+y^2}{2\sigma^2}}$, which is stable through Fourier transforms.

We can calculate it out. Let’s put the basic calculus into practice. $$ \begin{aligned} &\iint e^{i\omega x}\cdot\frac{e^{-\frac{x^2+y^2}{2\sigma^2}}}{2\pi\sigma^2}\ dxdy\ =&e^{-2\sigma^2\omega^2}\iint \frac{e^{-\frac{(x-2\sigma^2\omega i)^2+y^2}{2\sigma^2}}}{2\pi\sigma^2}\ dxdy\ =&e^{-2\sigma^2\omega^2} \end{aligned} $$ So the amplification is: $$ \begin{aligned} dB&=20\log{e^{-2\sigma^2\omega^2}}\ &=-\frac{40}{\ln 10}\cdot \sigma^2\omega^2 \end{aligned} $$ Perfect! It is a parabola after all.

Leave Kawase to the next day.

Misc

マシンガンでも壊せなくて キャタピラーでも潰せなくて

Comment and share

Notes for 4-10

in life

Database

PL/SQL

Anonymous and named PL/SQL block

  • Anonymous PL/SQL block
    • Need to compile every time
    • Not stored
  • Named PL/SQL block
    • Can be stored in DB

Stored Procedure

Grammar:

Procedure ::= CREATE [OR REPLACE] PROCEDURE ProcedureName '(' Parameters ')' (AS|IS) RETURN ReturnType DECLARE Declaration BEGIN Body END ';'
Parameters ::= Nothing | Parameter {, Parameter}
Parameter ::= ParameterName (IN|OUT|IN OUT) Type ':=' DefaultValue
  • Note:
    • In the parameter list, varchar cannot be specified with a length.
    • MySQL has no AS|IS in the procedure, and IN/OUT is put before the parameter name.
    • In MySQL ,one has to change the delimiter before defining a procedure or function.

Loop statement

  • for x in [Reverse] 1…20 loop … end loop;
  • while … loop … end loop; To escape from a loop:
  • exit when …;

Conditional statement

  • if … then … elseif … end if;

Cursor

  • Used to process a set of records. PL/SQL record variable can only store one record at a time.
  • Technically, it acts like an iterator, which means one cannot process multiple records at the same time(though we can store them as a whole).
  • In declaration, a cursor is declared with a SELECT statement, and we can use this cursor to access the data returned by that SELECT statement
  • A cursor is bind to one specific SELECT clause, that is, one cannot bind it to another SELECT statement
  • The SELECT statement is and only is executed when the cursor is OPENed(see below).
  • CLOSE the cursor to free the memory space. Synopsis:
  1. Declaration

cursor cursor_name is select statement;

  1. Open cursor

OPEN cursor_name;

  1. Get the data

FETCH cursor_name into variable;

  • The cursor will move forward, just like python’s next function do.
  1. Check if there is no more entry

IF NOT cursor_name%FOUND THEN …;

  1. Close the cursor

CLOSE cursor_name;

  1. For loop Unique to Oracle. No need to open, close, or fetch from a cursor.

FOR variable in cursor_name LOOP – do something to the variable END LOOP;

Artificial Intelligence

Knowledge base && Inferrence

* Truth table

* Brute force search

* Forward chaining
    * reliable
    * completeness
        * -> only have these two properties for the knowledge bases able to be expressed with Horn clauses
        * Horn clause: a disjunction of literals with at most one unnegated literal
            * E.g. $\neg x_1 \vee \neg x_2 \vee \cdots \vee x_n \vee u$

* Backward chaining
    * To prove q, with p->q now prove p
    * Avoid repeating by check if a clause is already proved or disproved

Misc

Panning derives from panorama.

4/11 Record

Programming Languages

Polymorphic Functions

  • Static: cost grows exponentially with parameters
  • Dynamic:
    • supply a tag when calling the function

Example: Overloading Equality

  1. Equality was overloaded as an operator
  2. Make type of equality fully polymorphic
  3. Make equality polymorphic in a limited way
    • (==) :: ''t -> ''t -> Bool, ''t is a type t with equality
    • will be a static error if t is not Eq type

Type Classes

  1. Merchanism in Haskell
  2. Dictionary-passing style implementation [ESOP1988]
    • Type class declaration – dictionary
    • Name of a type class method – label in the dictionary
    • Parametric overloading – passing the dictionary to the function
class Show a where
show :: a -> String

instance Show Bool where
show True = "True"
show False = "False"

print :: Show a => a -> IO ()
print x = putStrLn $ show x
type 'a show = {show: 'a -> string}
let show_bool : bool show =
{
show = function
| true -> "True"
| false -> "False"
}

let print : 'a show -> 'a -> unit =
fun {show=show} x -> print_endline (show x)

Smalltalk: subtyping

  • Object -> super class -> method table

  • If interface A contains all of interface B, then A objects can also be used as B objects

    • need to look up all instances(members) at runtime

Javascript has the same problem

  • v8 engine: hidden class
function Person(first_name, last_name) {
this.first_name = first_name;
this.last_name = last_name;
}

var potus = new Person('D.', 'Trump');
var potrf = new Person('V.', 'Putin');

Computer Architecture

Optimizing cache

Merging write cache

DRAM and SRAM

Misc

最低だ 最低だ 最低だ

Comment and share

Author's picture

NoirGif

A progamer.


Student(probably)