Skip to content

Instantly share code, notes, and snippets.

# coding: utf-8
# 問題:
# 偏りのない6面ダイスがある。
# 4つの値から1つを偏り無く選びたい。
# 値を選ぶ作業をn回繰り返す場合に、
# なるべくダイスを振る回数を少なくするにはどうしたらよいだろうか。
# 算術符号化を使って、@domain種の記号からなる列を、
# @range種の記号からなる列に変換する。
# coding: utf-8
t1s = Hash.new do 0 end
t2s = Hash.new do 0 end
all = Hash.new do 0 end
0.upto(5) do |r1|
0.upto(5) do |r2|
# 6進数で0 . r1 r2の36倍
x0 = r1 * 6 + r2
CREATE TABLE アイテム
TAG int,
武器_id int
武器_名前
武器_攻撃力 int,
武器_両手持ち bool
盾_id int,
盾_名前 text,
盾_防御力 int
薬_id int,
-- CREATE TAGGED UNION TABLEでタグ付き和の列であるような表を作る。
CREATE TAGGED UNION TABLE アイテム
TAG 武器 (
id int,
名前 text,
攻撃力 int,
両手持ち bool
) |
TAG 盾 (
id int,
interface Foo<T> {
void foo(T x);
}
class Bar implements Foo<Integer> {
public void foo(Integer x) {
}
// ERROR
public void foo(Object x) {
@taku0
taku0 / Foo.java
Last active February 15, 2016 05:20
interface A {
}
interface B {
}
interface C {
}
// ERROR
@taku0
taku0 / Main.java
Last active January 26, 2016 14:12
import java.util.*;
public class Main {
public static void main(String... args) {
int repeat = 100;
for (int i = 0; i < repeat; i++) {
int n = 1000000;
// benchCollection(n);
@testable import A
@ABC class Foo<A, B where B: C<[(D, E)]>>: F<[(G,
H)],
[I:
J]>,
K {
#if AAA
@DEF class func a() throws
-> A {
class Foo
end
class Bar < Foo
end
class Baz < Bar
end
class Bar2 < Foo
import java.util.Collections;
import java.util.List;
interface Apply<TypeConstructor, Param> { }
interface EmptyCollections<Coll> {
<Elem> Apply<Coll, Elem> empty();
}
@SuppressWarnings("unchecked")