Skip to content

Instantly share code, notes, and snippets.

View BlueRayi's full-sized avatar

ブルーレヰ BlueRayi

View GitHub Profile
@BlueRayi
BlueRayi / Rational.swift
Created September 10, 2018 11:26
有理数構造体(貧弱)
prefix operator /
public prefix func +(rhs: Rational) -> Rational // これいる?
{
return Rational(rhs.pee, rhs.cue)
}
public prefix func -(rhs: Rational) -> Rational // 反数
{
return Rational(-rhs.pee, rhs.cue)
}
@BlueRayi
BlueRayi / Complex.swift
Last active September 11, 2018 11:41
拡張複素数構造体(貧弱)
// Neary equal needs this value
fileprivate let ALLOEABLE_ERROR = 1e-12
// Custom operators
prefix operator /
infix operator **: MultiplicationPrecedence
// <Extentions for using float easily>
// Reciprocal
@BlueRayi
BlueRayi / game_simulation.py
Created October 11, 2019 04:48
ゲームのシミュレーション
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import random
from pathlib import Path
@BlueRayi
BlueRayi / simulation_result.csv
Created October 11, 2019 04:50
シミュレーション結果
index Match 1 Winner Match 1 Loser Match 2 Winner Match 2 Loser Match 3 Winner Match 3 Loser Match 4 Winner Match 4 Loser
1 Emu Parado Taiga Hiiro Niko Poppy Kiriya Kuroto
2 Emu Kuroto Poppy Hiiro Kiriya Taiga Niko Parado
3 Emu Niko Kiriya Kuroto Hiiro Poppy Parado Taiga
4 Parado Poppy Emu Taiga Niko Kuroto Hiiro Kiriya
5 Niko Poppy Hiiro Kiriya Taiga Kuroto Parado Emu
6 Emu Hiiro Poppy Kuroto Taiga Kiriya Niko Parado
7 Niko Hiiro Emu Parado Kiriya Kuroto Taiga Poppy
8 Emu Niko Parado Hiiro Taiga Kiriya Kuroto Poppy
9 Parado Kuroto Emu Kiriya Niko Hiiro Taiga Poppy
@BlueRayi
BlueRayi / fit_by_elo.py
Created October 11, 2019 04:52
Elo によるフィッティング
#!/usr/bin/env python
# coding: utf-8
# In[1]:
from pathlib import Path
# In[2]:
@BlueRayi
BlueRayi / fit_by_trueskill.py
Created October 11, 2019 04:53
TrueSkill によるフィッティング
#!/usr/bin/env python
# coding: utf-8
# In[1]:
from pathlib import Path
# In[2]:
@BlueRayi
BlueRayi / npb_data_2019.csv
Created October 11, 2019 04:54
2019 年度 NPB 公式戦勝敗表
index home hscore vscore visitor
0 BayStars 8 1 Dragons
1 Tigers 2 1 Swallows
2 Carp 5 0 Giants
3 Fighters 7 3 Buffaloes
4 Marines 5 4 Eagles
5 Hawks 5 4 Lions
6 BayStars 1 9 Dragons
7 Tigers 1 0 Swallows
8 Carp 2 5 Giants
@BlueRayi
BlueRayi / rate_npb.py
Created October 11, 2019 04:55
NPB の TrueSkill によるレーティング
#!/usr/bin/env python
# coding: utf-8
# In[47]:
import itertools
import math
from pathlib import Path
@BlueRayi
BlueRayi / draw.csv
Created October 11, 2019 04:56
NPB 年度別引き分け数
year game draw
2016 858 18
2017 858 16
2018 858 16
2019 858 22
@BlueRayi
BlueRayi / SNSTeXify.js
Created November 6, 2019 12:13
Render TeX Equation by KaTeX for SNSs.
// ==UserScript==
// @name SNSTeXify
// @namespace https://junjo-ponpo.com/
// @version 1.0.0
// @description Render TeX Equation by KaTeX for SNSs.
// @author BlueRayi
// @include https://twitter.com/*
// @resource KaTeXCSS https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css
// @require https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/contrib/auto-render.min.js