Saturday, February 9, 2013

Up Goer Five

I suffered at its hands, anything more to say?


'Singapore' is a small state city at an end of 'Asia', which is a really big piece of land. Actually, 'Asia' is the biggest land in this world.

Although 'Singapore' is so small, it is a very interesting place with many different things to do. One of these things to do is to eat many different kinds of food. Because of the many different kinds of people living in one small state, they usually change each other in small ways, and one of the changes is in the way we make our food. Because the set of people can't be exactly found in another place, the food that we make can't be exactly found in another place as well. People who live in 'Singapore' think that food is one of the things that make it a better place to live in.

Another thing good about 'Singapore' is the green all around us: leaves on trees, leaves coming straight from the ground. The green is all around, no matter where you go. All this is part of a plan to make it a "Clean and Green" place to live in.

However, all these are just about things that we can see and touch. There is more to the city state than all these; there are some things that you can't see, hear or touch, no matter how hard you try, like the state of being happy or sad. There is a sense that people living there are all the same in some areas, like having the same past. I think it goes past that, and most people who live there also have the same dream. As such, they work together to make the dream come true. This is shown by having a set of words people accept as true and so say it together, and it is called the 'Pledge'. What it says is something like:
We live in 'Singapore'. We will be one people, no matter our race, our tongue or our gods. We will build a 'Singapore' that gives all the people the same power to give power to other people who will have power and work for them. It will give everyone the same start, and it will be just, so as to make the people happy, well off, and be able to move on.

Needless to say, I scammed, not just with the '' syntax, I believe that's fine because I explained the terms within, but the true scam was with the different senses of the word. Eg. Leaves and Just.

Friday, January 11, 2013

Uncertainty

This blog post is just a poke at the uncertainty theory learnt in school, so...

Student A is a studious physics student, and thinks about physics even after school (shock!). In fact, the very moment he noticed that there was a newly installed solar panel installed at the side of the hill near his home, he decided that it would be great to calculate its power output, and put his knowledge of uncertainties to the test as well!

Via a protractor-bob improvisation, he manages to guess the slope of the solar panel via triangulation. However, as he is lazy to climb the hill, the way he derives the length of the solar panel is via subtracting the height of the lower edge of the panel from the height of the top (using a map to measure the distance from his house to the panel). As a result, the uncertainties are not exactly small, and he estimates the length of the (square) solar panel at 12 meters plus or minus 5 meters.

Using that value, he calculates the area of the solar panel.

Following that, he realises that the amount of sunlight received is somewhat unknown to him, due to poor geographic knowledge of his own surroundings. As such, he decides that the intensity of sunlight would nominally be pegged at 1000W/m^2, give or take 100W/m^2.

Lastly, he realises that he does not know the efficiency of the solar panel. Through internet research, he pegs it at 15% plus or minus 3% (i.e. 12% to 18%).

Finally, he computes his answer, and is feeling extremely satisfied with himself... until he calculates the uncertainty. He then concludes that he made a mistake somewhere in his calculations and goes back to clearing his usual piles of homework.

Friday, January 4, 2013

Valuations in Chess Speed (Where 'Speed Chess' barely does justice to the speed)

