Hello everyone! I decided to put together some fun code golf challenges. For those of you who don't know, code golf is trying to make the smallest program the completes a given task.
Current Scoring:
All blocks=1 point
All inputs=1 point
All constants=1 point
Inputs given to the program=0 points
Some rules:
No javascript functions
Custom blocks are allowed, but all blocks inside them will be counted as well
Post you answers as a picture below and if they have a smaller score than other submissions, I will add them in this post.
If you any questions, comments, or suggestions, speak up and ask.
So without further ado, let's get coding!
Day 1-Warm-Up:
Challenge 1:
Recreate the block without using the block itself. You script should take a list "input list" and a value "input value" and report < true > if "input list" contains "input value" and false otherwise.
The current smallest script is by: @dardoro with a score of: 6
Challenge 2:
Recreate the block without using the block itself. It should take a list "input list" as input and report the length of "input list".
The current smallest script is by: @snapenilk with a score of: 5
Challenge 3:
Recreate the block without using the block itself. It should take a number "input number" as input and report the floor of "input number". That is, it should report the greatest integer less than or equal to "input number".
The current smallest script is by: @dardoro with a score of: 4
Wow, I learned something from both the challenges and answers. Especially I like your recursive answer to Challenge 2, @dardoro
I have a question which is not really about the contents of challenge. So, I made a list consisting of indices and words (taken from the introduction written by legoman3.14, above) and then I tried to get some N-grams to find the words "Post you" in them, but I'd need some help because I don't know how to filter the Merged_occurencies list, keeping only those items so that their indices are apart from each other only 1. Well, see the screen-capture below.
First you need to sort the merged occurrences list:
(The sort block is the list utilities library)
Then you need to keep items such that the item you are currently looking at equals the first word of the n-gram (n), and the next item (n+1) is the same as the second term.
This will result in only keeping the first item of the bi-gram, so you add an or statement to keep items such that the current item (n) equals the second search term, and the item before it (n-1) equals the first search term.