New feature (Bobsbotty) now available on our Gitter chat!

New feature (Bobsbotty) now available on our Gitter chat!
0

#1

Hey everyone!

For the past week or so I’ve been working on a new bot that’ll soon join one of our Gitter channels (it might be a new channel. This hasn’t been decided yet). This bot will provide you with Javascript challenges that you need to solve. Those formilliar with Codewars probably know what I’m talking about. But in case you’re not, here’s a small explanation:

The bot will give you a challenge. It’ll explain you what the requirements are in order for you to solve it. You’re supposed to write a Javascript function (or extend an existing one) that solves the challenge. After you submit your solution to the bot, it’ll run several tests against your solution to see if it returns the expected output.

For example:

Challenge: Write a function that takes a string as a parameter and returns the longest word in that string.
Conditions: The function name must be longestString. If multiple words are the longest, the last one should be returned.

After you’ve sent your solution, the bot will run tests like longestWord('Welcome to FCC!'); which should return Welcome.

Contributing challenges
Here’s where I require your help. There are only so many challenges I can think of myself. If you have one or more ideas for a challenge, head over to https://icecub.nl/gitter/bobsbotty/ and follow the instructions to add your own challenge(s) to the bot (no registration required). After submission, you can track the status of your (and everyone elses) challenge(s) here.

Once the bot is live, I’ll update this thread about it. Thank you for your help and happy coding!


#2

just wondering if these are going to be vanilla JS challenges?


#3

Yes. The bot uses Google’s V8 Javascript engine in the background. It doesn’t provide an option to include any library or framework. The idea behind it is to provide a fun way of testing your skills with Javascript and not to exclude anyone because they happen to be unformilliar with some library or framework.


#4

Nice idea! Do you intend to publish the source code for the bot?


#5

Feature request: the tests should be used to generate the Examples. This way, all the tests are visible to the person trying to solve the challenge.

EDIT: additional question: it appears that arrays must be JSON.stringified before output. I’m interested why this is – and does it apply to other data types, like Number?

EDIT: out of interest, why do the tests require semicolons at the end – JS autoinserts those at line breaks if needed? I ask because this means the tests do not conform with most style guides, are you stringing all the tests together on one line?

EDIT: Hmm, Object.entries isn’t supported. It’s very new, but is it possible to update?


#6

Great idea! I like it very much.


#7

The reason why the tests are not visible to the users, is to prevent them from cheating by hard coding return values. That’s why Codewars usually has a couple of visible tests, and a bunch of random (unpredictable) tests.

As for your first question: The bot uses Google’s V8 Javascript engine in the background. It doesn’t include functions like console.log();. Simply because there is no console. So if you try to output an array directly, it’ll just return the type “Array” instead of the array contents. The same goes for multple outputs like within a loop. If you tried that, the bot will only output the last loop. This is a good thing though. Otherwise users could loop something a thousend times and have the bot spam Gitter chat like crazy.

Question 2: No, that’s actually still there from the beta. The code is added on a new line of course.

Question 3: No it’s not possible to extend the engine’s capabilities. The bot itself runs on PHP using https://secure.php.net/manual/en/book.v8js.php. So I’m depending on that library. If I wanted to extend it, I’d have to change the code of that library and re-compile PHP with it. Which is simply out of the scope of my abilities.

Edit:

Sorry, I forgot your question about releasing the bot’s source code. Like everything else here on FCC, I’ll follow the tradition of keeping everything we have available as open source. So yes, once the bot goes from beta to release stage, I’ll make its source available on Github.


#8

As promissed, here’s the source of the bot: https://github.com/bjorno43/Bobsbotty


#10

Appearently I spoke too soon about the option to update the V8 engine. The bot now supports ES2018 :slight_smile:


#11

Good news! Bobsbotty has had the green light and is now running in https://gitter.im/FreeCodeCamp/JavascriptChallenges!