misezan 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.standard.yml +2 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +69 -0
- data/Rakefile +6 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/misezan/integer.rb +36 -0
- data/lib/misezan/version.rb +5 -0
- data/lib/misezan.rb +4 -0
- data/sig/misezan.rbs +4 -0
- metadata +58 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: b0f3e0b41619d368258903bd28d9f4b750ce91821903287bae1f0d05d18a1a02
|
|
4
|
+
data.tar.gz: cede9661cfc3e83b01218853c36a06957cee4e0bb3c2f8d20d8ebdd45e949b76
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 851599b554ca03875c723536272f646047ea4f4951f7c6b69c2b8896990fce9e282a528ba46d26bcee47af59c8f02e720f135f260903011bd419484a08e6746d
|
|
7
|
+
data.tar.gz: 8d4455b5d2b24d447cc80bf5de246d6a989d3609995a45453f3c0f29f159f29c6a22b8bb2b77a98aa0c4592cfe937bcf5e043713d33469fcc04486693b5cdd1f
|
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 yun asny23
|
|
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,69 @@
|
|
|
1
|
+
# misezan-ruby
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/rb/misezan)
|
|
4
|
+
|
|
5
|
+
見せ算のRuby実装です。
|
|
6
|
+
|
|
7
|
+
[misezan | RubyGems.org | コミュニティのgemホスティングサービス](https://rubygems.org/gems/misezan)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 見せ算とは
|
|
11
|
+
|
|
12
|
+
令和の時代に、加減乗除の四則演算に新たに加わった第五の演算です。
|
|
13
|
+
|
|
14
|
+
数字と数字を見せあわせてどう思うかによって結果(眼)が定まります。
|
|
15
|
+
|
|
16
|
+
- 基本ルール
|
|
17
|
+
- 同じ数字を見せした場合、眼は0
|
|
18
|
+
同じ服装の人が前から歩いてきたみたいな状況なので、恥ずいからお互い立ち去って0になる
|
|
19
|
+
- 違う数字を見せした場合、大きい方が眼になる
|
|
20
|
+
小さいものが大きいものを見ると怖いので、小さいほうが立ち去る->大きいほうが眼になる
|
|
21
|
+
|
|
22
|
+
- 応用ルール
|
|
23
|
+
- 6見せ9 = 11
|
|
24
|
+
6と9がお互いに「俺か?」って思って近づくので11になる
|
|
25
|
+
- 2見せ5 = 1.1
|
|
26
|
+
2と5がお互いに近づいて11になるが、違うことに気づいてびっくりして落としたケータイが地面について小数点になる
|
|
27
|
+
|
|
28
|
+
- さらに高度な応用ルール (本ライブラリでは未実装)
|
|
29
|
+
- 1見せ100 = 83
|
|
30
|
+
100は大群なので1は逃げられへんと思う->腹くくって100に突っ込んでいって17人倒すから83
|
|
31
|
+
- 1見せ100 = 84
|
|
32
|
+
83の中に優しい女性が1人いて、2人が後々結婚して子供が1人生まれてさらに1増える
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## デモ
|
|
36
|
+
|
|
37
|
+
Ruby 3.0 以降が必要です。
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
$ bin/setup
|
|
41
|
+
$ bin/console
|
|
42
|
+
irb(main):001:0> 1.見せ 1
|
|
43
|
+
=> 0
|
|
44
|
+
irb(main):002:0> 1.見せ 2
|
|
45
|
+
=> 2
|
|
46
|
+
irb(main):003:0> 6.見せ 9
|
|
47
|
+
=> 11
|
|
48
|
+
irb(main):004:0> 2.見せ 5
|
|
49
|
+
=> 1.1
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`見せ`メソッド以外に`mise`, `m`メソッドでも同じ動作となります。
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## インストール
|
|
56
|
+
|
|
57
|
+
gemコマンドの場合
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
$ gem install misezan
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Bundlerの場合
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
# Gemfile
|
|
67
|
+
|
|
68
|
+
gem 'misezan'
|
|
69
|
+
```
|
data/Rakefile
ADDED
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 "misezan"
|
|
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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Integer
|
|
4
|
+
def mise(other)
|
|
5
|
+
if other.is_a? Integer
|
|
6
|
+
if self == other
|
|
7
|
+
0
|
|
8
|
+
elsif is_point_symmetric(other)
|
|
9
|
+
11
|
|
10
|
+
elsif is_line_symmetric(other)
|
|
11
|
+
1.1
|
|
12
|
+
else
|
|
13
|
+
[self, other].max
|
|
14
|
+
end
|
|
15
|
+
else
|
|
16
|
+
raise StandardError
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
alias_method :見せ, :mise
|
|
21
|
+
alias_method :m, :mise
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def is_point_symmetric(n)
|
|
26
|
+
to_s == n.to_s.reverse.gsub(/[69]/, {"6" => "9", "9" => "6"})
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def is_line_symmetric(n)
|
|
30
|
+
to_s == n.to_s.reverse.gsub(/[25]/, {"2" => "5", "5" => "2"})
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def karaage = 4
|
|
35
|
+
|
|
36
|
+
def からあげ = 4
|
data/lib/misezan.rb
ADDED
data/sig/misezan.rbs
ADDED
metadata
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: misezan
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- yun asny23
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2024-01-06 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Integerを拡張し見せ算を実装します
|
|
14
|
+
email:
|
|
15
|
+
- asny23@gmail.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- ".standard.yml"
|
|
21
|
+
- CHANGELOG.md
|
|
22
|
+
- Gemfile
|
|
23
|
+
- LICENSE.txt
|
|
24
|
+
- README.md
|
|
25
|
+
- Rakefile
|
|
26
|
+
- bin/console
|
|
27
|
+
- bin/setup
|
|
28
|
+
- lib/misezan.rb
|
|
29
|
+
- lib/misezan/integer.rb
|
|
30
|
+
- lib/misezan/version.rb
|
|
31
|
+
- sig/misezan.rbs
|
|
32
|
+
homepage: https://gitlab.com/asny23/misezan-ruby
|
|
33
|
+
licenses:
|
|
34
|
+
- MIT
|
|
35
|
+
metadata:
|
|
36
|
+
homepage_uri: https://gitlab.com/asny23/misezan-ruby
|
|
37
|
+
source_code_uri: https://gitlab.com/asny23/misezan-ruby
|
|
38
|
+
changelog_uri: https://gitlab.com/asny23/misezan-ruby/-/blob/main/CHANGELOG.md?ref_type=heads
|
|
39
|
+
post_install_message:
|
|
40
|
+
rdoc_options: []
|
|
41
|
+
require_paths:
|
|
42
|
+
- lib
|
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 3.0.0
|
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '0'
|
|
53
|
+
requirements: []
|
|
54
|
+
rubygems_version: 3.2.33
|
|
55
|
+
signing_key:
|
|
56
|
+
specification_version: 4
|
|
57
|
+
summary: 見せ算
|
|
58
|
+
test_files: []
|