After a hiberation, a slumber, a hiatus, a timeless lullaby,
Bright sparks flew, entropy increased, and chaos streaked the sky;
This poem heralding the surreptitious reanimation of chess on this blog is brought to a rhymeless, rhythmless end upon the author realising how meaningless it might get if he tried to keep it up.

     Anyway... this blog post seeks to describe the valuation of pieces in bullet chess, described in the title as Chess Speed (no, Speed Chess doesn't do enough glory to the speed in it; it's like calling Chicken Chops Chops Chicken: just getting the order of importance wrong in the particular context).



     Firstly, let us talk about how computers evaluate a position. Rybka pseudo-famously evaluated position X as +1.47. What does this mean? It means that Rybka believes that objectively, there is an advantage due (by convention it is in general...) White worth the equivalent of 1.47 pawns randomly thrown onto the board in a generic otherwise equal position. Messy? Not quite. Unintuitive about the 0.47 pawns hanging in limbo? Perhaps. A third question necessary to complete the triad? (What was the word again??) Definitely not.

     And what might the significance of such a wispy number detailing non-integer, but nevertheless rational approximations of expected multiples of quantum superpositions of pawns on arbitrary expectations of generic boards be? (Note: expression might not make complete sense) Well, to me, the main significance, and the reason why we find joy and pride in the construction of a program able to derive the aforesaid wispy number from an arbitrarily set up board, is that it can be easily interpreted, with a simple function, the probability the said position is winning for White (or Black).

     If my memory serves, and as I remember it does, a +1 evaluation on Rybka means that on average, Rybka has a 95% chance of winning the position against perfect non-antagonistic play. So let's use half that yardstick, and declare a statistical +1 to be vaguely equal to that which gives me the same probability of winning as that closed integral up till 1 standard deviation after the mean of a normal distribution. Basically an arbitrarily, unnecessarily complicated definition of an imprecise yardstick, because. Ah well, this is an inexact science after all riiight?

     So to start of with a simpler to understand idea, I am playing at approximately a 1450 playing strength according to the chess.com bullet rating, which is rather inflated at lower levels I believe. As a yardstick, I believe that when playing opponents of slightly weaker strength (circa 1350), I tend to hang a piece for absolutely no reason about 1 in 3 matches, counting mostly those I notice after browsing through the match afterward.

     Hence, it may come as no surprise that I estimate that for me, a knight or a bishop can be evaluated, in the abovementioned badly designed scale, to be a +0.5. That means, if I am up a bishop or a knight for nothing, I am expected to get about 0.69 points from the match... against an opponent of my playing strength.

     Time to bring out the table of values... (justification later)

