96
votes
Check if words are isomorphs
J, 4 bytes
-:&=
Usage
'THERMODYNAMICS' (-:&=) 'RAMBUNCTIOUSLY' NB. parens are optional
1
Explanation
...
- 20.7k
37
votes
Check if words are isomorphs
K, 5 bytes
This has a delightfully elegant solution in K!
~/=:'
The "group" operator (monadic =) creates precisely the ...
- 4,992
19
votes
17
votes
Write a short story using only valid code
SQL love poem
SELECT * FROM Night_Sky
WHERE Beauty LIKE "yours"
0 results returned
I'm a little unsure of the rules here, as my output is obviously important ...
- 271
14
votes
Highlight a Wordle guess
BQN, 19 18 bytesSBCS
Improved after getting some new ideas from trying this in K.
=+5>≠{⊒⌾(∾𝕨⊸⊔)˝𝕩}≍
Run online!
BQN, 27 24 bytesSBCS
Returns 0 for white, 1 ...
- 56.2k
13
votes
Check if words are isomorphs
CJam, 9 bytes
r_f#r_f#=
Prints 1 if the words are isomorphs and 0 if they're not.
Try it ...
- 208k
10
votes
Check if words are isomorphs
JavaScript, ES7, 62 55 54 52 51 bytes
f=(x,y,g=z=>[for(i of z)z.search(i)]+0)=>g(x)==g(y)
The logic is simple. I simply convert both the inputs into their ...
- 26.5k
10
votes
Generate a password
05AB1E, 19 17 16 bytes
Saved 1 byte thanks to Kevin Cruijssen
áΣl}.γl}éεgyθJ}J
Try it online!
or as a Test Suite
Explanation
...
- 52.8k
10
votes
Highlight a Wordle guess
Perl 5 + -pF, 57 bytes
Returns 2 for green, 1 for yellow and leaves others as they were.
...
- 22.7k
9
votes
Highlight a Wordle guess
05AB1E, 14 bytes
øDÆĀ*ø`0Kvy®.;
Input as a list of 1-based alphabet indices; modifies the list to change green to 0 and yellow ...
- 116k
8
votes
insertspacesbetweenwords
Python 3, 88
f=lambda x,w,s=[]:[x or print(*s)]+[x.find(y)or f(x[len(y):],w,s+[y])for y in w.split()]
String to split is x, ...
- 141k
8
votes
Check if words are isomorphs
Bash + coreutils, 38
[ `tr $@<<<$1``tr $2 $1<<<$2` = $2$1 ]
Note we are using the usual shell idea of truthy/falsy here - zero means SUCCESS or ...
- 70.9k
8
votes
Check if words are isomorphs
Haskell, 33 29
EDIT:
this is way too late, but i found this improvement using applicatives, that were added to prelude only in march 2015.
...
- 6,141
8
votes
Solve the New York Times Spelling Bee
PowerShell, 50 44 41 39 43 bytes
param($a,$m)gc z|sls $m|sls "^[$a$m]{5,9}$"
Notes
Using a scriptblock (unnamed function) because there's still a requirement ...
- 3,250
8
votes
Generate a password
Perl 6, 66 63 bytes
{[~] map {+$_~.tail},sort {+$_,.lc},m:g/<:L>/.classify(&lc){*}}
Try it online!
Explanation
...
- 10.5k
8
votes
8
votes
7
votes
7
votes
Same number letters
R, 106 bytes
function(s){for(A in L<-LETTERS)s=sub(A,strrep(A,max(x<-+s-+Map(gsub,L,'',s,T))-x[A]--1),s,T);s}
"+"=nchar
Try it online!
Base R approach :
...
- 4,989
7
votes
Accepted
7
votes
Highlight a Wordle guess
Retina 0.8.2, 45 bytes
+`(\w)(.{5})\1
+$2+
+`(\w)(.*,.*)\1
-$2-
,.*
Try it online! Link includes test cases. Takes input as two comma-separated words. Matching ...
- 156k
7
votes
Highlight a Wordle guess
R, 84 80 bytes
function(s,g){e=s!=g;for(i in 1:5)s[x]=g[i]=1+is.na(x<-which(s*e==g[i])[1]);g*e}
Try it online!
My golfing skills are quite rusty after a long ...
- 13k
7
votes
Highlight a Wordle guess
K (ngn/k), 32 31 bytes
{g-(x~':x{x_x?y}\y@>g)@<>g:x=y}
Try it online!
Minor reordering and syntax change from the original answer below (and it returns ...
- 69.9k
7
votes
Highlight a Wordle guess
K (ngn/k), 30 bytes
Takes the guess as first argument and the secret as second. Returns a list with -1 for not highlighted, 0 for yellow and 1 for green.
...
- 56.2k
7
votes
Wordle games without repeating letters
Vyxal, 11 bytes
'L5=;5ḋ'∑Þu
Try it Online!
Get all 5 letter words, and all 5 word combinations where all the letters are unique.
Explained
...
- 27.6k
6
votes
Check if words are isomorphs
Brainfuck, 169 168 162 144 140 131 130
Compatible with Alex Pankratov's bff (brainfuck interpreter used on SPOJ and ideone) and Thomas Cort's BFI (used on Anarchy Golf).
The expected input is two ...
- 5,859
6
votes
Check if words are isomorphs
Haskell, 45 41 bytes
h l=map(`lookup`zip l[1..])l
x!y=h x==h y
Returns True or False, e.g ...
- 35.7k
6
votes
Accepted
6
votes
6
votes
Generate a password
Retina, 67 66 41 39 bytes
\P{L}
O$`.
$l$0
ir`\1*(.)
$.0$1
N`\d+.
-25 bytes and a minor bug-fix thanks to @Neil.
-2 bytes thanks to @Neil and @Shaggy together.
Try ...
- 116k
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
word-puzzle × 30code-golf × 22
string × 5
code-challenge × 5
natural-language × 5
game × 3
alphabet × 2
math × 1
kolmogorov-complexity × 1
decision-problem × 1
popularity-contest × 1
base-conversion × 1
counting × 1
music × 1
fastest-algorithm × 1
crossword × 1
word-search × 1
markov-chain × 1
1p5 × 1