This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const flatMap = (fn, stream, resultSelector) => | |
stream.flatMap((x, xi) => fn(x).map((y, yi) => resultSelector(x, y, xi, yi))); | |
const flatMapLatest = (fn, stream) => | |
stream.publish(s => s.flatMap(v => fn(v).takeUntil(s))); | |
const flatMapLatest = (fn, stream, resultSelector) => stream.publish(s => { | |
return s.flatMap(v => fn(v), resultSelector).takeUntil(s)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config.js | |
export.ranked = getConfigObject(true); | |
export.unranked = getConfigObject(false); | |
function getConfigObject(isRanked) { | |
return { | |
boardsize: checkBoardSetting(getRuSetting(arv["boardsize"], isRanked) | |
komi: checkSetting(getRuSetting(arv["komi"], isRanked) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
'use strict'; | |
process.title = 'gtp2ogs'; | |
let DEBUG = false; | |
let PERSIST = false; | |
let KGSTIME = false; | |
let NOCLOCK = false; | |
let GREETING = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var matches = 0; | |
// 'Borrowed' from http://www.math.ucla.edu/~tom/distributions/binomial.html | |
function LogGamma(Z) { | |
var S=1+76.18009173/Z-86.50532033/(Z+1)+24.01409822/(Z+2)-1.231739516/(Z+3)+.00120858003/(Z+4)-.00000536382/(Z+5); | |
var LG= (Z-.5)*Math.log(Z+4.5)-(Z+4.5)+Math.log(S*2.50662827465); | |
return LG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var matches = 0; | |
function LL (x) { | |
return 1/(1+Math.pow(10,(-x/400))); | |
} | |
function LLR(W, L, elo0, elo1) { | |
//if (W==0 || L==0) return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function LL (x) { | |
return 1/(1+10**(-x/400)); | |
} | |
function LLR(W, L, elo0, elo1) { | |
//if (W==0 || L==0) return 0; | |
if (!W) W=1; | |
if (!L) L=1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class GroupCache<TSource, TKey> : IConnectableObservable<TSource> | |
{ | |
private IConnectableObservable<TSource> _souce; | |
private IObservable<TSource> _souceGrouped; | |
public GroupCache(IObservable<TSource> source, Func<TSource, TKey> keySelector) | |
{ | |
_souce = source.Publish(); | |
var sub = new ReplaySubject<IObservable<TSource>>(); | |
_souce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Extended { | |
public static IObservable<TSource> Amb<TSource>(this IObservable<IObservable<TSource>> source) { | |
return Observable.Create<TSource>(o => { | |
int first = -1; | |
return source.TakeWhile(_ => first == -1) | |
.Select((el, c) => el | |
.DoFirst(1, _ => Interlocked.CompareExchange(ref first, c, -1)) | |
.TakeWhile(_ => first == c)) | |
.Merge().Subscribe(o); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var source$ = Rx.Observable.marble("1--23--456--7890--"); | |
var enter$ = Rx.Observable.marble("-e-----e----------"); | |
var exit$ = Rx.Observable.marble("---x-------x------"); | |
var sampler$ = Rx.Observable.marble("a--b--c--d--e--f--"); | |
var full$ = Rx.Observable.marble("01234567890abcdefg"); | |
source$.draw('source', '#container') | |
.debounceTime(1050).draw('debounceTime(1)', '#container'); | |
source$.auditTime(1050).draw('auditTime(1)', '#container'); | |
source$.throttleTime(1050).draw('throttleTime(1)', '#container'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package RxTest.RxTest; | |
import java.io.IOException; | |
import java.util.concurrent.TimeUnit; | |
import rx.Notification; | |
import rx.Observable; | |
import rx.functions.Action1; | |
import rx.functions.Func1; |
NewerOlder