Skip to content

Instantly share code, notes, and snippets.

View prendradjaja's full-sized avatar

Pandu Rendradjaja prendradjaja

View GitHub Profile
(;GM[1]FF[4]CA[UTF-8]AP[CGoban:3]ST[2]
RU[Chinese]SZ[19]KM[7.50]TM[7200]OT[3x60 byo-yomi]
PW[Lee Sedol]PB[AlphaGo]WR[9p]DT[2016-03-13]C[Game 4 - Endurance
Commentary by Fan Hui 2p
Expert Go analysis by Gu Li 9p and Zhou Ruiyang 9p
Translated by Lucas Baker, Thomas Hubert, and Thore Graepel
When I arrived in the playing room on the morning of the fourth game, everyone appeared more relaxed than before. Whatever happened today, the match had already been decided. Nonetheless, there were still two games to play, and a true professional like Lee must give his all each time he sits down at the board.
(;EV[28th Kisei Title]RO[3]PB[Hane Naoki]BR[9p, Tengen]PW[Yamashita Keigo]WR[9p, Kisei]KM[6.5]RE[B+3.5]DT[2004-02-04,05]PC[Mie]AP[Sabaki:0.52.2]CA[UTF-8];B[qd];W[dd];B[pp];W[dq];B[oc];W[ck];B[pj];W[nq];B[kp];W[oo];B[op];W[np];B[no];W[lp];B[nn];W[lo];B[kq];W[lq];B[fq];W[hp];B[fo];W[do];B[ko];W[kn];B[io];W[pn];B[pr];W[pl];B[nl];W[ok];B[mk];W[oj];B[kr];W[lm];B[kk];W[im];B[ho];W[qo];B[qp];W[rp];B[po];W[on];B[om];W[ro];B[pm];W[qn];B[rq];W[qm];B[rr];W[ph];B[ik];W[hl];B[hk];W[fl];B[dn];W[eo];B[en];W[lj];B[lk];W[fn];B[fm];W[jl];B[jm];W[jn];B[il];W[jk];B[jj];W[km];B[kj];W[gn];B[hn];W[hm];B[gm];W[ij];B[cn];W[ii];B[kh];W[bp];B[gj];W[gl];B[go];W[jh];B[kg];W[fh];B[ej];W[gi];B[kl];W[jm];B[fi];W[eh];B[bo];W[er];B[bq];W[br];B[cd];W[dl];B[dc];W[ec];B[cc];W[kd];B[ar];W[cq];B[ap];W[aq];B[hi];W[gh];B[bq];W[fr];B[gr];W[aq];B[ih];W[hh];B[ig];W[gk];B[ji];W[hj];B[bq];W[hr];B[gq];W[aq];B[pi];W[oi];B[bq];W[jf];B[jg];W[aq];B[qh];W[ao];B[pg];W[oh];B[rk];W[qk];B[rl];W[rj];B[qj];W[ri];B[qi];W[rm];B[rh];W[ql];B[si];W[og];B[pf];W[ne];B[mc];
@prendradjaja
prendradjaja / readme.md
Last active September 5, 2024 00:38
type and interface in typescript

IMO the right question is "Why do both type and interface exist?"

You already know why interface exists -- so you can define an object type by naming its properties e.g.

interface Point {
    x: number;
    y: number;
}
@prendradjaja
prendradjaja / _readme.md
Last active August 8, 2024 03:18
Remove element in-place

https://leetcode.com/problems/remove-element/description/

This was interesting: I made this problem a lot harder by trying to move the "to remove" elements to the end instead of moving the "to keep" elements to the beginning.

I found my idea hard to implement iteratively, and I had to switch to recursion to get it working. After that, I was able to convert my solution to iterative -- but it would've been pretty hard to implement this approach iteratively from the start!

Guards

main = do
  print $ mySignum (-2)
  print $ mySignum 0
  print $ mySignum 2

mySignum n
  | n < 0 = -1
 | n &gt; 0 = 1
@prendradjaja
prendradjaja / tables.txt
Created March 31, 2023 17:00
How precise is the Fibonacci distances trick?
km | mi (est.) | mi (act.) | error
-----------------------------------
1 | 1 | 0.62 | 60.9%
2 | 1 | 1.24 | -19.5%
3 | 2 | 1.86 | 7.3%
5 | 3 | 3.11 | -3.4%
8 | 5 | 4.97 | 0.6%
13 | 8 | 8.08 | -1.0%
21 | 13 | 13.05 | -0.4%
34 | 21 | 21.13 | -0.6%
import re
def sscanf(s, fmt):
'''
Parses the string against the given template, returning the values of the
slots. If no match, return None.
The string must be a full match (like re.fullmatch()).
class Draggable {
private element: HTMLElement;
private currentDrag: undefined | {
initialMouseX: number,
initialMouseY: number,
initialElementX: number,
initialElementY: number,
removeListeners: () => void,
};