Mygod Studio™ - Ivory Tower https://en.mygod.be/blog/ My brand new unmaintained blog. en How to Increase Gmail POP Check Frequency to Infinity https://en.mygod.be/blog/increase-gmail-pop-check-frequency-to-infinity/ <p>If you have a secondary email account (possibly set up by your university like mine), chances are you may find your email reaching your gmail very slowly (up to 58 minutes!)<!--more--></p> <p>According to <a href="http://blog.tinyenormous.com/2009/08/24/increase-the-frequency-that-gmail-checks-your-pop-mail-account/">this article</a>,</p> <blockquote> <p>Ok this hack might not be for everyone, but if you have Gmail set up to check your pop accounts they don’t let you set the polling frequency anywhere. This can be bad because it makes you go to the settings page to be able to hit the refresh button on each one of your accounts! After a little digging it turns out it uses a weird formula to determine the polling frequency. Let’s say it checks your account and finds an email. The next time it checks it will wait for <em>slightly less time</em> before it checks again. If it finds email a second time it will continue to shorten the interval until it is checking every 5 minutes or so (maybe even less!) The purpose of this is so that google doesn’t waste resources checking an account that only gets one email a month.</p> </blockquote> <p>So how do we fix this? The original blog post suggests a method where you send an email to yourself every once for a while to keep the interval down.</p> <p>Well what's the better way than polling? Of course - receiving a notice wherever there is a new email. That's exactly what we are going to do. Set up forwarding in my email while keeping POP3 intact and everything magically works:</p> <ol> <li>No duplicate emails in my gmail;</li> <li>Receiver email is still correct;</li> <li>New email arrives at gmail, and then on my desktop in less than 1 minute;</li> <li>Gmail servers are happy, so am I.</li> </ol> <p>Hope this blog post helps. :-)</p> <p><strong>UPDATE 20161026:</strong> I just received an email at 11:13am sent at 11:11am while the mail fetch history reads: (I did a manual refresh after I received those 2 mails)</p> <p>Mail fetch history for "[my email]"</p> <p>| | | | ----------------------------- | ----------------- | | Wed, Oct 26, 2016 at 11:27 AM | 2 mails fetched. | | Wed, Oct 26, 2016 at 11:06 AM | No mails fetched. | | Wed, Oct 26, 2016 at 9:59 AM | No mails fetched. | | Wed, Oct 26, 2016 at 8:55 AM | No mails fetched. | | Wed, Oct 26, 2016 at 7:41 AM | No mails fetched. | | Wed, Oct 26, 2016 at 6:37 AM | No mails fetched. |</p> <p>All the email information is correct. The only downside is that since it wasn't fetched through POP3, it's not labeled correctly. But that's not a big issue compared to instant emails. :-D</p> https://en.mygod.be/blog/increase-gmail-pop-check-frequency-to-infinity/ Mon, 10 Oct 2016 13:10:39 +0000 Perfect Forwarding Command Line Arguments in Linux with C++ https://en.mygod.be/blog/perfect-forwarding-command-line-arguments-in-linux-with-cpp/ <p>Warning: This article is extremely <em>inapplicable</em> to Windows which lacks proper support for <code>exec</code>. What a useless operating system!</p> <p>Perfect forwarding is a feature made possible by rvalue references introduced in the C++11 standard. Basically it allows you to forward any object supplied with function arguments without copying the object.<!--more--> For example, we can have a wrapper function template like so:</p> <p><code>cpp // compiler will inline func from -O2 on template &lt;typename R, typename Func, class... Args&gt; inline R wrapper(Func func, Args &amp;&amp;...args) { cerr &lt;&lt; "Spamming your log happily! :-D" &lt;&lt; endl; return func(forward&lt;Args&gt;(args)...); }</code></p> <p>At some cases the compiler may even decide to inline the whole function as if it is a macro. We'd like the same thing to happen here too. A new process should NOT be created and everything should work as if there is not a single intermediate process. And this is exactly what <code>exec</code> has to offer!</p> <p>For example, if one wants to write a shell (because it's a homework assignment but their teaching assistant is too dumb to point out that one cannot simply invoke system's <code>sh</code>) in C++, it can be accomplished within 15 lines of code:</p> <p>```cpp</p> <h1>include &lt;unistd.h></h1> <h1>include <cerrno></h1> <h1>include <cstring></h1> <h1>include <iostream></h1> <p>using namespace std;</p> <p>constexpr const char *sh = "sh";</p> <p>int main(int argc, const char **argv) { argv[0] = sh; execvp(sh, const_cast<char *const *>(argv)); // don't reinvent the wheel cerr &lt;&lt; strerror(errno) &lt;&lt; endl; return -1; } ```</p> <p>Here we used perfect forwarding (which means passing the same <code>argv</code> pointer) to replace the current process image with <code>sh</code> by invoking <code>execvp</code> after changing the initial argument to the name of the file to be executed. The rest of the arguments are perfect forwarded to the next process. And if that fails, the current process will continue to run the following code where we handle the error.</p> <p>After we run the code above, we can see that our process has been completely replaced by <code>sh</code> (shares the same PID, etc.) and the new <code>sh</code> process can use the <code>stdin</code>, <code>stdout</code>, <code>stderr</code> and the command line arguments as if it was run directly. So we can see the perfect forwarding has worked.</p> <p>Under Windows, there is no proper (which means efficient) way to <code>fork</code> a child process or replace the current process image. Since <code>fork</code> and <code>exec</code> are often used in conjunction to create a child process of something else, Windows has an API called <code>CreateProcess</code> to do that but there is not a single way to do <code>fork</code> only or, in our case, <code>exec</code> only. So if you compile the code above under Windows, a new process may still be created and there might be even an error message even if it succeeded. I'd like to call that not-so-perfect forwarding.</p> <p>P.S. If we are free to choose any programming language we want, we can as well simply create a symbolic link to the system <code>sh</code> file. If we are required to make a binary, we can write a <code>Makefile</code> like so:</p> <p><code>makefile all : which sh | xargs -i cp {} sh</code></p> <p>Remember kids,</p> <blockquote> <p>Don't reinvent the wheel.</p> </blockquote> https://en.mygod.be/blog/perfect-forwarding-command-line-arguments-in-linux-with-cpp/ Wed, 01 Jun 2016 19:38:19 +0000 Optimal Solution for Chopsticks (Leftovers Variant) https://en.mygod.be/blog/optimal-solution-for-chopsticks-leftovers-variant/ <p>Recently I came across this hand game called Chopsticks, a.k.a. Magic Fingers, or just touching each other's fingers for some unknown reasons. Some website <a href="https://sakuraentorizasshi.wordpress.com/2008/10/16/japanese-games-chopsticks-hand-game/">&#91;citation needed&#93;</a> suggests that this game comes from Japan.<!--more--></p> <p>According to [Wikipedia](https://en.wikipedia.org/wiki/Chopsticks<em>(hand</em>game%29), here are the rules:</p> <ul> <li>Each player uses both hands to play the game, the number of digits extended on a hand showing the number of points that the hand has. Both players start with each hand having one point — one finger extended on each hand. </li> <li>Players take turns to tap one of their hands against another hand that is not dead (either their own other hand, or one of their opponent's). The number of points on the tapping hand is added to the number on the tapped hand, and the player with the tapped hand extends their digits to show the new score. The tapping hand remains unchanged.</li> <li>“Leftovers” variant, also known as "Overlap" or "Remainders", changes the rules so that if one hand gets more than &#92;(M&#92;) points with &#92;(M&#92;) usually equal to 5, the leftover points are left on the hand. This means that &#92;(M&#92;) is subtracted from the number of points that one hand gets, and the only way a hand can get knocked out is if it accumulates exactly &#92;(M&#92;) points. For example, if a player has four on a hand and the other transfers three points to that hand, the hand gets two points, since &#92;&#91; 4 + 3 \equiv 2 \pmod 5. &#92;&#93; Btw someone should point out how unreasonable this is. Since 5 will never appear under this rule, one should let &#92;( M = 6 &#92;).</li> <li>The goal of this game is to knock out both of one's opponent's hands.</li> <li>In “Splits” variant, players are allowed to evenly divide an even number of points in one hand to an empty hand.</li> <li>In “Transfer” variant, a player may tap their own hand to transfer points from one hand to the other. For example, if a player had three points on his or her right hand and one on his or her left, the player could rearrange them to have two on each hand. A "dead hand" is treated as having no points, for this purpose, which allows a player to bring a dead hand back into play by transferring points to it. You cannot prolong the game by not taking your turn. Transferring or splitting points between the two hands is not allowed when the values of both hands merely switch places, as it could be used as in tactic to unnecessarily prolong the game. For example, if a player's left hand has three points and their right hand has two points, they are allowed to transfer points such that one hand has four points and the other hand has one point, but it would be an illegal move to transfer three to the right hand and two the left hand. It would also be illegal, if a player has one point on one hand and one dead hand, to transfer the one point to the dead hand. P.S. The rules of “Transfer” variant has obviously included those of “Splits” variant.</li> <li>In “Suicidal” variant, the objective of the game is to force your opponent to defeat you.</li> </ul> <p>In this article we will be mainly discussing the “Leftovers” variant, not because I have only played this variant, but also because the game will become much more boring without this variant, and I haven't even mention how to play the basic version of this game without this variant.</p> <p>Here are the two variant that I have played:</p> <ul> <li>The first one included “Splits” variant as well as the “Leftovers” variant;</li> <li>There is nothing special about the second one, except we let &#92;( M = 10 &#92;). However people in different region of China use different gestures for number 7 and 9, so it's easy to get into trouble when playing with people from different parts of China. Beware!</li> </ul> <p>We will put our focus mainly on the two variants of game mentioned above, and explore other interesting properties of this game and its other variants by the way.</p> <h1>Combinatorial Game Theory</h1> <p>To tackle this problem, Combinatorial Game Theory (CGT) is something we will have to encounter.</p> <p>Game Theory is the Theory about playing Games. Combinatorial Game Theory is the Theory about playing Combinatorial Games.</p> <p>Combinatorial games are sequential games with perfect information with no chances involved. Sequential implies that the players take turns to make one of the available moves so rock paper scissors isn't one of these games; a game with no chances involved is a game in which after a player make a specific move, one and only one possible outcome will take place so rolling a dice isn't a combinatorial game; and perfect information implies that all players are aware of the current status and all the possible moves of other players so Texas Hold'em isn't a combinatorial game either. Normally, CGT is confined to two-player games so that players take turns to achieve a defined winning position.</p> <p>Given the above definition, the following games can be categorized as combinatorial games:</p> <ul> <li>Go, hyped by the famous AlphaGo;</li> <li>Chess;</li> <li>Gomoku;</li> <li>Tic-tac-toe;</li> <li>Checkers;</li> <li>Chopsticks and all of its variants, which is the topic of this articles;</li> <li>And much more...</li> </ul> <p>As mentioned before, in a combinatorial game one can predict which player will win the game or the game is bound to result in a draw given the current status, and both players play optimally. A solved game is a game where we know how to play optimally, either using our brain or using computers. For example, Go isn't a solved game yet since it has so many possible statuses that we cannot try all of them. AlphaGo uses neural network to provide a human-like insight of the current game status to improve its results estimated using CGT.</p> <h1>Analysis of the Game</h1> <p>Now we will use some general methods in CGT to tackle Chopsticks.</p> <p>First and foremost, we will find the positions. For Chopsticks, we represent a positions with a 4-tuple &#92;( \left(a<em>x, a</em>y, b<em>x, b</em>y\right) &#92;), where &#92;( a<em>x, a</em>y &#92;) are the two numbers represented by A's (or your) hands, and &#92;( b<em>x, b</em>y &#92;) are the two numbers represented by B's (or your opponent's) hands. And it's now A's turn. It's obvious that swapping &#92;( a<em>x, a</em>y &#92;) or swapping &#92;( b<em>x, b</em>y &#92;) doesn't make a different position, so for easier calculations and rules making, we will enforce the rules &#92;( a<em>x \ge a</em>y &#92;) and &#92;( b<em>x \ge b</em>y &#92;).</p> <p>There are three possible statuses for a given position:</p> <ol> <li>A is bound to win the game, represented by &#92;(W&#92;);</li> <li>B is bound to win the game, i.e. A is bound to lose, represented by &#92;(L&#92;);</li> <li>We will come to this third possible status shortly after. :-P</li> </ol> <p>By speculating the process of the game, one can obtain the following:</p> <ol> <li>A position that can go to a &#92;(L&#92;)-position is a &#92;(W&#92;)-position. The winning strategy here would be to move to this &#92;(L&#92;)-position;</li> <li>A position that can go only to &#92;(W&#92;)-positions is a &#92;(L&#92;)-position since the opponent is bound to win no matter which move you pick.</li> </ol> <p>According to the rules given in the beginning of this article, here are the possible moves that one can move from one position to another:</p> <ol> <li>&#92;( \left(a<em>x, a</em>y, b<em>x, b</em>y\right) \to \left(\left(a<em>x + b</em>x\right) \bmod M, b<em>y, a</em>x, a<em>y\right) \left(a</em>x, b_x \ne 0\right) &#92;);</li> <li>&#92;( \left(a<em>x, a</em>y, b<em>x, b</em>y\right) \to \left(b<em>x, \left(a</em>x + b<em>y\right) \bmod M, a</em>x, a<em>y\right) \left(a</em>x, b_y \ne 0\right) &#92;);</li> <li>&#92;( \left(a<em>x, a</em>y, b<em>x, b</em>y\right) \to \left(\left(a<em>y + b</em>x\right) \bmod M, b<em>y, a</em>x, a<em>y\right) \left(a</em>y, b_x \ne 0\right) &#92;);</li> <li>&#92;( \left(a<em>x, a</em>y, b<em>x, b</em>y\right) \to \left(b<em>x, \left(a</em>y + b<em>y\right) \bmod M, a</em>x, a<em>y\right) \left(a</em>y, b_y \ne 0\right) &#92;);</li> <li>In “Splits” variant, &#92;( \left(a<em>x, 0, b</em>x, b<em>y\right) \to \left(b</em>x, b<em>y, \frac{a</em>x}{2}, \frac{a<em>x}{2}\right) \left(a</em>x \equiv 0 \pmod 2\right) &#92;);</li> <li>In “Transfer” variant, &#92;( \left(a<em>x, a</em>y, b<em>x, b</em>y\right) \to \left(b<em>x, b</em>y, x, a<em>x + a</em>y - x\right) \left(\frac{a<em>x + a</em>y}{2} \le x \le \min \left&#92;{M - 1, a<em>x + a</em>y\right&#92;}, x \ne a_x\right) &#92;).</li> </ol> <p>Note that the first four operations may lead to &#92;( b<em>x &lt; b</em>y &#92;) that is against our rules. This is when a swap is mandatory.</p> <p>We know that &#92;( \left(0, 0, b<em>x, b</em>y\right) &#92;) is a &#92;(L&#92;)-position, in which &#92;( b_x > 0 &#92;), because A has two dead hands. However if it's in “Suicidal” variant, this is a &#92;(W&#92;)-position.</p> <p>One can use retrodiction with these positions and transition equations to obtain what status other positions are. For most variants, we will find that we aren't able to find the status of the initial position &#92;( \left(1, 1, 1, 1\right) &#92;). All the remaining positions can't transit to a &#92;(L&#92;)-position, and is able to transit to other unknown positions. Since we're 100% sure that there exists a path one can transit from the initial position to the final position &#92;( \left(0, 0, b<em>x, b</em>y\right) &#92;), one can prove using topological sorting that there exists a loop in our graph. Since any player will not choose to move to &#92;(L&#92;)-positions (or he or she will lose the game), both players will choose to go inside the loop to prolong the game. And I call these positions stalemate, represented by &#92;(S&#92;).</p> <h1>Find the Statuses</h1> <p>Even for the first game which is relatively simpler, there exists &#92;&#91; \frac{5 \times \left(5 + 1\right)}{2} \times \left(\frac{5 \times \left(5 + 1\right)}{2} - 1\right) = 210 &#92;&#93; statuses, and for most of them you need to try more than a few of all five possible moves. That's quite annoying to do manually. So naturally we let our computers to finish all the repetitive work, just like AlphaGo.</p> <p>As a byproduct, we can also determine within how many steps the game will end for all the non-&#92;(S&#92;)-positions, given that both players play optimally. This value equals to the number of rounds of our retrodiction. This is because...</p> <ol> <li>For &#92;(W&#92;)-positions, the first &#92;(L&#92;)-position we found is nearest to the end of the game. In order to win the game ASAP, the optimal strategy will choose this position;</li> <li>For &#92;(L&#92;)-positions, the last &#92;(W&#92;)-position we found is farthest to the end of the game. In order to prolong the game as much as possible so that the opponent will have a better chance to make a mistake (if he or she isn't a computer), the optimal strategy will choose this position.</li> </ol> <p>The following C++ code determines all the statuses and the steps it takes to end the game.</p> <p>```cpp enum Position { POSITION<em>UNKNOWN, POSITION</em>WINNING, POSITION<em>LOSING } status[RULE</em>MOD][RULE<em>MOD][RULE</em>MOD][RULE_MOD];</p> <p>constexpr int getMaxMoves(int ax, int ay);</p> <p>// Makes the move specified. Returns true if it's not allowed. bool makeMove(int &amp;ax, int &amp;ay, int &amp;bx, int &amp;by, int move);</p> <p>inline void updateStatus(Position &amp;flag, int ax, int ay, int bx, int by, int move, int &amp;nowSteps) { if (makeMove(ax, ay, bx, by, move)) return; switch (status[ax][ay][bx][by]) { case POSITION<em>UNKNOWN: flag = static</em>cast<Position>(flag &amp; ~POSITION<em>LOSING); break; case POSITION</em>WINNING: if (flag == POSITION<em>LOSING) nowSteps = max(nowSteps, steps[ax][ay][bx][by]); break; case POSITION</em>LOSING: // weakness found if (flag != POSITION<em>WINNING) { flag = POSITION</em>WINNING; nowSteps = steps[ax][ay][bx][by]; } else nowSteps = min(nowSteps, steps[ax][ay][bx][by]); break; default: assert(false); } }</p> <p>for (int i = 1; i &lt; RULE<em>MOD; ++i) for (int j = 0; j &lt;= i; ++j) status[0][0][i][j] = POSITION</em>FINAL; bool updated = true; while (updated) { updated = false; for (int ax = 1; ax &lt; RULE<em>MOD; ++ax) for (int ay = 0; ay &lt;= ax; ++ay) for (int bx = 1; bx &lt; RULE</em>MOD; ++bx) for (int by = 0; by &lt;= bx; ++by) if (!status[ax][ay][bx][by]) { auto flag = POSITION_LOSING; int nowSteps = -1; for (int move = 0, maxMoves = getMaxMoves(ax, ay); move &lt;= maxMoves; ++move) updateStatus(flag, ax, ay, bx, by, move, nowSteps); if (flag) { status[ax][ay][bx][by] = flag; steps[ax][ay][bx][by] = nowSteps + 1; updated = true; } } } ```</p> <h2>The Optimal Solution</h2> <p>And finally we are going to show you the optimal solution to this game! For your own conveniences, we choose to format our output using &#92;( \left(b<em>x, b</em>y, a<em>x, a</em>y\right) &#92;), meaning by going to this position, your opponent is bound to win or lose, so I should avoid or prefer to moving to this position. Also we omit the positions where the game will end in 0 or 1 steps for they are way too obvious to judge.</p> <p>And lastly, we print the statuses matrix, just for fun.</p> <p>```cpp // Print solution and debug information to cerr cerr &lt;&lt; "Positions to find:" &lt;&lt; endl; for (int bx = 1; bx &lt; RULE<em>MOD; ++bx) for (int by = 0; by &lt;= bx; ++by) for (int ax = 1; ax &lt; RULE</em>MOD; ++ax) for (int ay = 0; ay &lt;= ax; ++ay) if (status[ax][ay][bx][by] == 2 &amp;&amp; steps[ax][ay][bx][by] > 1) cerr &lt;&lt; bx &lt;&lt; by &lt;&lt; ' ' &lt;&lt; ax &lt;&lt; ay &lt;&lt; " (win within " &lt;&lt; steps[ax][ay][bx][by] &lt;&lt; " steps)" &lt;&lt; endl; cerr &lt;&lt; endl;</p> <p>cerr &lt;&lt; "Positions to avoid except obvious ones:" &lt;&lt; endl; for (int bx = 1; bx &lt; RULE<em>MOD; ++bx) for (int by = 0; by &lt;= bx; ++by) for (int ax = 1; ax &lt; RULE</em>MOD; ++ax) for (int ay = 0; ay &lt;= ax; ++ay) if (status[ax][ay][bx][by] == 1 &amp;&amp; steps[ax][ay][bx][by] > 1) cerr &lt;&lt; bx &lt;&lt; by &lt;&lt; ' ' &lt;&lt; ax &lt;&lt; ay &lt;&lt; " (lose within " &lt;&lt; steps[ax][ay][bx][by] &lt;&lt; " steps)" &lt;&lt; endl; cerr &lt;&lt; endl;</p> <p>for (int ax = 1; ax &lt; RULE<em>MOD; ++ax) for (int ay = 0; ay &lt;= ax; ++ay) { for (int bx = 1; bx &lt; RULE</em>MOD; ++bx) for (int by = 0; by &lt;= bx; ++by) cerr &lt;&lt; status[ax][ay][bx][by]; cerr &lt;&lt; endl; } ```</p> <p>Now let's see the optimal solution! For the first game:</p> <p>``` Positions to find: 10 30 (win within 4 steps) 22 10 (win within 6 steps) 22 30 (win within 2 steps) 30 10 (win within 2 steps) 31 10 (win within 6 steps) 32 30 (win within 4 steps) 33 10 (win within 2 steps) 33 30 (win within 8 steps) 40 30 (win within 2 steps) 42 30 (win within 4 steps) 44 10 (win within 2 steps) 44 30 (win within 2 steps) 44 31 (win within 6 steps) 44 33 (win within 6 steps)</p> <p>Positions to avoid except obvious ones: 10 22 (lose within 3 steps) 10 32 (lose within 5 steps) 11 44 (lose within 3 steps) 20 10 (lose within 5 steps) 20 44 (lose within 3 steps) 21 30 (lose within 3 steps) 21 31 (lose within 7 steps) 21 33 (lose within 3 steps) 30 30 (lose within 3 steps) 30 31 (lose within 7 steps) 30 33 (lose within 3 steps) 30 40 (lose within 3 steps) 31 22 (lose within 7 steps) 31 40 (lose within 3 steps) 31 42 (lose within 5 steps) 31 44 (lose within 3 steps) 32 32 (lose within 5 steps) 32 33 (lose within 9 steps) 32 44 (lose within 7 steps) 33 22 (lose within 3 steps) 33 32 (lose within 5 steps) 33 42 (lose within 5 steps) 40 22 (lose within 7 steps) 40 40 (lose within 3 steps) 40 42 (lose within 5 steps) 40 44 (lose within 3 steps) 41 31 (lose within 7 steps) 41 44 (lose within 7 steps) 43 10 (lose within 5 steps) 43 44 (lose within 7 steps)</p> <p>00102220210012 00000000010000 00000100000000 00000100010000 10000110110000 20112102220202 00110100011002 10100101100000 00110101000002 10000110010000 10000000010000 10000110110000 10100000000000 11100011011010 ```</p> <p>And for the second:</p> <p>``` Positions to find: 10 20 (win within 12 steps) 10 40 (win within 6 steps) 10 50 (win within 10 steps) 10 77 (win within 14 steps) 11 60 (win within 10 steps) 11 80 (win within 16 steps) 11 90 (win within 2 steps) 20 40 (win within 2 steps) 20 53 (win within 12 steps) 20 70 (win within 8 steps) 20 90 (win within 2 steps) 22 20 (win within 8 steps) 22 30 (win within 8 steps) 22 40 (win within 2 steps) 22 60 (win within 6 steps) 22 80 (win within 2 steps) 22 90 (win within 2 steps) 30 11 (win within 14 steps) 30 20 (win within 6 steps) 30 50 (win within 10 steps) 30 60 (win within 12 steps) 31 60 (win within 16 steps) 31 80 (win within 10 steps) 31 90 (win within 8 steps) 32 70 (win within 4 steps) 33 40 (win within 16 steps) 33 70 (win within 2 steps) 33 80 (win within 10 steps) 40 30 (win within 2 steps) 40 51 (win within 12 steps) 40 80 (win within 2 steps) 40 90 (win within 8 steps) 41 90 (win within 4 steps) 42 40 (win within 6 steps) 43 80 (win within 6 steps) 44 10 (win within 8 steps) 44 20 (win within 6 steps) 44 30 (win within 2 steps) 44 40 (win within 8 steps) 44 60 (win within 2 steps) 44 80 (win within 2 steps) 50 10 (win within 4 steps) 50 30 (win within 4 steps) 50 70 (win within 4 steps) 50 90 (win within 4 steps) 52 50 (win within 10 steps) 52 80 (win within 6 steps) 54 50 (win within 10 steps) 54 60 (win within 6 steps) 55 50 (win within 2 steps) 60 10 (win within 8 steps) 60 20 (win within 2 steps) 60 70 (win within 2 steps) 60 95 (win within 12 steps) 61 40 (win within 12 steps) 62 20 (win within 6 steps) 64 20 (win within 8 steps) 64 40 (win within 4 steps) 64 50 (win within 6 steps) 64 60 (win within 4 steps) 64 80 (win within 8 steps) 65 40 (win within 6 steps) 65 50 (win within 10 steps) 66 20 (win within 2 steps) 66 40 (win within 2 steps) 66 60 (win within 8 steps) 66 70 (win within 2 steps) 66 80 (win within 6 steps) 66 90 (win within 8 steps) 70 40 (win within 12 steps) 70 50 (win within 10 steps) 70 80 (win within 6 steps) 70 99 (win within 14 steps) 71 20 (win within 16 steps) 71 30 (win within 8 steps) 71 60 (win within 10 steps) 72 80 (win within 12 steps) 73 30 (win within 14 steps) 73 50 (win within 6 steps) 73 70 (win within 14 steps) 76 20 (win within 6 steps) 77 20 (win within 10 steps) 77 30 (win within 2 steps) 77 60 (win within 16 steps) 80 10 (win within 2 steps) 80 30 (win within 8 steps) 80 60 (win within 2 steps) 80 75 (win within 12 steps) 81 60 (win within 6 steps) 82 20 (win within 4 steps) 82 40 (win within 8 steps) 82 50 (win within 6 steps) 82 60 (win within 8 steps) 82 80 (win within 4 steps) 83 20 (win within 12 steps) 84 80 (win within 6 steps) 85 20 (win within 6 steps) 85 50 (win within 10 steps) 86 60 (win within 6 steps) 87 30 (win within 4 steps) 88 10 (win within 2 steps) 88 20 (win within 2 steps) 88 40 (win within 6 steps) 88 60 (win within 2 steps) 88 70 (win within 8 steps) 88 80 (win within 8 steps) 90 33 (win within 14 steps) 90 50 (win within 10 steps) 90 60 (win within 6 steps) 90 80 (win within 12 steps) 91 10 (win within 14 steps) 91 50 (win within 6 steps) 91 90 (win within 14 steps) 92 40 (win within 6 steps) 93 40 (win within 10 steps) 93 70 (win within 8 steps) 93 80 (win within 16 steps) 94 60 (win within 12 steps) 96 10 (win within 4 steps) 97 10 (win within 8 steps) 97 20 (win within 10 steps) 97 40 (win within 16 steps) 99 10 (win within 2 steps) 99 20 (win within 16 steps) 99 40 (win within 10 steps)</p> <p>Positions to avoid except obvious ones: 10 10 (lose within 13 steps) 10 22 (lose within 9 steps) 10 33 (lose within 17 steps) 10 54 (lose within 7 steps) 10 60 (lose within 3 steps) 10 64 (lose within 7 steps) 10 66 (lose within 3 steps) 10 70 (lose within 7 steps) 10 71 (lose within 17 steps) 10 72 (lose within 13 steps) 11 40 (lose within 13 steps) 11 91 (lose within 15 steps) 11 96 (lose within 5 steps) 11 97 (lose within 9 steps) 11 99 (lose within 3 steps) 20 20 (lose within 3 steps) 20 22 (lose within 3 steps) 20 30 (lose within 11 steps) 20 42 (lose within 7 steps) 20 44 (lose within 3 steps) 20 50 (lose within 5 steps) 20 54 (lose within 7 steps) 20 64 (lose within 5 steps) 20 66 (lose within 7 steps) 20 71 (lose within 9 steps) 20 73 (lose within 7 steps) 20 91 (lose within 15 steps) 20 92 (lose within 7 steps) 20 94 (lose within 13 steps) 20 96 (lose within 5 steps) 20 97 (lose within 9 steps) 20 99 (lose within 3 steps) 21 80 (lose within 3 steps) 21 88 (lose within 3 steps) 21 97 (lose within 11 steps) 21 99 (lose within 17 steps) 22 82 (lose within 5 steps) 22 83 (lose within 13 steps) 22 85 (lose within 7 steps) 22 88 (lose within 3 steps) 30 10 (lose within 7 steps) 30 30 (lose within 13 steps) 30 31 (lose within 17 steps) 30 52 (lose within 7 steps) 30 61 (lose within 13 steps) 30 66 (lose within 9 steps) 30 80 (lose within 3 steps) 30 82 (lose within 7 steps) 30 88 (lose within 3 steps) 30 99 (lose within 17 steps) 31 97 (lose within 9 steps) 32 71 (lose within 17 steps) 32 76 (lose within 7 steps) 32 77 (lose within 11 steps) 32 80 (lose within 9 steps) 32 87 (lose within 5 steps) 32 97 (lose within 11 steps) 33 20 (lose within 13 steps) 33 71 (lose within 9 steps) 33 73 (lose within 15 steps) 33 77 (lose within 3 steps) 33 87 (lose within 5 steps) 40 10 (lose within 11 steps) 40 22 (lose within 7 steps) 40 32 (lose within 5 steps) 40 33 (lose within 3 steps) 40 40 (lose within 3 steps) 40 43 (lose within 7 steps) 40 44 (lose within 3 steps) 40 50 (lose within 5 steps) 40 73 (lose within 15 steps) 40 82 (lose within 5 steps) 40 83 (lose within 13 steps) 40 84 (lose within 7 steps) 40 85 (lose within 7 steps) 40 88 (lose within 3 steps) 40 91 (lose within 7 steps) 40 93 (lose within 9 steps) 40 97 (lose within 9 steps) 41 60 (lose within 9 steps) 41 92 (lose within 7 steps) 41 93 (lose within 11 steps) 41 96 (lose within 5 steps) 41 97 (lose within 17 steps) 41 99 (lose within 11 steps) 42 60 (lose within 3 steps) 42 62 (lose within 7 steps) 42 64 (lose within 9 steps) 42 66 (lose within 3 steps) 42 76 (lose within 7 steps) 42 82 (lose within 9 steps) 42 88 (lose within 7 steps) 43 70 (lose within 13 steps) 43 90 (lose within 15 steps) 43 97 (lose within 17 steps) 44 61 (lose within 13 steps) 44 64 (lose within 5 steps) 44 65 (lose within 7 steps) 44 66 (lose within 3 steps) 50 11 (lose within 11 steps) 50 20 (lose within 9 steps) 50 31 (lose within 11 steps) 50 32 (lose within 5 steps) 50 33 (lose within 11 steps) 50 40 (lose within 9 steps) 50 41 (lose within 5 steps) 50 43 (lose within 7 steps) 50 60 (lose within 9 steps) 50 71 (lose within 11 steps) 50 76 (lose within 7 steps) 50 77 (lose within 11 steps) 50 80 (lose within 9 steps) 50 81 (lose within 7 steps) 50 87 (lose within 5 steps) 50 92 (lose within 7 steps) 50 93 (lose within 11 steps) 50 96 (lose within 5 steps) 50 97 (lose within 11 steps) 50 99 (lose within 11 steps) 51 20 (lose within 13 steps) 51 50 (lose within 5 steps) 51 90 (lose within 11 steps) 51 91 (lose within 7 steps) 52 82 (lose within 7 steps) 52 85 (lose within 7 steps) 53 50 (lose within 5 steps) 53 60 (lose within 13 steps) 53 70 (lose within 11 steps) 53 73 (lose within 7 steps) 54 64 (lose within 7 steps) 54 65 (lose within 7 steps) 55 52 (lose within 11 steps) 55 54 (lose within 11 steps) 55 55 (lose within 3 steps) 55 65 (lose within 11 steps) 55 85 (lose within 11 steps) 60 22 (lose within 3 steps) 60 31 (lose within 9 steps) 60 50 (lose within 5 steps) 60 52 (lose within 7 steps) 60 60 (lose within 3 steps) 60 62 (lose within 7 steps) 60 66 (lose within 3 steps) 60 71 (lose within 9 steps) 60 72 (lose within 13 steps) 60 73 (lose within 15 steps) 60 76 (lose within 7 steps) 60 77 (lose within 3 steps) 60 82 (lose within 5 steps) 60 87 (lose within 5 steps) 60 88 (lose within 7 steps) 60 90 (lose within 11 steps) 60 91 (lose within 7 steps) 61 44 (lose within 9 steps) 61 90 (lose within 7 steps) 61 94 (lose within 13 steps) 62 44 (lose within 7 steps) 62 64 (lose within 9 steps) 62 80 (lose within 3 steps) 62 81 (lose within 7 steps) 62 82 (lose within 9 steps) 62 86 (lose within 7 steps) 62 88 (lose within 3 steps) 63 40 (lose within 3 steps) 63 44 (lose within 3 steps) 63 71 (lose within 11 steps) 63 77 (lose within 17 steps) 64 42 (lose within 7 steps) 64 44 (lose within 9 steps) 64 64 (lose within 5 steps) 64 66 (lose within 9 steps) 64 86 (lose within 7 steps) 65 54 (lose within 7 steps) 65 64 (lose within 7 steps) 66 44 (lose within 3 steps) 66 54 (lose within 7 steps) 66 64 (lose within 5 steps) 66 94 (lose within 13 steps) 70 11 (lose within 17 steps) 70 20 (lose within 3 steps) 70 22 (lose within 3 steps) 70 44 (lose within 9 steps) 70 70 (lose within 13 steps) 70 82 (lose within 7 steps) 70 85 (lose within 7 steps) 70 90 (lose within 7 steps) 70 94 (lose within 13 steps) 70 97 (lose within 17 steps) 71 93 (lose within 9 steps) 72 30 (lose within 7 steps) 72 83 (lose within 13 steps) 72 88 (lose within 9 steps) 73 73 (lose within 15 steps) 74 33 (lose within 17 steps) 74 60 (lose within 3 steps) 74 66 (lose within 3 steps) 74 93 (lose within 11 steps) 75 30 (lose within 11 steps) 75 40 (lose within 13 steps) 75 50 (lose within 5 steps) 75 73 (lose within 7 steps) 76 10 (lose within 15 steps) 76 30 (lose within 13 steps) 76 31 (lose within 17 steps) 77 32 (lose within 5 steps) 77 33 (lose within 3 steps) 77 73 (lose within 15 steps) 77 80 (lose within 13 steps) 77 93 (lose within 9 steps) 80 11 (lose within 3 steps) 80 31 (lose within 9 steps) 80 41 (lose within 5 steps) 80 44 (lose within 7 steps) 80 50 (lose within 5 steps) 80 61 (lose within 13 steps) 80 64 (lose within 5 steps) 80 65 (lose within 7 steps) 80 66 (lose within 3 steps) 80 70 (lose within 11 steps) 80 73 (lose within 7 steps) 80 80 (lose within 3 steps) 80 81 (lose within 7 steps) 80 86 (lose within 7 steps) 80 88 (lose within 3 steps) 80 91 (lose within 15 steps) 80 93 (lose within 9 steps) 81 30 (lose within 15 steps) 81 90 (lose within 13 steps) 81 93 (lose within 17 steps) 82 22 (lose within 9 steps) 82 62 (lose within 7 steps) 82 82 (lose within 5 steps) 82 84 (lose within 7 steps) 82 88 (lose within 9 steps) 83 22 (lose within 9 steps) 83 70 (lose within 7 steps) 83 72 (lose within 13 steps) 84 20 (lose within 3 steps) 84 22 (lose within 3 steps) 84 42 (lose within 7 steps) 84 64 (lose within 9 steps) 84 66 (lose within 7 steps) 84 82 (lose within 9 steps) 84 92 (lose within 7 steps) 85 52 (lose within 7 steps) 85 82 (lose within 7 steps) 86 22 (lose within 7 steps) 86 40 (lose within 3 steps) 86 43 (lose within 7 steps) 86 44 (lose within 3 steps) 86 64 (lose within 9 steps) 86 82 (lose within 9 steps) 86 84 (lose within 7 steps) 87 20 (lose within 9 steps) 87 31 (lose within 11 steps) 87 32 (lose within 5 steps) 87 33 (lose within 11 steps) 87 43 (lose within 7 steps) 87 93 (lose within 17 steps) 88 22 (lose within 3 steps) 88 52 (lose within 7 steps) 88 72 (lose within 13 steps) 88 82 (lose within 5 steps) 90 30 (lose within 7 steps) 90 40 (lose within 3 steps) 90 44 (lose within 3 steps) 90 64 (lose within 7 steps) 90 65 (lose within 7 steps) 90 77 (lose within 17 steps) 90 83 (lose within 13 steps) 90 88 (lose within 9 steps) 90 90 (lose within 13 steps) 90 93 (lose within 17 steps) 91 91 (lose within 15 steps) 92 10 (lose within 13 steps) 92 70 (lose within 15 steps) 92 71 (lose within 17 steps) 93 71 (lose within 9 steps) 94 10 (lose within 7 steps) 94 61 (lose within 13 steps) 94 66 (lose within 9 steps) 95 10 (lose within 11 steps) 95 50 (lose within 5 steps) 95 80 (lose within 13 steps) 95 91 (lose within 7 steps) 96 11 (lose within 11 steps) 96 31 (lose within 17 steps) 96 40 (lose within 9 steps) 96 41 (lose within 5 steps) 96 71 (lose within 11 steps) 96 81 (lose within 7 steps) 97 31 (lose within 9 steps) 98 11 (lose within 17 steps) 98 20 (lose within 3 steps) 98 22 (lose within 3 steps) 98 31 (lose within 11 steps) 99 11 (lose within 3 steps) 99 31 (lose within 9 steps) 99 41 (lose within 5 steps) 99 60 (lose within 13 steps) 99 91 (lose within 15 steps)</p> <p>100001000100022000002000000000000102000000021210112202 000002000000001000000000000100000001000000001000001011 201022001000021100002020202120000221022120120000000212 000000000000000000000000000000000001000000001000000000 101000000100000000001000000100000001011101010000000010 001021000200022000000000000121201122100000201000000000 000001000000001000001000000100000101000000101000001111 000000000100001000000000000100000011000000100000000000 100000000100001000000000000100010010000000102000000000 212020002102021000001201222200001000020001021022001202 000000000000001000001000000000000001000000001000001001 001000000000000000001000100000000001000100000000000000 000000000100001000001000000100000000000001100000000000 001000000100000000001111101100000001000001001000000000 201002000100001121221000220200201001020020002200010000 000000000200001000000000000000000000000000001000000000 000001000000001000011000000000000001000010010000000000 002000000000001000000000000100000000000000000000000000 101000000000001000011000011000000000000000000000000000 000000000000001000010000000000000000000000000000000000 120022200111021001201000202020010022220002022000200001 000001000100010000000000000000000001000000001000100000 000000000101000000001000000000000001010000000000000000 000000000100000000000000000100000000000000000000000000 101000000101010000101010111000000001000101001000000000 000000000100011000110000000000000001000000001000000000 101001000101010000001000100000010001000100000000100000 102001022000102001002000002100200001001000020012000000 101001011000001000001001000000000000000000001011001000 100001000000000000001000000000000001001000010000000000 001001001100000001001000000100101011000000000000000000 000001000000000000001000000000000000000000000000000000 000001000000001000000000000000000002000000000000000000 000001010101001000001000000000000000000000000000000000 200001011000001000001001000000000000000000001000000000 021121212200221020000010202202000011020200022002010000 001000000000001000000010000000000001000000001000001000 001011000101000010001010000100000001010111010000000000 001010000100000000000000000101000000000000001000000000 001000000100000000001000000000000000010001000000000000 001010000100001010010000000100000000000000000000000000 001000000100000000000010100000000001000000000000000000 001001011000001000001000000000000000000000000000000000 001111000101000000001010000001000001010000001000000000 122020200220102100001100002100000000100000001200000000 111000000100000100001000000000000001000000001100010001 101000000010001000000000000000000001000100000000000000 100000000110001000000000000110010011100000101000000000 101000000000000000001100001100000000000000000000000000 100000000000001000002000000000000000000000000000000000 111000000110001000000000000000000000000000000000000000 111101110110101000000000000100000000000000000000000000 101000000000000000000000000000000000000000000000000000 111101000010001000000000000200000000000000000000000000 ```</p> <p>I didn't find any pattern appearing in these games. And it's obvious that most of the positions are stalemate. So to never lose the game of Chopsticks, your best bet would be to recite these tables.</p> <h1>Computers Beating Human at Chopsticks</h1> <p>Unfortunately, humans suck at this game since it takes almost zero effort for nowadays computers to recite those tables generated by the computers. So I decided to make computer to offer a friendly game to our human users. And I can guarantee that the computer will never lose the game since it can decide whether it will go first or the human player should go first.</p> <p>To become extra cunning, we make the computer pick a random move if there are several identical moves that are all optimal so that it will be harder for us humans to keep the stalemate status since we now have a better chance of making mistakes.</p> <p>```cpp typedef uniform<em>int</em>distribution<mt19937::result_type> RandomRange; mt19937 range;</p> <p>inline bool isAcceptable(int ax, int ay, int bx, int by, int move, Position nowStatus, int nowSteps) { if (makeMove(ax, ay, bx, by, move)) return false; auto newStatus = status[ax][ay][bx][by]; return newStatus == POSITION_LOSING &amp;&amp; nowSteps == steps[ax][ay][bx][by] + 1 || !newStatus &amp;&amp; !nowStatus; }</p> <p>inline bool userMovesFirst(int status) { switch (status) { case POSITION<em>WINNING: return false; case POSITION</em>LOSING: return true; default: return static_cast<bool>(RandomRange(0, 1)(range)); // whatever } }</p> <p>// Kindly offer a game to the user range.seed(random<em>device()()); int ax = 1, ay = 1, bx = 1, by = 1, move = -1, maxMoves; if (userMovesFirst(status[ax][ay][bx][by])) while (makeMove(ax, ay, bx, by, move)) { cout &lt;&lt; ax &lt;&lt; ay &lt;&lt; ' ' &lt;&lt; bx &lt;&lt; by &lt;&lt; ' '; cin >> move; } vector<int> moves(static</em>cast<size_t>(getMaxMoves(RULE<em>MOD - 1, 0))); while (ax &amp;&amp; bx) { auto nowStatus = status[ax][ay][bx][by]; int nowSteps = steps[ax][ay][bx][by]; assert(nowStatus != POSITION</em>LOSING); // there's no way I'm losing the game! no! for (move = 0, maxMoves = getMaxMoves(ax, ay), moves.clear(); move &lt;= maxMoves; ++move) if (isAcceptable(ax, ay, bx, by, move, nowStatus, nowSteps)) moves.push_back(move); assert(!moves.empty()); // I have to have a move! // pick a random move in order to prevent getting into a loop cout &lt;&lt; bx &lt;&lt; by &lt;&lt; ' ' &lt;&lt; ax &lt;&lt; ay &lt;&lt; ' ' &lt;&lt; (move = moves[RandomRange(0, moves.size() - 1)(range)]) &lt;&lt; endl; makeMove(ax, ay, bx, by, move); if (!(ax &amp;&amp; bx)) { cout &lt;&lt; ax &lt;&lt; ay &lt;&lt; ' ' &lt;&lt; bx &lt;&lt; by &lt;&lt; " YOU LOSE" &lt;&lt; endl; return 0; } move = -1; while (makeMove(ax, ay, bx, by, move)) { cout &lt;&lt; ax &lt;&lt; ay &lt;&lt; ' ' &lt;&lt; bx &lt;&lt; by &lt;&lt; ' '; cin >> move; } } cout &lt;&lt; bx &lt;&lt; by &lt;&lt; ' ' &lt;&lt; ax &lt;&lt; ay &lt;&lt; " YOU LOSE" &lt;&lt; endl; // you don't have a single chance :/ return 0; ```</p> <p>And here is the <a href="https://gist.github.com/Mygod/e296b1047858bf4724a2508733eefefe">complete source code</a>!</p> <h1>Other Explorations</h1> <p>Here's something I find using that source code. You can grab the code, mess with it and compile to discover other interesting results.</p> <ul> <li>The variant with &#92;(M = 2&#92;) is trivial because every move is identical to each other. The first player is bound to win the game, or lose the game in “Suicidal” variant;</li> <li>In the variant with &#92;(M = 3&#92;), the second player is bound to win within 6 steps, while the first player wins the game within 7 steps in “Suicidal” variant;</li> <li>However if you add “Splits” variant it will become stalemate; then after adding “Suicidal” variant the first player wins in 11 steps;</li> <li>If you add “Transfer” variant it will also become stalemate; adding “Suicidal” variant then makes the second player win in 4 steps;</li> <li>In the variant with &#92;(M = 4&#92;), the first player wins in 7 steps, wins in 9 steps in “Splits” variant, wins in 11 steps in “Transfer” variant; adding “Suicidal” variant to any of these will all change the status to stalemate;</li> <li>In the variant with &#92;(M = 5&#92;) or larger, the number of stalemate positions increases significantly; almost all initial positions &#92;( \left(1, 1, 1, 1\right) &#92;) are stalemate positions;</li> <li>These results seem to be in a chaos; I can't seem to find any pattern in these; humans are dumber than computers.</li> </ul> <h1>More Possible Explorations in the Future</h1> <p>Note: “in the Future” implies that it's not my business to explore these possibilities.</p> <ul> <li>What if martians who have &#92;(H&#92;) hands are going to play this game?</li> <li>What if &#92;(N&#92;) people play this game simutaneously?</li> <li>What if one can never move to a position that has appeared before (so that there is no longer any loop in the graph, thus no stalemate position is possible), and the player loses if he or she is out of available moves?</li> <li>What about other variants of this game? (personally I think other variants given in Wikipedia are all kinda boring)</li> </ul> https://en.mygod.be/blog/optimal-solution-for-chopsticks-leftovers-variant/ Tue, 19 Apr 2016 15:15:56 +0000 Windows 10 VS 512MB RAM https://en.mygod.be/blog/windows-10-vs-512mb-ram/ <p>tl;dr Microsoft's promise for the Windows 10 update is "no man left behind," but the truth is that Windows 10 really sucks at low-end PCs. You should consider installing XP or Linux on those ancient PCs.<!--more--></p> <h2>Introduction</h2> <p>According to <a href="http://www.gsmarena.com/leaked_windows_10_docs_detail_restrictions_for_512mb_devices-news-12413.php">some random website</a>...</p> <blockquote> <p>Microsoft's promise for the Windows 10 update is "no man left behind," but there was a suggestion that 512MB RAM devices may have limited functionality. Leaked guidelines detail just what kind of experience legacy devices can expect.</p> </blockquote> <p>However upon further inspection, that article is talking about Windows 10 Mobile. So how well does Windows 10 handle PC with 512MB RAM?</p> <p>Well apparently somebody has done that already...</p> <ul> <li><a href="https://youtu.be/JKClyvKgtBY">Windows 10 Technical Preview x64 on 512MB of RAM took 18 mins 4 secs to boot</a>, bravo;</li> <li><a href="http://www.techradar.com/news/software/operating-systems/you-don-t-need-a-crazy-powerful-pc-to-run-windows-10-here-s-the-proof-1288287">This guy also did a test</a> on Windows 10 32-bit but with a super lame CPU. And according to him, it's surprising nice to use but super slow to do any task.</li> </ul> <p>Recently I accidentally got my hands on a broken PC that is so ancient it's still running Windows XP. It can't connect to any wireless network for some unknown reason. However, <a href="https://www.microsoft.com/windows/en-us/xp/end-of-xp-support.aspx">Windows XP is no longer supported by Microsoft</a>. So why not give Windows 10 a spin then since Microsoft wants "no man left behind."</p> <h2>Installing Windows 10</h2> <p>After a quick search, apparently the official mirror will reject to install on a device that has less than 1GB RAM. (how picky!) So we need to bypass that.</p> <p><a href="http://www.techcular.com/install-windows-7-vista-server-2008-bypass-low-ram-limit/">Some random guy found out how to bypass that requirement under Windows 7 by patching <code>winsetup.dll</code></a>. Unfortunately, that patch doesn't seem to work for Windows 10. So we need a better approach.</p> <p>Here's the approach I've come up with which is really dumb.</p> <p>Step 1. Create a virtual machine with configurations resembling the actual machine, but with 1GB RAM.</p> <p>Step 2. Install that picky operating system onto the virtual machine.</p> <p>Step 3. When the installer prompt to restart, shut down the VM violently.</p> <p>Step 4. Add another HDD to the VM (and format it) and switch CD-ROM to an iso where we have Norton Ghost on it.</p> <p>Step 5. Copy the whole disk to the image on that HDD.</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/2016-02-10_132812.png~original" alt="Copying to gho..." /></p> <p>Step 6. Copy the image to the partition on that ancient device.</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_162046.jpg~original" alt="Copying to partition..." /></p> <p>Step 7. Reboot and voila!</p> <h2>First Boot</h2> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_163354.jpg~original" alt="Everything is going well" /></p> <p>After 16 minutes...</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_165010.jpg~original" alt="16 mins after" /></p> <p>Yay it worked! &#x1F44D;&#x1F44D;&#x1F44D;</p> <p>However I don't seem to be able to touch anything. Thanks Microsoft! &#x1F602;</p> <p>At the beginning I thought the computer is busy doing something since it has so small amount of RAM installed. But after a while (equals to 6 minutes) I realized this was some kind of glitch. I thrown my ~~fists~~ fingers onto the mouse, pressed Esc, Tab, Enter, Up Up Down Down Left Right Left Right B A... And maybe some part of this made the system functioning again. I was not sure what, but anyway it was a good thing.</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_165604.jpg~original" alt="Yay" /></p> <p>After finishing the setup, we were back to more waiting.</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_165639.jpg~original" alt="Configuration finished" /></p> <p>Crap the system rebooted. I hoped Windows 10 knowed what it was doing.</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_170018.jpg~original" alt="Apparently not" /></p> <p>Apparently not. 3 minutes later, I realized I had to do all the configurations again. I was hoping that the reason it rebooted is because it took me way too much time to figure out how to make the system function again. This time instead of waiting for a few minutes, I instantly took the try-everything approach and it worked! 2 minutes after this screen, I have made some progress!</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_170210.jpg~original" alt="Progress!" /></p> <p>After some quick configuration, we were back to even more waiting.</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_170318.jpg~original" alt="It says it won't take long" /></p> <p>It wouldn't take long. Sure.</p> <p>5 minutes later...</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_170708.jpg~original" alt="It says it's taking longer than usual, but it will be ready soon" /></p> <p>Surprisingly it knowed I was using a low-end PC because it seemed to be timing itself. Mildly interesting.</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_170914.jpg~original" alt="Another 2 mins later" /></p> <p>Another 2 minutes later, the system booted up and the cursor was working smoothly. I think I will will it as a 13-minute first boot. Not bad.</p> <h2>Using Windows 10</h2> <p>Welcome to the nightmare part! Almost the first thing I did after its first boot was to launch task manager and see how much RAM it had used. And it took quite a while to start up task manager.</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_171110.jpg~original" alt="91% RAM usage" /></p> <p>91%. That was a really bad sign. Actually everything was super slow. This thing was barely usable, even after I disabled Windows Defender, all the visual effects (except text anti-aliasing because I can't live without that) and stuff and installed all the latest updates.</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_174159.jpg~original" alt="Disabling everything" /> <img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160211_014142.jpg~original" alt="Still high memory usage" /></p> <p>By the way, Windows 10 doesn't even come with this thing's wireless card driver. So I had to connect an ethernet cable to my wireless adapter to get one from Windows Update. Mmpfft.</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_171709.jpg~original" alt="No Wi-Fi" /> <img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_174406.jpg~original" alt="Installing latest updates" /></p> <p>Oh and its battery was pretty terrible too. While I'm finding an ethernet cable for this thing, it exhausted its battery and shut down. &#x1F602;</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160210_173751.jpg~original" alt="Dead battery" /></p> <p>At last I had to give up because it was barely usable. Considering my grandparents would never learn how to use Linux, I just found a random ghost image with Windows XP with SP3 on it and flashed it. The wireless network worked again and now everyone is happy.</p> <p><img src="https://i1264.photobucket.com/albums/jj483/MygodStudio/Blog/IMG_20160211_165615.jpg~original" alt="Everyone is happy" /></p> <h2>Conclusion</h2> <p>After reinstalling new OSs over and over, I'm gradually getting sick of this boring process. However installing a Windows 10 on a crappy low-end PC is extremely fun to me, except the last part where everything was super laggy.</p> <p>So what have we learned from these?</p> <ul> <li>Microsoft might care about 512MB-RAM phones, but gives no fucks about 512MB-RAM PCs. Thanks Microsoft!</li> <li>Unluckily, Windows XP and Linux are the only choices for low-end antiques.</li> <li>...</li> <li>I don't know. What else have you learned?</li> </ul> <p>For those of you who stick to the end of this blog, here's <a href="https://win95.ajf.me">a bonus for you</a> where you can try out Windows 95 in your browser! Btw sorry for the crappy images. I'm just really lazy to take a screenshot.</p> https://en.mygod.be/blog/windows-10-vs-512mb-ram/ Fri, 12 Feb 2016 22:46:23 +0000 Games I Love https://en.mygod.be/blog/recommended-games/ <p>I used to recommend 5 games for a month. I had done that several times over the 2.5 years and to be honest I think the quality of the games I recommend is declining. And now that the old blog is dead, it's time we try out a different approach.</p> <p>I've compiled <a href="https://gist.github.com/Mygod/7565dfb65c1dd3542203">a list of games that I personally like on GitHub Gist</a> that I'll update from time to time.<!--more--> You would probably find no action/FPS games on my list because I'm just simply suck at those games where you need to have good techniques and stuff.</p> <p>The ones in the beginning are the ones I've played and I think I would have played again if I had infinite time. These are the ones you should most probably check out if you don't have enough time.</p> <p>If you are super bored and just trying to find some good games to kill time and you have played every single game in the first list, see the "More" section in the list. These probably aren't as good as the ones in the previous list in my humble opinion but they are still good enough to be worth your time.</p> <p>I'll update the list whenever I find a great new game or I find an old game isn't as great as I used to think it is. But for now, enjoy the list. :-)</p> <p>By the way, I just added some music (powered by Spotify) that I personally like to my blog so that you will have something to listen to while browsing my boring blog. Enjoy. :-D</p> https://en.mygod.be/blog/recommended-games/ Fri, 12 Feb 2016 19:54:49 +0000 Mygod Ivory Tower™ has now moved to the main site! https://en.mygod.be/blog/moved-to-main-site/ <p>Hey folks! In case you haven't read it in the title:</p> <blockquote> <p>Mygod Ivory Tower™ has now moved to the main site!<!--more--></p> </blockquote> <p><a href="http://blog.mygod.tk">The old site (in Chinese only)</a> hosted by <a href="http://vhostfull.com">V Host Full</a> is still open for now but probably won't last long. As soon as this old thing ran out of fuel it will stop servicing. Those content will NOT be migrated to this new blog because it's just too much hassle. So HURRY UP! If you want to grab anything on that site, GRAB NOOOW!</p> <p>The content in this new site is completely written in Markdown with help of <a href="https://github.com/chjj/marked">marked</a> and <a href="https://github.com/PrismJS/prism">Prism</a>. You can view page source to check out those lovely creatures. The article catalog is maintained using JSON.</p> <p><code>javascript { "current-entry": "moved-to-main-site" }</code></p> <p>Have fun on the new site and also check out the old site if you'd like to.</p> https://en.mygod.be/blog/moved-to-main-site/ Mon, 27 Jul 2015 08:00:00 +0000