Algorithms with Python 番外編:擬似乱数の検定
- 等確率性の検定 (exec_test01)
- カイ二乗分布
- 9500前後なら許容可能
# frozen_string_literal: true | |
require "bcdice/base" | |
module BCDice | |
module GameSystem | |
class Template < Base | |
# ゲームシステムの識別子 | |
ID = "Template" |
# シンタックスハイライトのために .rb にしていますが、このままでは動きません。raccを通す必要があります。 | |
class AddDice | |
token NUMBER D K H L U R PLUS MINUS ASTERISK SLASH PARENL PARENR LESS GREATER EQUAL NOT | |
rule | |
expr: add | |
| add cmp_op add | |
{ result = val } | |
cmp_op: LESS EQUAL |
require_relative "rands" | |
require_relative "result" | |
module BCDice | |
class Evaluator | |
class << self | |
def eval(command) | |
new(command).eval | |
end | |
end |
// This code based on http://blog.graviness.com/?eid=795859 | |
/* | |
A C-program for MT19937, with initialization improved 2002/1/26. | |
Coded by Takuji Nishimura and Makoto Matsumoto. | |
Before using, initialize the state by using init_genrand(seed) | |
or init_by_array(init_key, key_length). | |
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, |
Algorithms with Python 番外編:擬似乱数の検定
require "strscan" | |
p ARGV | |
files = Dir[ARGV[0]] | |
p files | |
def dump(class_name, data) | |
ret = "" | |
ret += "[[ test ]]\n" | |
ret += "game_system = #{class_name.inspect}\n" |
ワザ、どうぐ、とくせいの効果によって、バトル中にポケモンの能力値が上下する。仕様は以下の通り。
module BCDice | |
VERSION = "3.0.0b" | |
# @return [Class] | |
def self.game_system_class(id) | |
# ... | |
end | |
end | |
class BCDice::GameSystem::Base |
$ bundle exec rake | |
/Users/ysakasin/.rbenv/versions/2.6.1/bin/ruby -I/Users/ysakasin/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rspec-core-3.9.0/lib:/Users/ysakasin/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rspec-support-3.9.0/lib /Users/ysakasin/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rspec-core-3.9.0/exe/rspec --pattern spec/lib/\*\*/\*_spec.rb | |
/Users/ysakasin/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/parser-2.6.4.1/lib/parser/lexer.rb:10922: warning: assigned but unused variable - testEof | |
/Users/ysakasin/src/opal/spec/support/source_map_helper.rb:61: warning: assigned but unused variable - next_section | |
Randomized with seed 11358 | |
.......................................................................................................................................................................................................................warning: Removed semicolon ending x-string expression, interpreted as unintentional -- (file):3 | |
warning: Removed semicolon ending x-string expressio |