Skip to content

Commit f7e32fa

Browse files
BNAndraskotp
andauthored
Add bob (#186)
* Add bob * EOL Co-authored-by: Victor Goff <[email protected]> --------- Co-authored-by: Victor Goff <[email protected]>
1 parent 1b958f9 commit f7e32fa

File tree

9 files changed

+644
-0
lines changed

9 files changed

+644
-0
lines changed

config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@
6666
"prerequisites": [],
6767
"difficulty": 3
6868
},
69+
{
70+
"slug": "bob",
71+
"name": "Bob",
72+
"uuid": "362467ef-8ed3-4609-ae07-7395e5512f32",
73+
"practices": [],
74+
"prerequisites": [],
75+
"difficulty": 2
76+
},
6977
{
7078
"slug": "collatz-conjecture",
7179
"name": "Collatz Conjecture",
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Instructions
2+
3+
Your task is to determine what Bob will reply to someone when they say something to him or ask him a question.
4+
5+
Bob only ever answers one of five things:
6+
7+
- **"Sure."**
8+
This is his response if you ask him a question, such as "How are you?"
9+
The convention used for questions is that it ends with a question mark.
10+
- **"Whoa, chill out!"**
11+
This is his answer if you YELL AT HIM.
12+
The convention used for yelling is ALL CAPITAL LETTERS.
13+
- **"Calm down, I know what I'm doing!"**
14+
This is what he says if you yell a question at him.
15+
- **"Fine. Be that way!"**
16+
This is how he responds to silence.
17+
The convention used for silence is nothing, or various combinations of whitespace characters.
18+
- **"Whatever."**
19+
This is what he answers to anything else.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Introduction
2+
3+
Bob is a [lackadaisical][] teenager.
4+
He likes to think that he's very cool.
5+
And he definitely doesn't get excited about things.
6+
That wouldn't be cool.
7+
8+
When people talk to him, his responses are pretty limited.
9+
10+
[lackadaisical]: https://www.collinsdictionary.com/dictionary/english/lackadaisical
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"authors": [
3+
"BNAndras"
4+
],
5+
"files": {
6+
"solution": [
7+
"bob.red"
8+
],
9+
"test": [
10+
"bob-test.red"
11+
],
12+
"example": [
13+
".meta/example.red"
14+
]
15+
},
16+
"blurb": "Bob is a lackadaisical teenager. In conversation, his responses are very limited.",
17+
"source": "Inspired by the 'Deaf Grandma' exercise in Chris Pine's Learn to Program tutorial.",
18+
"source_url": "https://pine.fm/LearnToProgram/?Chapter=06"
19+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Red [
2+
description: {"Bob" exercise solution for exercism platform}
3+
author: "BNAndras"
4+
]
5+
6+
response: function [
7+
heyBob
8+
] [
9+
case [
10+
silent? heyBob [ "Fine. Be that way!" ]
11+
loud-question? heyBob [ "Calm down, I know what I'm doing!" ]
12+
loud-statement? heyBob [ "Whoa, chill out!" ]
13+
question? heyBob [ "Sure." ]
14+
true [ "Whatever." ]
15+
]
16+
]
17+
18+
silent?: function [
19+
message
20+
] [
21+
"" == trim message
22+
]
23+
24+
loud-question?: function [
25+
message
26+
] [
27+
and~ loud? message
28+
question? message
29+
]
30+
31+
loud-statement?: function [
32+
message
33+
] [
34+
loud? message
35+
]
36+
37+
question?: function [
38+
message
39+
] [
40+
#"?" == last trim message
41+
]
42+
43+
loud?: function [
44+
message
45+
] [
46+
and~ has-letter? message
47+
message == uppercase copy message
48+
]
49+
50+
has-letter?: func [phrase][
51+
not none? find phrase charset [#"a" - #"z" #"A" - #"Z"]
52+
]
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
11+
12+
[e162fead-606f-437a-a166-d051915cea8e]
13+
description = "stating something"
14+
15+
[73a966dc-8017-47d6-bb32-cf07d1a5fcd9]
16+
description = "shouting"
17+
18+
[d6c98afd-df35-4806-b55e-2c457c3ab748]
19+
description = "shouting gibberish"
20+
21+
[8a2e771d-d6f1-4e3f-b6c6-b41495556e37]
22+
description = "asking a question"
23+
24+
[81080c62-4e4d-4066-b30a-48d8d76920d9]
25+
description = "asking a numeric question"
26+
27+
[2a02716d-685b-4e2e-a804-2adaf281c01e]
28+
description = "asking gibberish"
29+
30+
[c02f9179-ab16-4aa7-a8dc-940145c385f7]
31+
description = "talking forcefully"
32+
33+
[153c0e25-9bb5-4ec5-966e-598463658bcd]
34+
description = "using acronyms in regular speech"
35+
36+
[a5193c61-4a92-4f68-93e2-f554eb385ec6]
37+
description = "forceful question"
38+
39+
[a20e0c54-2224-4dde-8b10-bd2cdd4f61bc]
40+
description = "shouting numbers"
41+
42+
[f7bc4b92-bdff-421e-a238-ae97f230ccac]
43+
description = "no letters"
44+
45+
[bb0011c5-cd52-4a5b-8bfb-a87b6283b0e2]
46+
description = "question with no letters"
47+
48+
[496143c8-1c31-4c01-8a08-88427af85c66]
49+
description = "shouting with special characters"
50+
51+
[e6793c1c-43bd-4b8d-bc11-499aea73925f]
52+
description = "shouting with no exclamation mark"
53+
54+
[aa8097cc-c548-4951-8856-14a404dd236a]
55+
description = "statement containing question mark"
56+
57+
[9bfc677d-ea3a-45f2-be44-35bc8fa3753e]
58+
description = "non-letters with question"
59+
60+
[8608c508-f7de-4b17-985b-811878b3cf45]
61+
description = "prattling on"
62+
63+
[bc39f7c6-f543-41be-9a43-fd1c2f753fc0]
64+
description = "silence"
65+
66+
[d6c47565-372b-4b09-b1dd-c40552b8378b]
67+
description = "prolonged silence"
68+
69+
[4428f28d-4100-4d85-a902-e5a78cb0ecd3]
70+
description = "alternate silence"
71+
72+
[66953780-165b-4e7e-8ce3-4bcb80b6385a]
73+
description = "multiple line question"
74+
75+
[5371ef75-d9ea-4103-bcfa-2da973ddec1b]
76+
description = "starting with whitespace"
77+
78+
[05b304d6-f83b-46e7-81e0-4cd3ca647900]
79+
description = "ending with whitespace"
80+
81+
[72bd5ad3-9b2f-4931-a988-dce1f5771de2]
82+
description = "other whitespace"
83+
84+
[12983553-8601-46a8-92fa-fcaa3bc4a2a0]
85+
description = "non-question ending with whitespace"

0 commit comments

Comments
 (0)