Search This Blog

Monday, January 31, 2011

麻雀の図: 単純

The diagram speaks for itself. Due to the convention of MS Paint, arrows are hard to add, so just read the thing from down and left if left side, right if right side, and only going up if that's the only option available.

Red lines are game enders, blue line restarts game.





Sunday, January 30, 2011

ラブシック スクール ガール 章五


Chapter 5: It All Makes Sense Now

            “Oh Shanghai, I can’t sleep no matter how hard I try!  There is just too much to think about to even consider resting.”  Talking to a doll is such a kid thing, but I do so anyways. 
Awoken by the sound of the tap dripping, I lay in bed pondering about the events of today.  There’s more to Nitori than meets the eye…Patchy stalking Marisa…Am I really not good enough to beat Patchy in a danmaku fight?   My main concern was Nitori, since the other problems can be more easily remedied.  What did Aya mean when she said that?
            All these questions cycled through my mind as the sun rose.  With the birds chirping and the beautiful sight of the waking dawn, I headed to Moriya.  At school, I caught a glimpse of Patchy talking with Nitori.  When Patchy sat back at her desk, I went over to confirm something.
            “Patchy, how long have you known Nitori?” I questioned.
            “Since the beginning of the year.” Patchy answered.  “Although I don’t think we could be considered friends until around February.”
            “I see.”  I retorted.  February… That was the month of the movie fiend trip as well as Valentine’s Day.  It was also when Aya intimidated me with Valentine’s questions and when Aya informed Nitori of my supposed weakness…It all makes sense now!  With my newly acquired knowledge on the situation, I paid a visit to my favorite Tengu during lunch break.
            “Ello Marga-” but I dragged her and told her to come with me before she could finish her trademark welcome.  I ignored any other statements from her as we went to find a secluded location.
            When we finally arrived at our destination, Aya demanded to know what in Gensokyo was going on.  I took a deep breath as I prepared to explain my hypothesis.
            “Ok Aya, I’m going to say this once so pay attention.” I declared.  Without any further interruptions from her, I began.
            “Patchy wants to get her hands on Marisa.  However, the only thing stopping her from doing so is me.  Therefore, Patchy wants to eliminate me from the equation.  Nitori hates my guts, and therefore would side with Patchy no matter the circumstance.  After hearing about my supposed weakness from you, Nitori decided to befriend Patchy to extract more information from her.  This was a perfect opportunity for Patchy, as in exchange for information, she could request Nitori to assist in any devilish plot against me.  I’ve concluded that they are planning my downfall as I speak.”
            “Margatroid.” Aya said.
            “Yes?” I vainly answered.
            “I’m impressed you thought this out so thoroughly, when I just said that there was more than meets the eye.  I didn’t even give you any leads.  I’m not saying your hypothesis is wrong, but…”
            “Hmm?” I waited for her to finish.
