Tumblelog by Soup.io
Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.
sofias
22:21

i just wrote a script and i get 11 possible results? oh, i see, i forgot to check that the numbers are in the _wrong place_ not just that some of them are contained. here what i made so far:

const correctPlace = (other, matches) =>
	arr => other.length.filter (
		i => other [i] == arr [i]
	).length == matches

const correctSymbol = (other, matches) =>
	arr => other.filter (
		sym => arr.includes (sym)
	).length == matches

i curried my functions, so i can use them nicely with filters.

oh, and i extended the prototype for numbers with an iterator and map/reduce/filter/etc and it's amazing. :D

Don't be the product, buy the product!

Schweinderl