Remind me again?

9

0

Introduction

Ever heard of Remind? No? Neither did I until about 2 years ago. Basic premise of it is for teachers to send out reminders and communicate with their students. Pretty neat, right? It even allows you send emotes and react to messages! Which I do on a daily basis.

But, one thing about Remind is that the teachers always send the "Do your homework!" "If you don't, you'll get an F!". But, there is useful stuff too, like "Test on Tuesday", or the occasional "Have a good day!". I almost always reply happy with a thumbs up, but sometimes, I have to put a thumbs down.

Challenge

Your task today is to find out if a message has a certain connotation to it. If it has a positive connotation to it, reply with a thumbs up. If it has a negative connotation, reply with a thumbs down.

How am I supposed to detect connotations?

A positive connotation will normally have 3 words in it. The 3 words are: Happy, Good, and Passed.

A negative connotation will have 3 also. Those 3: Test, Fail, and Homework.

What am I testing for?

You are testing to see if a message contains positive, negative or both connotations.

If a message has positive connotations to it, go ahead and return the unicode code point for thumbs up (U+1F44D).

If it has negative connotations to it, return the unicode code point for thumbs down (U+1F44E).

If the message has both negative and positive connotations, return the code point for a neutral face (U+1F610).

If, for some other reason, it doesn't have either connotations, return a nice ol' shrug (¯\_(ツ)_/¯). If the shrug doesn't show up right, here's the Emojipedia link to the shrug

Constraints

  • Program must take a message as input.
  • Positive connotations must return thumbs up code point (U+1F44D)
  • Negative connotations must return thumbs down code point (U+1F44E).
  • If the message has both connotations, return the neutral face code point (U+1F610).
  • If the message has neither connotations, return the shrug (¯\_(ツ)_/¯).
  • This is , Shortest bytes win

Test cases.

Input -> Output
Happy Good Friday! -> U+1F44D
Congrats, you just played yourself -> ¯\_(ツ)_/¯
You failed the test. -> U+1F44E
Good job on the test. -> U+1F610

KuanHulio

Posted 2017-05-26T17:39:42.717

Reputation: 883

You need to escape it – Rod – 2017-05-26T17:43:25.720

it's fine, the test case has the full shrug – KuanHulio – 2017-05-26T17:43:58.133

1"If the message has both connotations, return the neutral face code point (U+1F610)." And no, not case sensitive. – KuanHulio – 2017-05-26T17:47:41.650

To clarify: if the string contains both types of words, return neutral, regardless of if there is more of one type than the other? – Shaggy – 2017-05-26T17:56:30.277

@Shaggy yes, just return neutral – KuanHulio – 2017-05-26T17:57:49.247

You linked to (U+1F937), but requested "¯\(ツ)/¯", why did you link to that? – Theraot – 2017-05-27T22:21:33.087

@Theraot where does the OP ask for U+1F937? That article is about emojis and emoticons relating to people shrugging. That's why it's called "people shrugging" – caird coinheringaahing – 2017-05-27T23:57:28.870

@Ilikemydog OP didn't ask for U+1F937, did I say he asked for it? No I didn't. I said OP linked to it. While it is true that the article has emoticons related to people shrugging, that article is about one particular emoji, this one: (which has the code point U+1F937), and it list the different emoticons different platforms use to represent it. OP didn't ask for that emoji. That is precisely my point. Why did KuanHulio link to it? – Theraot – 2017-05-28T00:18:32.587

It has the shruggie unicode. That's why I linked to it. – KuanHulio – 2017-05-28T01:16:19.367

Answers

2

Python 3, 182 166 159 151 bytes

c=input().lower().count
print((["¯\_(ツ)_/¯"]+list(""))[any(map(c,["good","happy","passed"]))+any(map(c,["fail","test","homework"]))*2])

Try it online!

Martmists

Posted 2017-05-26T17:39:42.717

Reputation: 429

you can insert both anys inside the print : d[any(<positive>)+any(<negative>)*2] – Rod – 2017-05-26T17:45:18.973

1I get 182 UTF-8 bytes instead of 169 – user41805 – 2017-05-26T17:45:44.437

utf always makes me forget extra bytes, I usually just use python's len() function on my code. Will edit – Martmists – 2017-05-26T17:47:26.643

"" works fine for me. what version of python are you on? – Martmists – 2017-05-26T17:54:51.743

I haven't tested it, but I think you could do print(d[("good"in m or"happy"in m or"passed"in m)+("bad"in m or"test"in m or"homework"in m)*2]) instead – James – 2017-05-26T17:57:53.997

0

JavaScript, UTF-8 encoded, 100 bytes

s=>['¯\_(ツ)_/¯',...''][2*/happy|good|passed/i.test(s)+/test|fail|homework/i.test(s)]

Test cases:

const a =
s=>['¯\_(ツ)_/¯',...''][2*/happy|good|passed/i.test(s)+/test|fail|homework/i.test(s)]

console.log(a('Happy Good Friday!'));
console.log(a('Congrats, you just played yourself'));
console.log(a('You failed the test.'));
console.log(a('Good job on the test.'));

GOTO 0

Posted 2017-05-26T17:39:42.717

Reputation: 752

0

Powershell, 190 bytes

"$($s=Read-host;"$s ->";$1=("Test","Fail","Homework"|?{$s-match$_});$2=("Happy","Good","Passed"|?{$s-match$_});if($1-and$2){""}elseif($1){""}elseif($2){""}else{"¯\_(ツ)_/¯"})"

Displays the input and output next to eachother.

Happy Good Friday! ->

Congrats, you just played yourself -> ¯\_(ツ)_/¯

You failed the test. ->

Good job on the test. ->

Mike

Posted 2017-05-26T17:39:42.717

Reputation: 1

0

PowerShell, 187 bytes

read-host|%{$s=$_;$f=0;0..5|?{$s.indexof((-split'Happy Good Passed Test Fail Homework')[$_],0,$s.length,3)+1}|%{$f=$f-bor(1,2)[$_/3]};$s+' -> '+('¯\_(ツ)_/¯','','','')[$f]}

Andrei Odegov

Posted 2017-05-26T17:39:42.717

Reputation: 939