“But I think you have too much time on your hands to be thinking up conspiracy theories.” She muttered.
            “I talk to dolls, what do you think?”
            “Good point.”
            After that bit of awkwardness, I revived the conversation.  “So will you help me?”
            “Why ask me?”
            “Because you play for both fields, Patchy and Nitori would never expect that you would secretly be my inside guy.” I assured her.
            “Alright, but what do I get in return?”
            “I don’t know…How about I give you permissions to write some crazy fan fiction about what happens at the end of all this?”
            I silently waited for a reply, and after a few moments, she said “Margatroid, how about you write the fan fiction, and I publish it in the Bunbunmaru?”
            “Very well Shameimaru.” Times were tough and I was desperate for some assistance countering whatever those two could concoct.
            “There’s just one question left unanswered.” Aya said.
            “And what’s that?” I curiously asked.
            “How about we have a danmaku fight?  That way, you can try to blow my brains out like you said on the movie field trip.”  Before I could say anything, she demanded we had a spell card battle.  With nothing better to do, I agreed to the battle.
            “Alright Margatroid, we only have time for 1 card each before the break is over.  You can go first.”
            I was thinking about which card to use when Aya yelled at me.  “How about using your Hourai Dolls?”
            “You aren’t worth my best spell card.” I arrogantly told her.  With a card in mind, I summoned my strength and declared.
            “Spy Sign, Seeker Dolls!”  A simple spell card in which I bring out 7 of my dolls.  Then they each fire a laser.  The trick here is that not all of the dolls aim for my opponent, only a few will.  This card requires them to have good prediction skills.  This was always my style of danmaku play, to incorporate mind games into the battle.
            “Margatroid, you think a couple of dolls are going to beat me?  I’m the fastest girl in the school; your lasers are just a minor inconvenience at most!”
            She was right, Aya managed to block the 3 lasers that were aiming for her.
            “Your dolls pack quite a punch Alice, but they leave you defenceless!”  What she said was true.  My main weakness in a danmaku fight is that I’m so busy controlling my dolls to attack, I can’t properly defend myself.  This is why I try to outsmart the opponent.
            “Now it’s my turn Margatroid!  Breeze Sign, Opening Winds of Tengu Road!”  I was still pulling my dolls back when I was hit by a powerful gust of wind.  The sound on impact was loud enough to create a sonic boom.
            The force from the attack was strong enough to lift me several feet into the air.  Finally, as the school bell rang, I came crashing down onto the dirt.
           “Looks like I win Margatroid.  Danmaku is about speed, if you hit your opponent quicker than they can react, then you’ve basically won half the battle.  Remember that fact. You’ll never beat Patchy if you play the way you did today.” With that being said, Aya raced back to school.  I got up from the ground, brushed off debris from my dress, and followed suit.  What she had told me also made sense to me.

Saturday, January 29, 2011

東方と西方のクロスオーバー

This post is dedicated to Crossovers in Touhou music.

Now there's an entire ~20 minute video on Nico Nico which traces down all Touhou songs' inspirational tracks. However, this post is for doujin circles who crossover Touhou music with Western music (This of course eliminates crossover Touhou music with Anime music, which will probably be another post).

I share four western crossovers with you today.

Original: Iron Maiden - The Trooper


 Cover: IRON ATTACK! - Cavalrymaid


Original: Judas Priest - Electric Eye


Cover: IRON ATTACK! - ELECTRIC APPARITION


Original: Micheal Jackson - Thriller


Cover: IOSYS - ハートフルネコロマンサー (Heartful Nekoromancer):


And my favorite:

Original: Dragonforce - My Spirit Will Go On


Cover: Sonic Hispeed Omega (SHO) - Shoot Through the Galaxy, Final Master Spark!!!


Friday, January 28, 2011

ボランティア 四日目

12:56 - Starting a bit early because I need to eat lunch.

1:10 - Students are asking me to open the lecture room door. I don't look like a professor do I?

1:25 - Called security to open the doors

1:31 - And it turns out it wasn't that room!

1:42 - Done lunch; slow day is slow

1:45 - Another UBC student asking for the room

1:46 - Lab!!!!!!!

2:07 - Took someone to Urology

2:38 - 2 in 30 minutes; new record of slow day!

3:37 - Spent most of my time up until now looking for a bag a patient forgot in a doctor's room, but to no avail.

3:49 - I consider today a failure, but not all days can be successes

3:52 - And of course the people need help as I'm about to leave.



Thursday, January 27, 2011

バイアスシャッフル - 中編

Continuation of this post

Cascade: Simply, after another type of shuffling (Standard, cut the deck, Pile shuffle, etc), taking half the deck, and merging it with the other half. This is different from standard and cutting the deck, in the sense that you don't merely put the resulting pile at the top or the bottom. Rather, you take one pile and overlay on top of the other in a vertical orientation as to let gravity push the top stack of cards down into the bottom stack.

We list our starting sample space, once again all cards are in order:

Si=[1D, 1C, 1H, 1S, 2D, 2C, ... 10S]

If we were to cut the deck at card #20, and then perfectly cascade our top stack with our bottom, our distribution becomes:

Sf=[1D, 6D, 1C, 6C, 1H, 6H, 1S, 6S, 2D, 7D, 2C, ... 5S, 10S]


