23
4
Concept
In what ways can you scramble the English alphabet so that it can still be sung to the tune Twinkle Twinkle Little Star without ruining the tune?
Rules
Swapping
Let's just assume the letters contained in each of the following sets can be swapped freely by default without ruining the tune:
- { A, J, K }
- { B, C, D, E, G, P, T, V, Z }
- { I, Y }
- { Q, U }
- { S, X, F }
- { M, N }
- Therefore H, L, O, R, and W are locked in place
Output
The program needs to output a single RANDOM string (or list of characters) containing the complete English alphabet in any order provided that order satisfies the conditions above. There should be no way for you to predict which string your program will output(if we ignore seeding), meaning you can't just hardcode it.
Your program must have some positive probability (not necessarily uniform) of generating each of the \$ 9! \cdot 3! \cdot 3! \cdot 2! \cdot 2! \cdot 2! = 104509440 \$ outputs.
There are no particular formatting restrictions regarding spacing, delimiters or case, just be consistent.
Goal
Fewest bytes wins!
Examples:
- KCDBPSVHIAJLMNOZQRXGUEWFYT
- A,G,Z,V,P,X,C,H,Y,K,J,L,N,M,O,T,U,R,S,D,Q,B,W,F,I,E
- KVTDCFBHIJALNMOPURSZQGWXYE
- j c d e b x t h i k a l n m o g u r s v q p w f y z
- ABCDEFGHIJKLMNOPQRSTUVWXYZ
Nonexample:
- HLWROABCDEFZXYGIJKMNPQTSVU
Proof of Concept: (Python3, 529 bytes)
import random
g1 = ['A', 'J', 'K']
g2 = ['B', 'C', 'D', 'E', 'G', 'P', 'T', 'V', 'Z']
g3 = ['I', 'Y']
g4 = ['Q', 'U']
g5 = ['S', 'X', 'F']
g6 = ['M', 'N']
random.shuffle(g1)
random.shuffle(g2)
random.shuffle(g3)
random.shuffle(g4)
random.shuffle(g5)
random.shuffle(g6)
print(g1[0] + g2[0] + g2[1] + g2[2] + g2[3] + g5[0] + g2[4] + 'H' + g3[0] + g1[1] + g1[2] + 'L' + g6[0] + g6[1] + 'O' + g2[5] + g4[0] + 'R' + g5[1] + g2[6] + g4[1] + g2[7] + 'W' + g5[2] + g3[1] + g2[8])
5Shouldn't
Z
be "locked in place", it doesn't rhyme with the others? – Shaggy – 2019-07-10T07:37:15.5973Depends on where you are from I suppose. If you say 'zed' then it would make sense to take it out but otherwise, if you say 'zee' then leave it in. Ultimately it's up to you, as are the rest of the sets. They're supposed to be guidelines and starting points opposed to strict rules :) – breadlord – 2019-07-10T07:46:30.970
1Can you please clarify if we should just output one scrambled possibility or all valid possibilities? – pixma140 – 2019-07-10T07:52:02.097
@pixma140 Clarified in the main post! Just one scrambled string is fine – breadlord – 2019-07-10T08:21:52.023
Should the output be random? Or would it be acceptable to systematically output the alphabet in order? (In which case this will be hard to beat.) – Robin Ryder – 2019-07-10T08:47:13.820
Random! Hardcoding would suck out all the fun @RobinRyder – breadlord – 2019-07-10T08:54:57.497
3Uniformly random or every possibility having a non-zero probability, or something else? – jimmy23013 – 2019-07-10T09:32:03.603
In what variants of English does W not rhyme with U? – Peter Taylor – 2019-07-10T10:11:32.647
8@PeterTaylor I think the intention is that the members of the groups can be easily swapped in the middle of the song while maintaining the tune and rhythm of the original - so while they do rhyme, W is 3 syllables long while U is only 1, which would change the rhythm of the song. – Sok – 2019-07-10T10:18:23.283
@PeterTaylor All. – Adám – 2019-07-10T11:42:46.530
@Adám, in my native en-GB, U is a phonetic suffix of W and therefore rhymes with it. – Peter Taylor – 2019-07-10T13:58:32.603
@Adám U = "You", W = "Double You". – mbomb007 – 2019-07-10T15:30:28.593
@PeterTaylor If you try using the same exact final syllable in a poem, it will sound very jarring and off. – Adám – 2019-07-10T15:53:53.583
@mbomb007 Because I like you so much / I will explain it such: / I wrote this poem for you / read! — it is for you. – Adám – 2019-07-10T15:59:33.110
1It still rhymes (trivially), though. – mbomb007 – 2019-07-10T16:22:20.457
I'll get around to a solution eventually, need to head to the nearest kindergarten first – Punintended – 2019-07-10T20:01:27.830
2
For those who (like me) had no idea what the question was talking about: https://en.wikipedia.org/wiki/Alphabet_song
– anatolyg – 2019-07-11T10:36:45.807