hachiwari 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +13 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +163 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +44 -0
- data/LICENSE.txt +21 -0
- data/README.md +120 -0
- data/Rakefile +16 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/exe/hachiwari +5 -0
- data/hachiwari.gemspec +41 -0
- data/lib/hachiwari/cli.rb +76 -0
- data/lib/hachiwari/version.rb +5 -0
- data/lib/hachiwari.rb +9 -0
- data/lib/results.yml +5 -0
- metadata +77 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5cad620e5b99a9b8a69ba25260c70b6a30f7ca3a48a2ef60b7af0b866091564e
|
4
|
+
data.tar.gz: e479948cad8adbcae3f3e438216b70571feb344af0ac6250424d4931f170c6fa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6b57e7666b95e8c532434206265a97567e0640500b75730827a8028ebd8b58d5fd4374c20d5ff0f17555730bff5a46b8613d7634b89c35e7422a2b0f8c2bf91e
|
7
|
+
data.tar.gz: 5fba6c44630ee9da377cbca9151e8929567209878c43124863118e5467dbc791441e7dea762c26c67267919aa88915508feea183739b26f814b64d3dc7fee4bc
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
# コントリビューター誓約書 行動規範
|
2
|
+
|
3
|
+
## 私たちの誓い
|
4
|
+
|
5
|
+
メンバー、コントリビューター、リーダーである私たちは、年齢、体格、目に見えるか見えないかにかかわらず、民族、性の特徴、性自認と表現、経験のレベル、教育、社会経済的地位、国籍、個人的な外見、人種、宗教、性的なアイデンティティと指向にかかわらず、すべての人にとってコミュニティへの参加がハラスメントのない経験となることを誓います。
|
6
|
+
|
7
|
+
私たちは、開かれた、歓迎された、多様な、包括的で健全なコミュニティに貢献する方法で行動し、交流することを誓います。
|
8
|
+
|
9
|
+
## 私たちの基準
|
10
|
+
|
11
|
+
私たちのコミュニティの良好な環境に貢献する行動の例としては、以下のようなものがあります。
|
12
|
+
|
13
|
+
* 他者への共感と優しさを示す。
|
14
|
+
* 異なる意見、視点、経験を尊重すること
|
15
|
+
* 建設的なフィードバックを与え、潔く受け止める。
|
16
|
+
* 自分の過ちによって影響を受けた人々に責任と謝罪を受け入れ、その経験から学ぶ。
|
17
|
+
* 私たち個人にとってだけでなく、コミュニティ全体にとって何が最善であるかを重視すること
|
18
|
+
|
19
|
+
容認できない行動の例としては、以下のようなものがあります。
|
20
|
+
|
21
|
+
* 性的な言葉やイメージの使用、あらゆる種類の性的な注目や誘い。
|
22
|
+
性的な言葉やイメージの使用、あらゆる種類の性的注目や誘い
|
23
|
+
* 荒らし、侮辱的または軽蔑的なコメント、個人的または政治的な攻撃
|
24
|
+
* 公的または私的なハラスメント
|
25
|
+
* 本人の明示的な許可なく、他人の個人情報(住所や電子メールアドレスなど)を公開すること
|
26
|
+
明示的な許可なく、他人の個人情報(住所、メール)を公開すること
|
27
|
+
* その他、プロの現場で不適切と思われる行為
|
28
|
+
|
29
|
+
## 施行の責任
|
30
|
+
|
31
|
+
コミュニティリーダーは、当社の許容できる行動の基準を明確にし、それを実施する責任があります。また、不適切、脅迫的、攻撃的、または有害であると判断された行動に対しては、適切かつ公正な是正措置を取るものとします。
|
32
|
+
|
33
|
+
コミュニティリーダーは、この行動規範にそぐわないコメント、コミット、コード、ウィキの編集、課題、その他の貢献を削除、編集、拒否する権利と責任を持ち、必要に応じてモデレーションの決定理由を伝えるものとします。
|
34
|
+
|
35
|
+
## 範囲
|
36
|
+
|
37
|
+
この行動規範は、コミュニティのすべてのスペースで適用されます。また、個人がコミュニティを公式に代表して公共の場で活動する場合にも適用されます。コミュニティを代表する例としては、公式の電子メールアドレスの使用、公式のソーシャルメディアアカウントによる投稿、オンラインまたはオフラインのイベントで任命された代表者としての行動などがあります。
|
38
|
+
|
39
|
+
## 実施要項
|
40
|
+
|
41
|
+
地域社会のリーダーは、この行動規範に違反していると判断した行為の結果を決定する際に、以下の地域社会への影響に関するガイドラインに従います。
|
42
|
+
|
43
|
+
### 1. 訂正
|
44
|
+
|
45
|
+
**コミュニティへの影響**。地域社会への影響**: 不適切な言葉の使用、または職業上好ましくない、または地域社会で歓迎されないとみなされるその他の行動。
|
46
|
+
|
47
|
+
**結果**: 地域社会のリーダーからの私的な書面による警告で、違反行為の性質を明確にし、なぜその行為が不適切なのかを説明します。公的な謝罪を求められることもあります。
|
48
|
+
|
49
|
+
### 2. 警告
|
50
|
+
|
51
|
+
**コミュニティへの影響**。コミュニティへの影響**: 1つの事件または一連の行動による違反。
|
52
|
+
|
53
|
+
**結果**: 継続的な行動に対する結果を伴う警告。行動規範を執行する者との未承諾の交流を含め、関係者との交流を一定期間行わないこと。これには、コミュニティスペースでの交流だけでなく、ソーシャルメディアのような外部チャネルでの交流を避けることも含まれます。これらの条件に違反すると、一時的または永久的な禁止措置がとられることがあります。
|
54
|
+
|
55
|
+
### 3. 一時的な禁止
|
56
|
+
|
57
|
+
**コミュニティへの影響**。コミュニティへの影響**: 継続的な不適切な行為を含む、コミュニティの基準に対する重大な違反。
|
58
|
+
|
59
|
+
**結果**: 一定期間、コミュニティとのあらゆる種類の交流や公的なコミュニケーションを一時的に禁止します。この期間中は、行動規範を施行している人との未承諾の交流を含め、関係者との公私にわたる交流はできません。これらの条件に違反すると、永久追放となる可能性があります。
|
60
|
+
|
61
|
+
### 4. 永久追放
|
62
|
+
|
63
|
+
**コミュニティへの影響**。コミュニティへの影響**: 継続的な不適切な行為、個人への嫌がらせ、特定の個人への攻撃や蔑視など、コミュニティの基準に違反するパターンを示した場合。
|
64
|
+
|
65
|
+
**結果**: コミュニティ内でのあらゆる公共の場での交流を永久に禁止する。
|
66
|
+
|
67
|
+
## 帰属
|
68
|
+
|
69
|
+
この行動規範は、[Contributor Covenant][homepage], version 2.0から引用しています。
|
70
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html に掲載されています。
|
71
|
+
|
72
|
+
コミュニティ・インパクト・ガイドラインは、[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity)を参考にしています。
|
73
|
+
|
74
|
+
[ホームページ]: https://www.contributor-covenant.org
|
75
|
+
|
76
|
+
この行動規範に関する一般的な質問への回答は、以下のFAQを参照してください。
|
77
|
+
https://www.contributor-covenant.org/faq。翻訳版は https://www.contributor-covenant.org/translations にあります。 無料版のDeepL翻訳(www.DeepL.com/Translator)で翻訳しました。
|
78
|
+
|
79
|
+
|
80
|
+
# Contributor Covenant Code of Conduct
|
81
|
+
|
82
|
+
## Our Pledge
|
83
|
+
|
84
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
85
|
+
|
86
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
87
|
+
|
88
|
+
## Our Standards
|
89
|
+
|
90
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
91
|
+
|
92
|
+
* Demonstrating empathy and kindness toward other people
|
93
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
94
|
+
* Giving and gracefully accepting constructive feedback
|
95
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
96
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
97
|
+
|
98
|
+
Examples of unacceptable behavior include:
|
99
|
+
|
100
|
+
* The use of sexualized language or imagery, and sexual attention or
|
101
|
+
advances of any kind
|
102
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
103
|
+
* Public or private harassment
|
104
|
+
* Publishing others' private information, such as a physical or email
|
105
|
+
address, without their explicit permission
|
106
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
107
|
+
professional setting
|
108
|
+
|
109
|
+
## Enforcement Responsibilities
|
110
|
+
|
111
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
112
|
+
|
113
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
114
|
+
|
115
|
+
## Scope
|
116
|
+
|
117
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
118
|
+
|
119
|
+
## Enforcement
|
120
|
+
|
121
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at contact@atelier-mirai.net. All complaints will be reviewed and investigated promptly and fairly.
|
122
|
+
|
123
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
124
|
+
|
125
|
+
## Enforcement Guidelines
|
126
|
+
|
127
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
128
|
+
|
129
|
+
### 1. Correction
|
130
|
+
|
131
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
132
|
+
|
133
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
134
|
+
|
135
|
+
### 2. Warning
|
136
|
+
|
137
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
138
|
+
|
139
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
140
|
+
|
141
|
+
### 3. Temporary Ban
|
142
|
+
|
143
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
144
|
+
|
145
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
146
|
+
|
147
|
+
### 4. Permanent Ban
|
148
|
+
|
149
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
150
|
+
|
151
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
152
|
+
|
153
|
+
## Attribution
|
154
|
+
|
155
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
156
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
157
|
+
|
158
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
159
|
+
|
160
|
+
[homepage]: https://www.contributor-covenant.org
|
161
|
+
|
162
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
163
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
hachiwari (0.4.0)
|
5
|
+
thor
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.2)
|
11
|
+
minitest (5.15.0)
|
12
|
+
parallel (1.22.1)
|
13
|
+
parser (3.1.2.0)
|
14
|
+
ast (~> 2.4.1)
|
15
|
+
rainbow (3.1.1)
|
16
|
+
rake (13.0.6)
|
17
|
+
regexp_parser (2.3.1)
|
18
|
+
rexml (3.2.5)
|
19
|
+
rubocop (1.28.2)
|
20
|
+
parallel (~> 1.10)
|
21
|
+
parser (>= 3.1.0.0)
|
22
|
+
rainbow (>= 2.2.2, < 4.0)
|
23
|
+
regexp_parser (>= 1.8, < 3.0)
|
24
|
+
rexml
|
25
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
26
|
+
ruby-progressbar (~> 1.7)
|
27
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
28
|
+
rubocop-ast (1.17.0)
|
29
|
+
parser (>= 3.1.1.0)
|
30
|
+
ruby-progressbar (1.11.0)
|
31
|
+
thor (1.2.1)
|
32
|
+
unicode-display_width (2.1.0)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
x86_64-darwin-21
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
hachiwari!
|
39
|
+
minitest (~> 5.0)
|
40
|
+
rake (~> 13.0)
|
41
|
+
rubocop (~> 1.21)
|
42
|
+
|
43
|
+
BUNDLED WITH
|
44
|
+
2.3.11
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Atelier-Mirai
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
# 八割 Hachiwari
|
2
|
+
|
3
|
+
Hachiwari は、八割に由来します。
|
4
|
+
ご自身の目指す勝率(=既定値八割)を達成するために必要な勝ち数を表示する gem です。
|
5
|
+
|
6
|
+
Hachiwari is derived from the word "80%".
|
7
|
+
It is a gem that shows you the number of wins you need to achieve your target win rate (i.e. the default of 80%).
|
8
|
+
|
9
|
+
## インストール方法 Installation
|
10
|
+
|
11
|
+
以下のコマンドを実行して、インストールしてください。
|
12
|
+
Install it yourself as:
|
13
|
+
|
14
|
+
```
|
15
|
+
% gem install hachiwari
|
16
|
+
```
|
17
|
+
|
18
|
+
## 使い方 Usage
|
19
|
+
|
20
|
+
## 目標勝率を達成するために必要な勝ち数を表示する (自動保存機能付)
|
21
|
+
|
22
|
+
``` zsh
|
23
|
+
% hachiwari status [wins] [losses] [target] [language]
|
24
|
+
```
|
25
|
+
|
26
|
+
(``` status ``` コマンドの別名として、 ``` s ``` コマンドを用いることが出来ます。)
|
27
|
+
|
28
|
+
四つの引数、勝ち数、負け数、目標勝率、表示言語があります。すべての引数は省略可能です。
|
29
|
+
|
30
|
+
* 引数がないとき、既定値もしくは保存されたデータを元に、現在の対局成績を表示します。
|
31
|
+
既定値は、勝ち数:0、負け数:0、勝率:八割、表示言語:日本語です。
|
32
|
+
* 一つ目の引数として勝ち数が与えられると、それに基づく必要勝ち数を表示します。
|
33
|
+
残りの引数は、既定値もしくは保存されたデータを用います。
|
34
|
+
与えられた勝ち数のデータは、ホームディレクトリの直下のファイル「.hachiwari」に自動的に保存・更新されます。
|
35
|
+
* 負け数を与えたい場合・更新したい場合には、二番目の引数として、status コマンドを実行してください。
|
36
|
+
* 目標勝率を変更したい場合には、三番目の引数として下さい。九割の勝率を目指す場合には、90 と指定します。
|
37
|
+
* 表示言語を変更したい場合には、四番目の引数として与えてください。既定値は日本語 ja です。英語に変更したい場合には、en を指定してください。
|
38
|
+
* 与えられた引数は、自動で保存される為、勝ち数のみが増えた場合、残りの引数の入力は不要です。
|
39
|
+
|
40
|
+
## 目標勝率を達成するために必要な勝ち数を表示する (情報表示のみ)
|
41
|
+
|
42
|
+
``` zsh
|
43
|
+
% hachiwari info [wins] [losses] [target] [language]
|
44
|
+
```
|
45
|
+
|
46
|
+
(``` info ``` コマンドの別名として、 ``` i ``` コマンドを用いることが出来ます。)
|
47
|
+
|
48
|
+
使い方は、``` status / s ``` コマンドと同じです。
|
49
|
+
自動保存を行わず、情報表示のみである点が異なります。
|
50
|
+
例えばこの場合はどうなるのだろうかと、試算する用途などに便利です。
|
51
|
+
|
52
|
+
## Hachiwari のバージョンを表示する
|
53
|
+
|
54
|
+
``` zsh
|
55
|
+
% hachiwari version
|
56
|
+
```
|
57
|
+
|
58
|
+
Hachiwari のバージョンを表示します。
|
59
|
+
|
60
|
+
## Display the number of wins needed to achieve the target win rate. (with automatic saving)
|
61
|
+
|
62
|
+
``` zsh
|
63
|
+
% hachiwari status [wins] [losses] [target] [language]
|
64
|
+
```
|
65
|
+
|
66
|
+
(The ``` s ``` command can also be used as an alias for ``` status ```).
|
67
|
+
|
68
|
+
There are four arguments: number of wins, number of losses, target win percentage, and display language. All arguments are optional.
|
69
|
+
|
70
|
+
* If there is no argument, the current game results are displayed based on default values or saved data.
|
71
|
+
The default values are: wins: 0, losses: 0, win percentage: 80%, display language: Japanese.
|
72
|
+
* If the number of wins is given as the first argument, the required number of wins based on it will be displayed.
|
73
|
+
The rest of the arguments are default values or saved data.
|
74
|
+
The data of the number of wins given will be automatically saved and updated in the file ".hachiwari" directly under the home directory.
|
75
|
+
* If you want to give/update the number of losses, please execute the status command as the second argument.
|
76
|
+
* If you want to change the target winning percentage, make it the third argument. If you want to aim for a 90% win rate, specify 90.
|
77
|
+
* If you want to change the display language, give it as the fourth argument. The default language is Japanese ``` ja ```. If you want to change it to English, specify ``` en ```.
|
78
|
+
* The arguments given are automatically saved, so if only the number of wins is increased, the remaining arguments need not be entered.
|
79
|
+
|
80
|
+
## Display the number of wins needed to achieve the target win rate. (information only)
|
81
|
+
|
82
|
+
Usage is the same as the ```status / s ``` command.
|
83
|
+
The difference is that it does not save automatically, but only displays information.
|
84
|
+
It is useful, for example, for estimating what would happen in this case.
|
85
|
+
|
86
|
+
## Display the version of Hachiwari
|
87
|
+
|
88
|
+
``` zsh
|
89
|
+
% hachiwari version
|
90
|
+
```
|
91
|
+
|
92
|
+
Displays the version of Hachiwari.
|
93
|
+
|
94
|
+
## 開発 Development
|
95
|
+
|
96
|
+
repo をチェックアウトしたら、`bin/setup`を実行して、依存関係をインストールします。その後、`rake test` を実行してテストを実行します。また、`bin/console`を実行すると、インタラクティブなプロンプトが表示され、実験を行うことができます。
|
97
|
+
|
98
|
+
このgemをローカルマシンにインストールするには、`bundle exec rake install`を実行します。新しいバージョンをリリースするには、`version.rb` のバージョン番号を更新してから、`bundle exec rake release` を実行すると、そのバージョンの git タグが作成され、git commits と作成されたタグがプッシュされ、`.gem` ファイルが [rubygems.org](https://rubygems.org) にプッシュされます。
|
99
|
+
|
100
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
101
|
+
|
102
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
103
|
+
|
104
|
+
## 貢献 Contributing
|
105
|
+
|
106
|
+
バグレポートやプルリクエストは、GitHub(https://github.com/Atelier-Mirai/hachiwari)で受け付けています。このプロジェクトは、共同作業のための安全で歓迎される空間であることを意図しており、貢献者は[行動規範](https://github.com/Atelier-Mirai/hachiwari/blob/master/CODE_OF_CONDUCT.md)を遵守することが期待されています。
|
107
|
+
|
108
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Atelier-Mirai/hachiwari. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/Atelier-Mirai/hachiwari/blob/master/CODE_OF_CONDUCT.md).
|
109
|
+
|
110
|
+
## ライセンス License
|
111
|
+
|
112
|
+
このgemは、[MIT License](https://opensource.org/licenses/MIT)の条件でオープンソースとして提供されています。
|
113
|
+
|
114
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
115
|
+
|
116
|
+
## 行動規範 Code of Conduct
|
117
|
+
|
118
|
+
Hachiwariプロジェクトのコードベース、イシュートラッカー、チャットルーム、メーリングリストで交流するすべての人は、[行動規範](https://github.com/Atelier-Mirai/hachiwari/blob/master/CODE_OF_CONDUCT.md)に従うことが求められます。
|
119
|
+
|
120
|
+
Everyone interacting in the Hachiwari project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/hachiwari/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
require "rubocop/rake_task"
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new
|
15
|
+
|
16
|
+
task default: %i[test rubocop]
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "hachiwari"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/hachiwari
ADDED
data/hachiwari.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/hachiwari/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "hachiwari"
|
7
|
+
spec.version = Hachiwari::VERSION
|
8
|
+
spec.authors = ["Atelier-Mirai"]
|
9
|
+
spec.email = ["contact@atelier-mirai.net"]
|
10
|
+
|
11
|
+
spec.summary = "Winning rate 80%"
|
12
|
+
spec.description = "Calculate the number of wins needed to achieve an 80% win rate."
|
13
|
+
spec.homepage = "https://github.com/Atelier-Mirai/hachiwari"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
16
|
+
|
17
|
+
# spec.metadata["allowed_push_host"] = "https://github.com/Atelier-Mirai/hachiwari"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/Atelier-Mirai/hachiwari"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/Atelier-Mirai/hachiwari/blob/master/CHANGELOG.md"
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
28
|
+
end
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
# Uncomment to register a new dependency of your gem
|
35
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
36
|
+
|
37
|
+
# For more information and examples about making a new gem, checkout our
|
38
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
39
|
+
|
40
|
+
spec.add_dependency "thor"
|
41
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# require "hachiwari"
|
2
|
+
require "thor"
|
3
|
+
require 'yaml/store'
|
4
|
+
|
5
|
+
module Hachiwari
|
6
|
+
class CLI < Thor
|
7
|
+
|
8
|
+
Results = Struct.new(:wins, :losses, :target, :language)
|
9
|
+
@@db = YAML::Store.new("#{Dir.home}/.hachiwari")
|
10
|
+
@@results = @@db.transaction { @@db[:results] } if @@db
|
11
|
+
@@results ||= Results.new(0, 0, 80, :ja)
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def save
|
15
|
+
@@db.transaction { @@db[:results] = @@results }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
CLI.save
|
19
|
+
|
20
|
+
desc "status [wins] [losses] [target] [language]", "Displays winning percentage and number of wins to achieve the goal. (with save status)"
|
21
|
+
def status(wins = @@results.wins, losses = @@results.losses, target = @@results.target, language = @@results.language, save = true)
|
22
|
+
wins = wins.to_i if ARGV[1]
|
23
|
+
losses = losses.to_i if ARGV[2]
|
24
|
+
target = target.to_i if ARGV[3]
|
25
|
+
language = language.to_sym if ARGV[4]
|
26
|
+
|
27
|
+
if save
|
28
|
+
@@results.wins = wins
|
29
|
+
@@results.losses = losses
|
30
|
+
@@results.target = target
|
31
|
+
@@results.language = language
|
32
|
+
CLI.save
|
33
|
+
end
|
34
|
+
|
35
|
+
case language
|
36
|
+
when :ja
|
37
|
+
puts "#{wins+losses} 戦 #{wins} 勝 #{losses} 敗 勝率 #{winning_percentage(wins, losses)} % です"
|
38
|
+
puts "あと #{reach_wins(wins, losses)} 勝で 勝率 #{(@@results.target).to_i} % です"
|
39
|
+
when :en
|
40
|
+
puts "#{wins+losses} games #{wins} wins #{losses} losses a winning percentage of #{winning_percentage(wins, losses)} %."
|
41
|
+
puts "You need #{reach_wins(wins, losses)} more wins to reach #{(@@results.target).to_i} %"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
desc "s [wins] [losses] [target] [language]", "Another name for the status command."
|
46
|
+
def s(wins = @@results.wins, losses = @@results.losses, target = @@results.target, language = @@results.language)
|
47
|
+
status(wins, losses, target, language)
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "info [wins] [losses] [target] [language]", "Displays winning percentage and number of wins to achieve the goal. (Information only)"
|
51
|
+
def info(wins = @@results.wins, losses = @@results.losses, target = @@results.target, language = @@results.language)
|
52
|
+
status(wins, losses, target, language, false)
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "i [wins] [losses] [target] [language]", "Another name for the info command."
|
56
|
+
def i(wins = @@results.wins, losses = @@results.losses, target = @@results.target, language = @@results.language)
|
57
|
+
status(wins, losses, target, language, false)
|
58
|
+
end
|
59
|
+
|
60
|
+
desc "version", "Displays the version number."
|
61
|
+
def version
|
62
|
+
puts Hachiwari::VERSION
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def winning_percentage(wins, losses)
|
68
|
+
(wins / (wins + losses).to_f * 100).round(4)
|
69
|
+
end
|
70
|
+
|
71
|
+
def reach_wins(wins, losses)
|
72
|
+
target = @@results.target / 100.0
|
73
|
+
(target / (1 - target) * losses - wins).round(6).ceil
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/hachiwari.rb
ADDED
data/lib/results.yml
ADDED
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hachiwari
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Atelier-Mirai
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-04-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Calculate the number of wins needed to achieve an 80% win rate.
|
28
|
+
email:
|
29
|
+
- contact@atelier-mirai.net
|
30
|
+
executables:
|
31
|
+
- hachiwari
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- ".rubocop.yml"
|
36
|
+
- CHANGELOG.md
|
37
|
+
- CODE_OF_CONDUCT.md
|
38
|
+
- Gemfile
|
39
|
+
- Gemfile.lock
|
40
|
+
- LICENSE.txt
|
41
|
+
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- bin/console
|
44
|
+
- bin/setup
|
45
|
+
- exe/hachiwari
|
46
|
+
- hachiwari.gemspec
|
47
|
+
- lib/hachiwari.rb
|
48
|
+
- lib/hachiwari/cli.rb
|
49
|
+
- lib/hachiwari/version.rb
|
50
|
+
- lib/results.yml
|
51
|
+
homepage: https://github.com/Atelier-Mirai/hachiwari
|
52
|
+
licenses:
|
53
|
+
- MIT
|
54
|
+
metadata:
|
55
|
+
homepage_uri: https://github.com/Atelier-Mirai/hachiwari
|
56
|
+
source_code_uri: https://github.com/Atelier-Mirai/hachiwari
|
57
|
+
changelog_uri: https://github.com/Atelier-Mirai/hachiwari/blob/master/CHANGELOG.md
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 2.6.0
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubygems_version: 3.3.7
|
74
|
+
signing_key:
|
75
|
+
specification_version: 4
|
76
|
+
summary: Winning rate 80%
|
77
|
+
test_files: []
|