It might not be clear in the beginning, but there is indeed a pattern to cascading. Each number is followed by the n + 1, and the suit remains the same. Of course perfect cascading is practically impossible, but this gives us a basis as to what to expect: Deviation from it's relative position, but that is compensated by relative repetition. In other words, cascading is a method of separating cards from one another, but keeping them relatively close together. This is a useful method of shuffling to both create randomness while keeping beneficial cards close to each other.

If we do an experiment with non-perfect cascading, we get an interesting result. This is the distribution of cards after five processes of cutting the deck (at a random # relative to the middle) and cascading.


Si=[1D, 1C, 1H, 1S, 2D, 2C, ... 10S]

Sf=[1D, 7H, 1S, 9D, 8D, 9C, 4H, 7S, 2D, 5D, 6D, 3H, 5C, 6C, 5H, 6H, 3S, 2C, 2H, 2S, 4D, 5S, 3D, 6S, 9H, 7D, 4S, 3C, 7C, 1C, 1H, 10D, 4C, 10C, 10H, 10S, 8C, 8H, 9S, 8S]


Bolded sequences are those that have relative relatedness to the initial sample space. We get 25/40 that are relatively close, while 15/40 have separated a very good distance.

This method of cutting the deck and cascading can produce varied results, depending on how well you can cascade. If many cards are still relatively together during cascading, then the procedure is no better than performing standard shuffling.

I now propose another solution: By performing all both methods (standard and cutting + cascading) we have learned thus far in succession, we should have a significantly larger deviance. I perform the experimental procedure 5 times: 5 standard shuffles and 5 successions of cutting the deck and then cascading. We once again start from our initial sample set.

Si=[1D, 1C, 1H, 1S, 2D, 2C, ... 10S]

Sf=[9H, 3H, 10C, 2H, 8H, 3C, 8S, 5D, 10H, 7C, 1H, 10S, 7H, 7S, 1S, 4C, 3S, 9D, 9C, 4H, 5H, 6S, 4S, 5S, 10D, 1D, 6D, 6C, 7D, 1C, 4D, 2S, 5C, 8D, 8C, 6H, 9S, 2D, 3D, 2C]


This time around, we get 19/40 cards that are still relatively close. I could note that cascading using a standard deck of playing cards hinders the data collected (Card sleeves make cascading easier, as the region between each card is made more slippery), but that isn't the point of this result.

We can see that the beginning has a nice deviance, up until the 13th card. This is a cascaded bundle; cards in a cascade that fall into the deck together tend to stay together essentially.

We could be content with this result too; my first 13 cards in the duel will have relative randomness. Usually duels tend not to last that long anyways. But the problem lies in the fact that your opponent cuts your deck before the start of a game. so then we would be stuck with the latter half; the half of low randomness.

Our final method, Pile Shuffling, is a guaranteed "randomizing" method. It will be discussed at a later date, and by combining all three methods, we can achieve an acceptable level of randomness for our purposes of card games.

Wednesday, January 26, 2011

電位 / Electric Potential

Going to do three questions today related to electric potential (More commonly known as Voltage) and electric forces.


1) Suppose we have two negatively charged plates placed next to each other an arbitrary distance "d" away from each other. What is the electric field at points 1, 2, and 3?

Recall the formula for electric field for a charged plate:
|E| = |σ/2ε| where σ = Q/A and ε is the permittivity value in a vacuum: 8.85E-12


At point 1, a test charge (which is a positive point charge with negligible charge) will be attracted to both plates (Because positive charges are attracted to negative ones). Therefore, the total electric field are additive.


σ/2ε + σ/2ε = σ/ε

From this result, we can see that the distance the plates are from each other does not matter.


At point 2, a test charge would once again be attracted to both plates, but since the attractive forces act in opposite directions, they cancel each other out.


σ/2ε - σ/2ε = 0

Finally, at point 3, we get the same result as point 1, in the case that the test charge is attracted to both plates. 

σ/2ε + σ/2ε = σ/ε


2) An object of mass 1.0 g is attached to a 50 cm string and hangs from a positively charged plate. The plate exerts an electric field of 10,000 N/C, and the object on the string is at a new equilibrium position. What is the charge, q, of the object?