Knight -- 0.5
Bishop -- 0.6 early game, 0.4 if diagonal is blocked by pawns, 0.5 in general
Pawn -- 0.2 in early game, 0.15 in mid game 0.25 in endgame
Rook -- +0.7 if won, -0.4 if lost in early game and 0.7 otherwise
Queen -- 1.5 until mid game, 1.2 in endgame.
Doubled pawns -- -0.05
Passed pawn -- 0.2+0.4/(5-turns to promote) in early to mid game, and pretty much unfixed in endgame
Kingdrift -- Hard to evaluate. Quite a lot.
Pawn towards center -- 0.06 per square
(total value of your remaining) Time -- -30/(seconds remaining)

     Attack is important. Most chess instructional manuals will tell you that, but in bullet chess, it is important both objectively as well as psychologically. We all know that one failed step in attacking may lose you the game, but it probably isn't until about 15 moves later when being down a queen really starts to make its full impact felt. That could take 10 seconds, or 17% of the game time (rounded up in full bias). On the other hand, a blunder allowing a mate in 1 could end in well... 1 move. By contrast, blundering in a defensive position feels a lot worse. People tend to be tempted into trying harder not to blunder in such situations, and hence play more passively and more slowly. Big exploit there. Hence, in general do try to attack, and try to make the attack last. Seek not to sac unsoundly and expend all your material *just* to drain 30 seconds of your opponent's time. 30 seconds is a lot to kill with when you are up a queen, 2 rooks and 2 minor pieces.

     Knights are sneaky. However, they are relatively equally sneaky throughout the game, awarding them 0.5.

     Bishops make your opponents feel insecure if you point them at your opponent's king, preferably with 2, so it's harder to clog both colours with pawn chains. As a crucial part of my playing psychology, I fully recommend it. However, bishops aren't as sneaky in endgames, so they tend to lose a little bit of value in endgames.

     Being up a pawn is important in the opening, both to make sure your opponent thinks that objectively he might actually be losing, and to possibly control 2 squares (preferably in the center). This 2 randomly chosen squares, if properly centralised, can mess your opponent's favourite developing squares with happiness-inducing probabilities.

     Rooks. I don't like using them in the mid game (hard to get out sometimes), and when I lose them it tends to mean that my opponent has just moved a knight about 5 steps before sending it into a corner. On average, this means my pieces are sufficiently more active than his to ensure good counterplay... on the KINGside. Also, it is arguably the most straightforward piece in game, in a game where confusion plays a huge part. *pause* But in an endgame it helps greatly to have your rook still in existence. Ah well...

     Queens are awesome. They are the easiest way to bruteforce out a mate in early to mid game. Without a queen it tends to be a lot harder and opponents unafraid. So even if it in actuality is useless in your lines to get out a blundered mate, do consider keeping it safe and aggressive-looking. They are rather straightforward in the endgame as well, in the sense that they are harder to use in the probably 15 seconds left than to defend against (probabilistically).

     Doubled pawns. A small liability. In case you Do get into an endgame.

     Centralisation of pawns: see argument about accidentally controlling key squares in the center.

     Passed pawns: the kind of pawns that can sneakily move up the board VERY VERY fast (since it's a fast game) and hence catch your opponent rather unawares. Works a surprising portion of the time, and it functions as if your opponent has a second king. Many players treat a queening like an immediate lost, and will take very definitive actions to stop it. Use this to drain time severely and get a strong endgame advantage, even if it means losing the pawn eventually.

     Finally, time, the ultimate killer, has an evaluation that doesn't need explanation. With this, I end my blogpost and wish everybody enough sense not to believe what I just wrote.

P.S.: It isn't Cohm-pleet nonsense. Much of it works in low-level practical play! To the best of my knowledge anyway.

   

Wednesday, January 2, 2013

A few mysterious definitions

Ch: English dialect for I
Chop: A downward cutting blow or motion, typically with the hand
Ho: A derogatory term for a woman/ imitation or representation of the sound of a deep laugh
Hop: Jump on one foot
Hops: 3rd person singular present tense of hop
Op: Operation
Ops: Operations

This is of course, very definitely not a representation or foreshadowing of things to come.

Sunday, November 25, 2012

Question! (And answer)

Notation:

!=     ------------>     not equal to (a relic from C++)
iff     ------------->     if and only if
||     ------>     modulus; the absolute value of.
-1     ------------>     This was supposed to be in superscript, but I can't find the how to make them appear.  Also used for footnotes.


Question:

Does there exist a function f(x) mapping from rational numbers to positive integers such that:
(1) f(x)=f(y) iff x=y
(2) For any given real R, there exists a rational number x such that e>|R-x|*f(x) for any e>0.

Notes about question:
1) Criteria (1) for f is basically constructing an ordering of the rational numbers.
2) It is relatively simple to construct an ordering of the rational numbers such that (2) is heuristically "probably true", but this is vague to define and prove. This is because for any e, the "area", including overlaps, containing the set of reals between x-e*f(x) and x+ e*f(x) goes to infinity as long as we have solutions for f(x)=N for any positive integer N.
(See http://en.wikipedia.org/wiki/Harmonic_series_(mathematics) .)



Solution:

Lemma 1: The above question is equivalent to the following question:


     Does there exist a function f(x) mapping from rational numbers in [0,1) to positive integers such that:
     (1) f(x)=f(y) iff x=y
     (2') For any given real R in [0,1), there exists a rational number x such that e>|R-x|*f(x) for any e>0.

Let f1 be one such function that satisfies (1) and (2') and in particular has an inverse 1.
Let f2(x-1) = f1(x), f3(x+1) = f1(x),
      f4(x-2) = f1(x), f5(x+2) = f1(x),
      ...etc.

Now we construct a function g(x) that also maps from rational numbers to positive integers, where g(x) is defined as follows:


f1-1(x) = g-1(2x-1)
f2-1(x) = g-1(4x-2)
f3-1(x) = g-1(8x-4)
and in general:
fk-1(x) = g-1(2^k * x - 2^(k-1)) for all values of x and k.

We notice that g-1(x) is taken from f1-1 if x=1 (mod 2), f2-1 if x=2(mod 4), etc., so g-1(x) is uniquely defined for all x.

Then g(x) satisfies conditions (1) and (2). 2

Using lemma 1, all that's left to do is construct one such f1.
This can be done as follows:

Construct a function h that maps from positive integers to rational numbers, where h(1), h(2), h(3),... are
-42, 0,     0, 1/2,     0, 1/2, 2/8, 3/8,     8/16, 9/16, 10/16, 11/16, 12/16, 13/16, 14/16, 15/16,     ...


Specifically, h(1) = -42 3, h(2) = 0+0*(1-0),

h(3) = 0+0*(1/2-0), h(4) = 0+1*(1/2-0), h(x)= 1/2+(x-5)*(1-1/2) for 5<=x<=8,

h(x)= 0+ (x-9) * (1/4-0) for 9<=x<=16, h(x)= 1/4+ (x-17) * (2/4-1/4) for 17<=x<=32,

... for 65<=x<=128,

h(x)= 0+ (x-129)* (1/8-0) for 129<=x<=256, ... etc.


where the underlining separates the definition of functions into recognizable groups. Furthermore, within each group as partitioned by the underlining, it is possible to bound the maximum |R-x|*h-1(x) by half. 4

f1-1 can be generated by taking the next nonrepeated term in the sequence of h(1), h(2),... etc.



That this is a valid assumption (because it relaxes the conditions) is left as an exercise to the reader.
2 Again left to an exercise for the reader. It's quite evident, but horrid to type out.
3 A null element for the sake of a convenient proof.
4 This is left as an exercise to the reader as well... nah just kidding, will hopefully post a somewhat rigorously written (and readable) proof at a later date.

Edit: A final note... it was a lot more readable from the luxury of a wide page, so perhaps one should try pasting it onto notepad with wordwrap.

Saturday, November 24, 2012

Technical framework up

  Good day.

  Today, I am proudly presenting... nothing!... since this marks the start of the making of the simulation game. As for names, there hasn't been any good ones coming to mind yet, so for now I shall just summon my powers to connect random words and call this game... BalalaikaOpus! (BO for short).

  As of now, there is currently no world to live in, but nevertheless, the npcs have been created and are currently paddling through space, and been given stats (Athleticism, Age, Creativity, Deftness, Learning, Resilience for now). Mindsets have also been implemented, for now j perseverance and morality. Some skills have also been implemented: Walking (What a undervalued skill!), Running (just for the sake of juxtaposition), Cooking, Painting, Fighting and Life Experience (for whatever can't quite fit... stone-skipping skills anyone?). As can be seen, most of such skills are broad, and hence implementation has been done on the basis of possible future subskills, e.g. cooking.baking.

  The difference for classification into stats, mindsets and skills is basically to make the concept clearer, since although the variables are be treated as equal, the way the variables behave are fundamentally different. Stats in general do not change (age aside), mindsets change slowly, and skills change quickly. Moreover, skills do not decrease, while external interaction can, and likely will change mindsets. Also, while skills have dependencies on stats, mindsets do not, and as for individual actions taken, they will be based off mindsets and skills solely (with stats only being indirectly involved).

  Each npc is planned to have a set of stats, skills and mindsets, although if the skillset gets too large and that creates a problem for computer memory, some of those might have to be ignored and estimated based on situational need (e.g. pancake flipping skills, while not implemented, is likely to be related to the cooking skill).

  P.S. I forgot to mention the inclusion of goals, which are objectives an npc tries to pursue. For now, there is wealth, attention and fame.

  Coming up: Planned vague goals, to account for unconventional objectives, such as promoting the joy of eating chocolate. Such goals will be given just an ID, instead of a name, and are set to be randomly generated by the computer.

Monday, November 19, 2012

Simulation of a society

Fact:  I enjoyed Roller Coaster Tycoon immensely (the original version, created 1999). Parts of what I enjoyed about it were the simplicity of design, together with the "interesting" details microscopically (such as when you observed a single guest) and macroscopically (while managing the entire theme park).

  As such, I have on different occasions thought of how a simulation of a society (in the sense of a group of people, probably isolated, living together) would function.

  I imagined it being a wonderful simulation (my ideal), where one got to observed the macroscopic panorama of the layout of the structures sprawled over space, as well as the individual simulated citizens going about their daily lives. It would also include the intrinsic concept of progress, since it is the basis for many games, whether RPG, Sim, strategy or shooter. This would come in both microscopic and macroscopic forms, respectively being the way an individual pursues his or her goals, and achieves (or doesn't achieve) them eventually, and the way a society progresses over time, with definite short-term direction but not necessarily with a fixed long-term route to follow.

  As such, I have planned to pen down (and give a structure to... concretise?) the ideas for a sim (i.e. those that I remember at the time of writing). This is again a short-term direction, and may (and probably will) suffer from the lack of follow-up.

  In the next post of this series (if it exists) I shall cover various (at least one) specific aspect of the sim of my imagination, probably written in the form of a design note (design notes are awesome!)