Skip to content

Instantly share code, notes, and snippets.

View wand125's full-sized avatar

Hiroaki Hosono wand125

View GitHub Profile
const { WholeHistoryRating } = require('whr')
const AllData = require("./alldata")
const whr = new WholeHistoryRating({w2: 4});
const firstDate = new Date(1953, 9, 19);
const names = {};
const beginTime = new Date();
console.error(`${AllData.length} records`);
AllData.forEach((e, i) => {
const dateArr = e.date.split('-').map(e=>parseInt(e));
@wand125
wand125 / rating-simulator.py
Created June 28, 2017 10:16
Tournament Rating Simulator
import math
import argparse
def calc_win_rate(a,b):
return (1.0 / (math.pow(10,(a-b) / -400) + 1))
def calc_win_rate_final(a,b):
p = calc_win_rate(a,b)
return p * p * p + 3 * p * p * (1-p)
@wand125
wand125 / brabio_format.json
Last active April 20, 2017 06:40
brabio to json format
{
"company_name": "company_name",
"modified_at": "YYYY-MM-DDThh:mm:ss+09:00",
"project": {
"name": "project_name",
"id": "",
"members": [
"name1",
"name2",
],
@wand125
wand125 / direction.cc
Last active August 29, 2015 14:11
Direction
/*
* ゲーム内の方向を表すコードの一部
*/
enum Direction {
kRight,
kUp,
kLeft,
kDown,
kDirectionCount
@wand125
wand125 / PKU1146.cpp
Last active August 29, 2015 14:09
PKU1146.cpp
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
int main(){
vector<int>kazu;
vector<int>kouhan;
int end=0;
@wand125
wand125 / PKU1517
Created November 16, 2014 17:25
PKU1517.cpp
#include <cstdio>
using namespace std;
int main(){
printf("n e\n");
printf("- -----------\n");
printf("0 1.000000000\n");
printf("1 2.000000000\n");
printf("2 2.500000000\n");
cards = [[1,2,3,4],[1,5,6,7],[1,8,9,10],[1,11,12,13],[2,5,8,11],[2,6,9,12],[2,7,10,13],[3,5,9,13],[3,6,10,11],[3,7,8,12],[4,5,10,12],[4,6,8,13],[4,7,9,11]]
num = [1..13].map((a) -> [a,Math.random()]).sort((a,b) -> a[1]-b[1]).map((a) -> a[0])
cards[index] = card.map((a) -> num[a-1]).map((a) -> [a,Math.random()]).sort((a,b) -> a[1]-b[1]).map((a) -> a[0]) for card,index in cards
cards = cards.map((a) -> [a,Math.random()]).sort((a,b) -> a[1]-b[1]).map((a) -> a[0])
console.log card for card in cards
problem = "For theNumber in 0 to 100, if theNumber is divisible by 3 and theNumber is divisible by 5 then print 'FizzBuzz' else if theNumber is divisible by 3 then print 'Fizz' else if theNumber is divisible by 5 then print 'Buzz' else print theNumber.";
eval(problem.replace(/\./g,'').replace(/For (.*) in (\d+) to (\d+),/g,'for($1=$2;$1<=$3;$1++)').replace(/if (.+?) then/g,'if ($1)').replace(/print ([\w']+)/g,'console.log($1);').replace(/and/g,'&&').replace(/is divisible by (\d+)/g,'%$1==0'));