We first draw a free body diagram of the object at its new equilibrium position:

We can see that three forces act on the object: Electric force, gravitational force, and tension on the string.

Recall the two Laws of Equilibrium: All forces acting on an object must equal 0, and all torques acting on the same object must equal 0. Since there is no circular motion involved, we only need to focus on the first law.


ΣF_e = 0
ΣF_e = ΣF_ex + ΣF_ey = 0

What is F_e? We can relate F_e and E by the equation:

E = F/q
F = E*q 

What is F_g? This is a simple application of Newton's Second Law (F = ma) 

F_g = m * g


What is T? T is composed of the horizontal and vertical vector components.


T = Tx + Ty
Tx = T*sin(θ)
Ty = T*cos(θ)

We can calculate θ with simple trigonometry:

θ = cos^-1(49/50) = 11.48

We can now go back to our equilibrium problem:

ΣF_ex = 0
|Tx| = |Fe|
T*sin(θ) = E*q


ΣF_ey = 0
|Ty| = |m*g|

T*cos(θ) = m*g


Since we have two unknowns and two equations, we can substitute one to solve the other.


T = m*g/cos(θ)



Tsin(θ) = E*q
(m*g/cos(θ))(sin(θ)) = E*q
m*g*tan(θ) = E*q
q = (m*g*tan(θ))/ E

Finally solve by plugging in appropriate values:


q = ((0.001 kg)(9.8 m/s^2)(tan(11.48))) / (10,000 N/C)
q = 1.99E-7 C


3) Suppose we have two point charges, q1 = 7.5 C, q2 = -2.5 C, that are 5 cm and 8 cm from the origin respectively. Where the x-axis, to the right of q2, is the electric potential zero?


Recall the formula for electric potential:

V = kq/r

We want to calculate the potential difference such that it is equal to zero:


V = kq1/r1 + kq2/r2 = 0
V = k(7.5)/(3+x) + k(-2.5)/x = 0

7.5/(3+x) = 2.5/x

7.5x = 7.5 + 2.5x
5x = 7.5
x = 7.5/5 = 1.5 cm


Therefore, the electric potential is zero at a distance of 5 + 3 + 1.5 = 9.5 cm from the origin.

Tuesday, January 25, 2011

数値円陣

Let's say we have five #1's, and four #0, arranged randomly in a circle. Between every two numbers that are the same, you put a 1, and between every two numbers that are different, you put a zero. After doing so, you remove the previous set of numbers.

The question now is: Is it ever possible to have a circle of nine #0's?

Let's look at a random distribution first:



I use Mahjong tiles that are face up to denote #0, and face down tiles to denote #1. The inner ring is our random distribution of numbers in a circle, while the outer ring is the result of performing the addition processes mentioned above. From our test of the random distribution, we can see that in order for any chance that there could be nine #0's, we should arrange the numbers to alternate in a circle as so.


But a problem arises, which we can see if we repeat the process.


Our result is eight #0's, and one #1.

In conclusion, no, there is no distribution of the given numbers that will result in a sequence of nine #0's.

Since the total numbers in the circle are odd, and the fact that we have one more #0 than we have #1, the circle is bound to have at least one pair of repeating numbers (since the first number connects with the last number to form the circle). No matter how many times we repeat the procedure, the maximum number of #0's will be eight.

Monday, January 24, 2011

麻雀のゲームプレイ

Now that we know how to set up the game, we can now play. I will assume that you are familiar with all the tiles (They are easy enough to interpret, except maybe for the Chinese numbers and the honors).

Since I found my portable Mahjong set, I can construct the full wall to remind you of the previous post:




Now we follow the procedure after setting up the wall and we end up with this:



The dealer has 14 tiles (hard to see from a bird's eye view) while the other players have 13. The players then take their tiles and place them in front of them like so:


They should look something like this; in other words, a random distribution. Now is the time to organize your tiles to make life easier for you.


 The general order (Not a written rule per se, but most follow it) of tile arrangement is 1-9, Man (Chinese numbers), 1-9 Pin (Circles, coins, buckets, etc), 1-9 Sou (The bamboo sticks. The funny looking bird is the 1 Bamboo stick), Wind tiles (East, South, West, North) and Dragon tiles (White, Red, Green). And yes, I did put red before white, but again, unwritten rules are unwritten.

The simplified objective of the game is to create a hand with 4 melds, and a pair of eyes. Melds are either three of a kind triples, or sequences (1,2,3; 4,5,6, etc) of the same suit (Suits are the Man, Pin, and Sou previously mentioned).


As the dealer, you have one extra tile, so you discard one. Then each player takes turns drawing from the wall and discarding a tile.


When you draw a tile, place it horizontally on top of your hand. If you don't want it, place it in the discard zone. If you want it, then replace it with one in your hand and throw that to the discard zone. The procedure is arbitrary and you don't need to follow it. Again, this is just how Japanese people play.



Make an appropriate gap for where the tile falls into the sequence.


Put the tile in, and then remove a tile to discard:


In this case I removed an end tile, so separation and fixing my hand was not necessary. Discard the tile.

In Japanese Mahjong, you organize your discards in this fashion. Each row contains 6 tiles, and then a new row is created under it. There are a maximum of 3 rows, and if the third row reaches 6 tiles, then that row continues until the game is over.

Throughout the game players may discard tiles that you want. If they deal a tile that you have doubles of, you can declare "Pon" and take that tile, thereby forming a triplet.


The basic procedure is you declare Pon, reveal your own tiles, then take all three and put them on your right. You then discard one of your tiles, because your hand should always remain at 13, except when after drawing and when you win.


To indicate the person you took the tile from, you flip that tile in the direction that your opponent is in. In this case, I took from the opponent that was to the right of me.

In the special case that you initially have 3 of a certain tile, and a fourth one is discarded, you declare "Kan" and follow the same procedure. Except this time, you get to draw a new tile from the dead wall, which is on the opposite side of the active wall. After drawing, you discard as usual and the game continues.

You can also take a discard if it forms a sequence, which is called a "Chi". However, since the probability of obtaining a sequence from a discard is much higher than obtaining a triplet, to compensate you can only declare Chi if the player on your left discards the tile.


Once again notice that the tile I took, 3 Bamboo, is pointing to the left, the opponent I took it from. You should show the meld in the logical sequence (1,2,3) but priority is given to the indication tile (The tile you took which points to the opponent you took it from). So in this case the sequence would be 3 (Indication tile pointing left), then follows normal sequence 1,2.

As the game progresses, someone may declare Riichi, and discard their tile horizontally. This indicates that they are in Tenpai (One tile away from winning). It may seem dumb to tell your opponents you are about to win, but it all becomes logical when we go into the theory and point system. For now, just assume that doing this is more advantageous than disadvantageous.


If your hand is in Tenpai, and someone discards the tile you need to win, you declare "Ron" and show your hand. Then the person who discarded the tile will pay you points based on how good your hand is. If your hand is in Tenpai and you draw the winning tile, then it is called "Tsumo" and each player will pay you.

The game ends either when someone wins, or the dead wall is reached (Remember you can't draw from the dead wall unless you get a Kan). In the case that no one wins, if you are in Tenpai, you show your hand. Players who are not in Tenpai (Or do not show their hand for other reasons; again a theory topic), must pay those players who are in Tenpai points. The general rule of thumb is either win, or if you can't for various reasons, get Tenpai.


Two players are in Tenpai (Myself, and the player across from me). The other two players would then have to pay points to us, because they failed to produce a Tenpai hand.

This is the general game play of Japanese Mahjong. Mechanics, points, and theory (Many, many topics I could cover) will be separate posts, but with the way school is progressing, don't expect these comprehensive posts for a while.

Sunday, January 23, 2011

ラブシック スクール ガール 章四


Chapter 4: Into a Game

            Valentine’s Day had come and gone, and as expected, Patchy wasn’t brave enough to buy Marisa a gift.  I could have bought her a gift just to annoy Patchy some more, but then I wouldn’t want Marisa to get the wrong idea.  The daily conversations with her were enough to satisfy me.
            While working on a school paper, I had an unexpected visit from none other than Nitori.
            “Alice.” Nitori promptly said.
            “What is it?” I asked, still confused as to why she would stop playing with her inventions to talk to me.
            “I heard from Hina that you fancy this girl.  Could this be the weakness that the Tengu was talking about?” Nitori said with the usual smirk.
            “Why does this concern you?” I said while silently cursing Aya.
            “Because then I won’t have to waste time inventing something to cover your mouth.”
            “I can assure you that any rumors about me are false.” I told her with a different tone.
            “And I can assure you that by changing your tone like that, you are supporting my genius theory.”
            “Don’t be so quick to jump to conclusions.” I retorted as Nitori went back to her seat.
            I hunted down Aya after school to see if Nitori had talked to her at all since the conversation we had at the movies.  Unfortunately my assumptions had become a reality.
            “Ello Margatroid!”
            “Did Nitori come bug you about this supposed weakness I have?”
            “She sure did.  She asked me on the computer, and I still have the logs on my computer.  Check them out if you want.”

“Heh, you’re trying really hard to crack Alice open aren’t you?” I said.
What do you mean?  How?” Nitori inquired.  “You mean the weakness thing that you know and I don’t?  I don't care, as I got an even better one, unless it's the same...  If it is, I think you can confirm it. By the way, what did she say to you about me?”
“I dunno maybe, want confirm if they are the same?” I asked.
“But you already know mine, and the part you don't know Alice has confirmed for you.”
“So what has Alice told you?”
“Alice doesn’t tell me anything.” Nitori firmly said.
“Ah but Alice told me that you know something so I'll assume that you know something about her secret.”
This is yet again, confirmation of my theory.  But she didn't tell me anything. Hina enlightened me, and I composed my genius theory myself.”
           
“I have this feeling that my life is being turned into a game by the likes of you two.” I said awkwardly.
            “But doesn’t this make things more interesting?” Aya stated.
            I was silent for a bit, contemplating the truth in that question.  With nothing better to say, I frustratingly told Aya “This is all Patchy’s fault!”
            “Oh, how so?”
            “I’ll give you the gist of it.  I’m talking and hanging out with Marisa as revenge against Patchy.  Let’s just say that Patchy wants to do some interesting things to Marisa, but I’m the obstacle preventing her from doing so.  I’ll defend Marisa even if it means a spell card battle* with Patchy.”
            “Oh Alice, Patchy is better than you at school and spell cards, there’s no way you could compete with her in those basis.”
            “I can try”
            “Just keep this in mind Margatroid.  There’s more to Nitori’s actions than meets the eye.”
            “What do you mean?” I asked her.
            “I’ll leave it to you to find out, since you claim to be such a genius!”
            As I walked home through the Forest of Magic, I saw Patchy going the opposite way from a distance.  I wondered why Patchy was here, seeing as she lived near the Scarlet Devil Private School, which is far from here.  The curiosity consumed me and I ran to Patchy.
            My question was to the point.  “Patchy, what are you doing here?”
            “Stalking.” I heard her say.
            “I’m sorry, what?”
My ears could hardly believe what she had said.  But then she said it again.  “I’m stalking.”
“Me?” I nervously asked.
            “Pfft, no.”  I had a brief feeling of relief, but that was crushed soon after her next statement.  “I’m stalking Marisa.”  Her claim was strengthened by the fact that in her hand was a book titled ‘How to passively stalk a person in black in front of you.”
            That’s right.  Marisa also lived in the Forest of Magic, albeit nowhere near my house.  I thought that staring at her all class would be enough for his sick urges, but it appeared to be not.
            I sighed, and then asked her with a more serious voice. “You’re still not over her?”  I waited for a response but there was silence.  “Face it; if you aren’t going to take action, nothing will happen.  I suggest you just move on and forget about something with a 0% chance of happening.”
            “But I can’t!  I just love the way she does her hair, the cute black witch hat with the purple stripe, how her body is –”
            “I’ve heard enough!  It’s getting late; we’ll talk about this later ok?” I stormed home trying to drown out all perverted thoughts that could arise.