say-anything 1.2.0 → 2.0.0
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 +4 -4
- data/.travis.yml +4 -0
- data/README.md +26 -5
- data/bin/say-anything +71 -1
- data/lib/say-anything.rb +1 -1
- data/say-anything.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8819bddd67d5bc8b3616b4e7e6e27e7fead01977
|
|
4
|
+
data.tar.gz: be4ea408451c282abbaea2925223036c7d5851a2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cdd7464fc6819a48ff3929f23dccede404fd0ea887e35a8bc68c780172f82d48951eca993ec011d3353aca899d1a217432f94b9a5730a8586d6707d48cc65dd4
|
|
7
|
+
data.tar.gz: 7425d040f06afdbc3ad9c7af071fe316d2254b1d9e7267e1b73ffc663c3c84dd7bcef926d3330411f83c0c5ad95760d88b99a80697273394154d53ea2ad7f38d
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
|
@@ -1,19 +1,37 @@
|
|
|
1
1
|
Say-Anything [](https://travis-ci.org/rozaxe/say-anything)
|
|
2
2
|
============
|
|
3
3
|
|
|
4
|
-
>
|
|
4
|
+
> The impossible Say-Anything-Challenge
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Computer knows 109 582 english words. Do you think you can beat it ? :stuck_out_tongue:
|
|
7
|
+
|
|
8
|
+
***
|
|
9
|
+
|
|
10
|
+
The gem can also be used for development (of course :information_desk_person:).
|
|
7
11
|
|
|
8
12
|
|
|
9
13
|
Install
|
|
10
14
|
-------
|
|
11
15
|
|
|
12
|
-
```
|
|
16
|
+
```
|
|
13
17
|
$ gem install say-anything
|
|
14
18
|
```
|
|
15
19
|
|
|
16
20
|
|
|
21
|
+
Play
|
|
22
|
+
----
|
|
23
|
+
|
|
24
|
+
First of all, rule is really simple, just say anything !
|
|
25
|
+
|
|
26
|
+
If you or your opponent is missing words, it's game over !
|
|
27
|
+
|
|
28
|
+
Rule seems still weird ? Go watch [this](https://www.youtube.com/watch?v=nPansREhHvA) :kissing_smiling_eyes:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
$ say-anything --play
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
|
|
17
35
|
Usage
|
|
18
36
|
-----
|
|
19
37
|
|
|
@@ -48,7 +66,7 @@ Return : `Array`
|
|
|
48
66
|
Times random words.
|
|
49
67
|
|
|
50
68
|
|
|
51
|
-
### .
|
|
69
|
+
### .all
|
|
52
70
|
|
|
53
71
|
Return : `Array`
|
|
54
72
|
|
|
@@ -58,10 +76,13 @@ All words.
|
|
|
58
76
|
CLI
|
|
59
77
|
---
|
|
60
78
|
|
|
61
|
-
```
|
|
79
|
+
```
|
|
62
80
|
$ say-anything --help
|
|
63
81
|
Usage: say-anything [OPTION]
|
|
64
82
|
|
|
83
|
+
-p, --play
|
|
84
|
+
challenge computer at say-anything
|
|
85
|
+
|
|
65
86
|
-t, --times [NUMBER]
|
|
66
87
|
return times random words
|
|
67
88
|
|
data/bin/say-anything
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
require 'say-anything'
|
|
4
4
|
|
|
5
|
+
# Display string helper
|
|
5
6
|
def helper
|
|
6
7
|
|
|
7
8
|
puts %q(
|
|
8
9
|
Usage: say-anything [OPTION]
|
|
9
10
|
|
|
11
|
+
-p, --play
|
|
12
|
+
challenge computer at say-anything
|
|
13
|
+
|
|
10
14
|
-t, --times [NUMBER]
|
|
11
15
|
return times random words
|
|
12
16
|
|
|
@@ -19,12 +23,78 @@ Usage: say-anything [OPTION]
|
|
|
19
23
|
|
|
20
24
|
end
|
|
21
25
|
|
|
26
|
+
# Start a game against the computer
|
|
27
|
+
def challenge
|
|
28
|
+
|
|
29
|
+
remaining = SayAnything.all
|
|
30
|
+
remaining.shuffle!
|
|
31
|
+
found = []
|
|
32
|
+
|
|
33
|
+
puts "Good luck ! ^C to quit"
|
|
34
|
+
|
|
35
|
+
loop do
|
|
36
|
+
puts "say-anything !"
|
|
37
|
+
print " "
|
|
38
|
+
|
|
39
|
+
begin
|
|
40
|
+
word = $stdin.gets
|
|
41
|
+
|
|
42
|
+
rescue Exception => e
|
|
43
|
+
puts "\nAlready ? I still have #{remaining.size} words in stock !"
|
|
44
|
+
break
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Clear space withing word
|
|
48
|
+
word.gsub! /\s/, ""
|
|
49
|
+
|
|
50
|
+
puts "\n"
|
|
51
|
+
|
|
52
|
+
# Return nil if not found
|
|
53
|
+
exist = remaining.delete word
|
|
54
|
+
|
|
55
|
+
if exist == nil
|
|
56
|
+
# Word not found !
|
|
57
|
+
if found.include? word
|
|
58
|
+
puts "Already said !"
|
|
59
|
+
else
|
|
60
|
+
puts "Sorry, doesn't exist"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
puts "You loose =P"
|
|
64
|
+
|
|
65
|
+
# Quit game
|
|
66
|
+
break
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Computer turn
|
|
70
|
+
ia = remaining.pop
|
|
71
|
+
if ia == nil
|
|
72
|
+
# Play wins O.o
|
|
73
|
+
puts "You won ! How is that possible ?!"
|
|
74
|
+
break
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Write computer's word
|
|
78
|
+
sleep 0.4
|
|
79
|
+
puts "Computer says #{ia}"
|
|
80
|
+
|
|
81
|
+
# Can't say them anymore
|
|
82
|
+
found << word
|
|
83
|
+
found << ia
|
|
84
|
+
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|
|
88
|
+
|
|
22
89
|
if ARGV.size > 0
|
|
23
90
|
|
|
24
91
|
# Help
|
|
25
92
|
if ARGV.include? "-h" or ARGV.include? "--help"
|
|
26
93
|
helper
|
|
27
94
|
|
|
95
|
+
elsif ARGV.include? "-p" or ARGV.include? "--play"
|
|
96
|
+
challenge
|
|
97
|
+
|
|
28
98
|
# Times
|
|
29
99
|
elsif ARGV.include? "-t" or ARGV.include? "--times"
|
|
30
100
|
i = ARGV.index do |x| ["-t", "--times"].include?(x) end
|
|
@@ -41,7 +111,7 @@ if ARGV.size > 0
|
|
|
41
111
|
|
|
42
112
|
# All
|
|
43
113
|
elsif ARGV.include? "-a" or ARGV.include? "--all"
|
|
44
|
-
SayAnything.
|
|
114
|
+
SayAnything.all.each do |x|
|
|
45
115
|
puts x
|
|
46
116
|
end
|
|
47
117
|
|
data/lib/say-anything.rb
CHANGED
data/say-anything.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: say-anything
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Axel Rozo--Brézillac
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-06-
|
|
11
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: This literally say anything.
|
|
14
14
|
email: axel.rozobrezillac@gmail.com
|