text:
More efficient US state codes
Abbreviate that US state! was fun, but we learnt that efficiently abbreviating US state names is hard with the current system. Let's come up with an alternative state code scheme for efficient golfing.
Your task:

Write a function (or program) which, given a valid US state name (only the 50 normal states required), returns a unique two-letter code in uppercase identifying it. The code must meet these requirements:

The first letter must be the same as the first letter of the state.
The second letter must be one of the other letters of the state (not a space).
It must always give the same output for the same input, and must never give the same output for two different valid inputs.

For instance, given "Alabama", your function could return "AL", "AA", "AB" or "AM" - as long as it doesn't return that value for any of Alaska, Arkansas, etc. ("AA" is only possible because "A" appears more than once in the state name.)
Standard loopholes forbidden. Standard input/output are ok. This is code golf, so shortest solution, in bytes, wins.
The complete list of possible inputs is here:
Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
Hawaii
Idaho
Illinois
Indiana
Iowa
Kansas
Kentucky
Louisiana
Maine
Maryland
Massachusetts
Michigan
Minnesota
Mississippi
Missouri
Montana
Nebraska
Nevada
New Hampshire
New Jersey
New Mexico
New York
North Carolina
North Dakota
Ohio
Oklahoma
Oregon
Pennsylvania
Rhode Island
South Carolina
South Dakota
Tennessee
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming

Should the output always be two uppercase letters, or is it OK to output mixed case? If mixed is OK should "Ab" be considered as different from "AB"; and must the first letter always be uppercase?

Is the space character considered a valid letter?

No. Letters are letters.

Output must be uppercase. Sorry, I really should have specified that.

Thanks, I went with both of those rulings as I did think they made the most sense.

Jelly,  13  12 bytes
907ị;⁸Qḣ2ṢŒu

A monadic link taking and returning lists of characters.
Try it online! or see a test suite
How?
907ị;⁸Qḣ2ṢŒu - Monadic link: list of characters, state    e.g. Alabama   or   Kansas
907          - literal 907
   ị         - index into state                                b              K
     ⁸       - link's left argument, state
    ;        - concatenate                                     bAlabama       KKansas
      Q      - de-duplicate (unique by 1st appearance)         bAlam          Kans
       ḣ2    - head to index 2                                 bA             Ka
         Ṣ   - sort                                            Ab             Ka
          Œu - convert to uppercase                            AB             KA

Indexing in Jelly is 1-indexed and modular, so the 907th index of something of length L is the (907-modulo-L)th item. For example for "Alabama" the length is 7 so the item at index 907 is the (907-modulo-7)th, and 907-modulo-7 is 4 (907 = 129 * 7 + 4), so the item at index 907 is 'b'.
907 is the first positive index at which the state abbreviations using index 1 and that index over all of the 50 states become unique.
State names, including their spaces, are of length 4 through 14 inclusive, and 907-modulo-6 is 1 (whereas for all other lengths the value is not 1). This means that if we were to use the 1st and 907th characters for the abbreviations that Alaska, Hawaii, Kansas, Nevada, and Oregon would be AA, HH, KK, NN, and OO respectively - this is not acceptable for Hawaii, Kansas, or Nevada; so an adjustment needs to be made; this is the reason for the concatenation, de-duplication, head to index 2 and sort, this makes Alaska, Hawaii, Kansas, Nevada, and Oregon become AL, HA, KA, NA and OR respectively and does not collide with existing state abbreviations.

@LevelRiverSt should be OK now, although there is probably a shorter solution than this patch to my original flawed one.

Can you please add a brief explanation?

@user1502040 I was doing so, should be clear now, let me know if you don't understand anything.

How did you come up with this?

@user1502040 I knew we needed to create the codes from the letters in the input, and that Jelly indexing was modular, so I just looked for an index that gave 50 unique codes (I just wrote some Python code to find such indexes - also finding -341 and -773 within the -1000 to 1000 range). I originally missed the requirement for "other" so patched up the problem (as described). (I have not found anything shorter yet either, although I would not be surprised if there were).

Can't you search for a value with no 1 result to mod 4 ... mod 13? There should be a few 4-digit one. Nice solution btw.

@randomra there are no such numbers, even if we relax it to allow 1 in cases where it would not be a problem (like Alaska) there are no such numbers. (We actually have a bigger range to play with by using base 250 compressions, which I have not exhaustively searched). Other similar alternative approaches to consider include indexing into the state after removing the first letter and/or filtering out spaces or even other characters.

Ruby, 34 bytes
->s{s[0]+(s[1,8]*999)[445].upcase}

I started off with s[0]+s*99999[x].upcase and found many values of x up to x=100000 which returned unique codes for all 50 states. Unfortunately they all had cases where the second letter of the abbreviation was the first letter of the state duplicated, which is not allowed (unless the letter appears twice in the state name.) So I decided to use the expression s[0]+s[1,8]*999[x] and found the smallest value of x that worked was 445.
Commented in test program, and output
f=->s{s[0]+            #Return character 0 of the input. Then..
(s[1,8]*999)[          #Concatenate 999 copies of the 8 characters starting at character 1 (or till end of name if state has less than 9 characters)
   445].upcase         #Return character 445 of the result, converted to uppercase.
}
"Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
Hawaii
Idaho
Illinois
Indiana
Iowa
Kansas
Kentucky
Louisiana
Maine
Maryland
Massachusetts
Michigan
Minnesota
Mississippi
Missouri
Montana
Nebraska
Nevada
New Hampshire
New Jersey
New Mexico
New York
North Carolina
North Dakota
Ohio
Oklahoma
Oregon
Pennsylvania
Rhode Island
South Carolina
South Dakota
Tennessee
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming".split($/).map{|i|p [f[i],i]}

["AA", "Alabama"]
["AL", "Alaska"]
["AI", "Arizona"]
["AS", "Arkansas"]
["CR", "California"]
["CA", "Colorado"]
["CT", "Connecticut"]
["DA", "Delaware"]
["FO", "Florida"]
["GO", "Georgia"]
["HA", "Hawaii"]
["IA", "Idaho"]
["IO", "Illinois"]
["ID", "Indiana"]
["IW", "Iowa"]
["KA", "Kansas"]
["KC", "Kentucky"]
["LA", "Louisiana"]
["MI", "Maine"]
["MA", "Maryland"]
["MH", "Massachusetts"]
["MG", "Michigan"]
["MO", "Minnesota"]
["MS", "Mississippi"]
["MU", "Missouri"]
["MN", "Montana"]
["NS", "Nebraska"]
["NE", "Nevada"]
["NM", "New Hampshire"]
["NR", "New Jersey"]
["NX", "New Mexico"]
["NO", "New York"]
["NC", "North Carolina"]
["ND", "North Dakota"]
["OI", "Ohio"]
["OO", "Oklahoma"]
["OR", "Oregon"]
["PL", "Pennsylvania"]
["RI", "Rhode Island"]
["SC", "South Carolina"]
["SD", "South Dakota"]
["TS", "Tennessee"]
["TX", "Texas"]
["UA", "Utah"]
["VR", "Vermont"]
["VN", "Virginia"]
["WG", "Washington"]
["WI", "West Virginia"]
["WS", "Wisconsin"]
["WO", "Wyoming"]

Where did you see the rule that the second letter could not be the same as the first? The example even had "AA" for Alabama.

The second letter must be one of the other letters of the state. AA for Alabama is fine because Alabama has two A's. KK is fine for Kentucky but not for Kansas for example.

Python 2, 39 bytes
lambda s:s[0]+s[906%len(s)or 1].upper()

Try it online!
Python 2, 39 bytes
lambda s:s[0]+s[306%len(s)or-3].upper()

Try it online!

JavaScript (ES6), 46 bytes
s=>s[0]+s[(s>'M')+1153%s.length].toUpperCase()

Demo

let f =

s=>s[0]+s[(s>'M')+1153%s.length].toUpperCase()

;[
  'Alabama',      'Alaska',   'Arizona',       'Arkansas',    'California','Colorado','Connecticut','Delaware',     'Florida',      'Georgia',
  'Hawaii',       'Idaho',    'Illinois',      'Indiana',     'Iowa',      'Kansas',  'Kentucky',   'Louisiana',    'Maine',        'Maryland',
  'Massachusetts','Michigan', 'Minnesota',     'Mississippi', 'Missouri',  'Montana', 'Nebraska',   'Nevada',       'New Hampshire','New Jersey',
  'New Mexico',   'New York', 'North Carolina','North Dakota','Ohio',      'Oklahoma','Oregon',     'Pennsylvania', 'Rhode Island', 'South Carolina',
  'South Dakota', 'Tennessee','Texas',         'Utah',        'Vermont',   'Virginia','Washington', 'West Virginia','Wisconsin',    'Wyoming'
]
.map(
  s => console.log(f(s), s)
)

Retina, 49 46 bytes
\B.*(?=[A-Zflmpxz])|\B.*(?=[hru])

T`l`L
!`^..

Try it online! If the state contains a second uppercase letter, or one of the letters flmpxz, then that becomes the second letter of the code. Otherwise, if it contains one of the letters hru, then that becomes the second letter of the code, otherwise just use the first two letters of the state.

JavaScript (ES6), 52 bytes
s=>s[0]+(s=s.slice(2,9))[146%s.length].toUpperCase()

f=
s=>s[0]+(s=s.slice(2,9))[146%s.length].toUpperCase()

states = `Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
Hawaii
Idaho
Illinois
Indiana
Iowa
Kansas
Kentucky
Louisiana
Maine
Maryland
Massachusetts
Michigan
Minnesota
Mississippi
Missouri
Montana
Nebraska
Nevada
New Hampshire
New Jersey
New Mexico
New York
North Carolina
North Dakota
Ohio
Oklahoma
Oregon
Pennsylvania
Rhode Island
South Carolina
South Dakota
Tennessee
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming`.split('\n')

states.forEach(state => console.log(f(state), state))

JavaScript (ES6), 52 bytes
s=>s[0]+(s[8]||s[s[1]=='o'?5:4]||s[2]).toUpperCase()

f=
s=>s[0]+(s[8]||s[s[1]=='o'?5:4]||s[2]).toUpperCase()

states = `Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
Hawaii
Idaho
Illinois
Indiana
Iowa
Kansas
Kentucky
Louisiana
Maine
Maryland
Massachusetts
Michigan
Minnesota
Mississippi
Missouri
Montana
Nebraska
Nevada
New Hampshire
New Jersey
New Mexico
New York
North Carolina
North Dakota
Ohio
Oklahoma
Oregon
Pennsylvania
Rhode Island
South Carolina
South Dakota
Tennessee
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming`.split('\n')

states.forEach(state => console.log(f(state), state))

Hawaii, Kansas, and Nevada have now got invalid abbreviations. (The second letter must be one of the other letters of the state.) I resolved this exact issue in my Jelly solution.

Ah, how tricky! I'll have to revert to my first answer, good thing I saved it.


text:
THE Magic Hexagon
There are many magic squares, but there is just one non-trivial magic hexagon, as Dr. James Grime explained, which is the following:
  18 17  3
 11  1  7 19
9  6  5  2 16
 14  8  4 12
  15 13 10

As it is done in Hexagony this is easiest written as just one line, by just reading it row by row:
18 17 3 11 1 7 19 9 6 5 2 16 14 8 4 12 15 13 10

Of course there are twelve such list representations of this magic hexagon in total, if you count rotations and reflections. For instance a clockwise 1/6 rotation of the above hexagon would result in
9 11 18 14 6 1 17 15 8 5 7 3 13 4 2 19 10 12 16

@Okx asked to list the remaining variants. The remaining lists are:
15 14 9 13 8 6 11 10 4 5 1 18 12 2 7 17 16 19 3
3 17 18 19 7 1 11 16 2 5 6 9 12 4 8 14 10 13 15
18 11 9 17 1 6 14 3 7 5 8 15 19 2 4 13 16 12 10
9 14 15 11 6 8 13 18 1 5 4 10 17 7 2 12 3 19 16

plus all the mentioned lists reversed.
Challenge
Write a program that outputs the magic hexagon as a list. You can choose any of the 12 reflections/rotations of the hexagon.
Please add a few words on how your solution works.

Can this be done in hexagony? If so, I will put a bounty to reward that answer.

@Mr.Xcoder Anything can be done in Hexagony. It probably just won't be very interesting, because I doubt that you'll be able to save bytes over just printing one of the lists literally.

Octave, 24 bytes
'IKRNFAQOHEGCMDBSJLP'-64

Try it online!

Jelly, 11 bytes
“JɼQⱮȦ>Ȯ’Œ?

A niladic link returning the list of the given orientation reflected left-right.
Try it online!
How?
Just the kind of thing for which I made Œ?
“JɼQⱮȦ>Ȯ’Œ? - Niladic link: no arguments
“JɼQⱮȦ>Ȯ’   - base 250 number, 18473955480703453
         Œ? - shortest permutation of some set of natural numbers one through to some N
            -   inclusive which would lie at that index in a list of all permutations of
            -   those same natural numbers when sorted lexicographically.
            -
            -   - for example 7Œ?:
            -   - since 7 is greater than 3! and less than 4!+1, it references four items
            -   - the sorted order of permutations of 4 items is:
            -   - [[1,2,3,4],[1,2,4,3],[1,3,2,4],[1,3,4,2],[1,4,2,3],[1,4,3,2],[2,1,3,4], ...]
            -   - so 7Œ? yields [2,1,3,4]

05AB1E, 14 bytes
Both solutions generate the list [3,17,18,19,7,1,11,16,2,5,6,9,12,4,8,14,10,13,15]
19Lœ•δn2м×„Á•è

Generates a list of all (sorted) permutations of the range [1...19] and indexes into that list with a base 255 compressed base 10 number.
Or 15 bytes runnable online
•áRвºñ*$vn+•20в

Decompresses a base 255 string to a base 10 number and converts to a list of base 20 digits.
Try it online!

Pyth, 15 bytes
.PC"A¡öò\x06\x11Ý"S19

(Control characters replaced with \x06 and \x11 for your viewing convenience.)
Try it online
How it works
   "A¡öò\x06\x11Ý"      magic string
  C                     convert to number n using codepoints as base-256 digits
.P                S19   nth lexicographic permutation of [1, …, 19]

Jelly, 21 bytes
18473955480703453œ?19

I really want to compress that big number, but I'm not sure how.
Try it online!

18473955480703453 is 1 bytes shorter.

Correct me if I'm wrong, but wouldn't a list of code page indices be shorter?

RE compression: It's the same number I used in mine. All you have to do is convert the number to bijective base 250 using ḃ250 and index into the code page (which is now easier as there is a niladic atom for it, ØJ).

@NickClifford it would be 21 bytes too (19 indexes, an open quote and a close quote).

@JonathanAllan Ah, got it.

SOGL, 15 bytes
³←@uΙΒQH√y׀“L«─

Explanation:
...“     push the number 4121998669867569415662783
    L«   push 20
      ─  convert 4121998669867569415662783 from base 10 to a base 20 number aka base 10 array

APL, 24 bytes
⎕A⍳'RQCKAGSIFEBPNHDLOMJ'

Try it online!
How?
⎕A                        ⍝ 'ABC...
   ⍳                       ⍝ indices of
    'RQCKAGSIFEBPNHDLOMJ'  ⍝ ← this vector

JavaScript (ES6), 49 bytes
[...'ih3b17j9652ge84cfda'].map(n=>parseInt(n,26))

console.log(
[...'ih3b17j9652ge84cfda'].map(n=>parseInt(n,26))
)

Mathematica, 37 bytes
36^^md1o3apsqxqkfhq6~IntegerDigits~20

Explanation (that may be already obvious as Mathematica is not a codegolf language, but according to the OP requirement):
36  : Number base
^^  : Input a number in arbitrary base. See BaseForm documentation
md1o3apsqxqkfhq6 : the number in base 36
~IntegerDigits~20 : convert to base 20 as list of digits

Output:
{18,17,3,11,1,7,19,9,6,5,2,16,14,8,4,12,15,13,10}

Note that [tag:kolmogorv-complexity] actually is about data compression.

Japt, 27 bytes
Inspired by rahnema1's solution.
`ikrnfaqogcmdbsjlp`¬®c -96

Try it online

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Four-Four-Four-Four!
This is the sequel to one of my previous challenges, Three-Three-Three!

Write a program (or function, or snippet) that takes no input and produces an output according to the following four Conditions.

Both the program and the output must be written such that:

At least 16 distinct characters appear (since 16 = 4 × 4).
The number of occurrences of each character is a multiple of 4.

Also:

The program and the output must not be the same (because programs consisting of a single literal like 1111222233334444 are quite boring).

Finally, the program:

Cannot be written as a string repeated 4 times (e.g. f();f();f();f();, 1234123412341234).

It's code-golf! In anticipation of a multi-way tie for 64 bytes, the first submission whose output also satisfies Condition 4 will be the winner.
Notes

You are encouraged not to use comments to satisfy Conditions 1 and 2.
Feel free to embed wild bananas in your variable names as you see fit.

So, point 4 is absolute and 3 is optional? I suggest changing the order if that's the case.

@StewieGriffin Will do.

@StewieGriffin In what way is this a duplicate? This challenge imposes more restrictions than its predecessor.

My previous answer, and the same answer adapted to the new rules: 'ans====ans  ans'%%%%ans==== ' '

And the 4th ' and 4th =?

Fixed. Also, the most upvoted Javascript submission adapted: alert(((alert|alert|alert||4444333311112222))), and CJam: 10,10,10,10,

The four trailing spaces in the CJam snippet isn't shown, but they're there.

All right, updated Condition 1 to require at least 16 different characters. I think that should discourage direct adaptations from Three-Three-Three. :)

16 distinct characters and a minimum code size of 64 bytes makes this not very interesting. Getting the perfect score will be trivial in most languages.

@darrylyeo hey I am from Spark (a year or so ago) username was also Christopher. Can you contact me in TNB?

If this wasn't considered a duplicate, how would Five-Five-Five-Five-Five and Six-Six-Six-Six-Six-Six be any more interesting? What about Two-Hundred-Fourty-Six^246? If all n for this sequence are valid, non-duplicates, PCCG will quickly fill with trivial variants.

Condition 4 still doesn't ban literal-only answers, so not only is this a duplicate, it's one that fails to fix the obvious exploit to the original question.

CJam, 16 bytes
4,4,4,4,@@@@\\\\

Try it online!

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Lights out, 7-segment version
Given a 7-segment display with some segments switched on and some off, find a sequence of digits (0-9), such that after toggling the corresponding segments for each digit, all segments are switched off.
Example
  _
  _    [3] =>     |   [1] =>    [OFF]
  _               |

Numbers and their corresponding segments:
 _         _   _         _    _    _    _    _
| |    |   _|  _|  |_|  |_   |_     |  |_|  |_|
|_|    |  |_   _|    |   _|  |_|    |  |_|   _|

Rules
Codegolf ⊨ shortest entry wins.
Input
A non-empty list of segments which are switched on, given as

A sequence of numbers. Segments are numbered from top to bottom, left to right; starting from 0 or 1. Numbers need not be in order.
A single 7-bit digit. MSB/LSB not specified (thus you can choose).

Non-numeric characters between numbers are allowed (but not required to be supported).
Eg. for number 7: 136 or 1010010 or 0100101
Output
A sequence of numbers to be "applied" to the display. Not restricted in any way, such as order of the digits. Eg. for initial state corresponding to number 1, valid outputs would be 1, 111, 010, etc.
An alternative output is a 10-bit digit (again, MSB/LSB is your choice). Eg. for 1 as input, the output would be 1000000000 or 0000000001.
Some combinations have several non-repetitive solutions, eg. segments corresponding to the uppercase letter H can be switched off by 013, but also 489 and 0258.
If no solution exists (which I believe is not possible), the output is empty.

This needs more specification. Which segments are included in each digit (for example, does 9 include the bottom segment?) Please draw all digits and indicate the numbers of the segments included in each.

Also, what formats are allowed for input? Will the segment numbers be given in order? What do we do if there is no solution?

"Some combinations have several non-repetitive solutions" Also, any permutation of a solution is another solution, right? (like 301 for H).

@Arnauld Yes, that's correct.

Nice challenge, BTW. :-)

There are 1024 possible digit sets and 128 possible segment sets, so that makes 8 digit set solutions for each segment set. These can be obtained by a combination of set differences with three sets such as the following: 02468, 12358, 12369. This means that it's possible to avoid considering up to three digits (although 7 is always necessary) when determining an answer.

Looks like somebody likes Unicode :)

Proof that a solution always exists: it suffices to find solutions for each individual segment. Solutions for the horizontal segments, from top to bottom, are 17, 08, and 1479. Solutions for the upper vertical segments, left to right, are 39 and 59. Solutions for the lower vertical segments, left to right, are 56 and 2389.

@Neil: I see why 2 is necessary (it's the only way to get at the lower-right vertical segment); why is 7 necessary?

@GregMartin 2 isn't always necessary, because you can replace it with either 0468, 1358, or 1369, depending on whether you want a 0, 8 or 9 in your answer, but there's no way to eliminate 7 at all, and I think you have to have at least one of 1 and 3.

@Challenger5 Did it display incorrectly in your browser? If so, which browser and system do you use? I'm using FF on Fedora and it looked OK, but then someone edited the Unicode part of my task description, saying he "fixed alignment". After that edit, the alignment was wrong in my browser. Alas, I guess we're not ready for Unicode yet... Or maybe I just don't know how to use it properly :-]

You can also use the XOR space explorer to find out how many segment sets can be generated from a given set of digits.

Jelly, 26 25 bytes
2ṗ⁵’µ×“wØ][:koR¶{‘^/=µÐfḢ

Try it online!
Takes input as a 7-bit integer. Returns the binary form of a 10-bit integer.
This just brute forces all possibilities. Remove the Ḣ to get all possible outputs or replace it with an X to get a random possible output.
Magic Visualization Program!
How it works
2ṗ⁵’µ×“wØ][:koR¶{‘^/=µÐfḢ  - main link, takes one integer
2ṗ⁵’                       - generate all length-10 binary arrays
    µ                µÐf   - now we find those arrays which correspond to digit-
                              sequences which work to switch off all segments:
                              Filter (keep) those arrays which:
     ×                      - multiplied by
      “wØ][:koR¶{‘          - [119, 18, 93, 91, 58, 107, 111, 82, 127, 123]
                               (encoding for turned-on segments given number)
                  ^/        - reduced by XOR
                    =      - are equal to (implicit) the program's input
                        Ḣ  - output the first of these valid arrays

The array of numbers (“wØ][:koR¶z‘) might contain an error. Your number 9 lacks the bottom segment (compare 9 in your visualization to the one in task description). Otherwise very nice, especially the visualization!

@kyrill Fixed! Just required a slight change in the list literal.

Mathematica, 40 bytes
BitXor@@{260,802,10,514,3,266,293}[[#]]&

(It may be golfed more by choosing output for each segment carefully and switch between LSB and MSB.)
Take input as a list of positions for example {2,4,5,7} and output a 10-bit number (384 = 0110000000 in binary) in MSB order (0,...,9).
In the example it correspond to
  |_
  |_

and the output correspond to {7,8}.
Explanation:
The magic numbers (hardcoded list) is the output which is returned for each segment. (encoded in binary) And, if a number appear in the list twice, the effect is the same of it not being appear, so bitwise XOR is used. We just need to XOR the output of possible value of the segments turned on.

JavaScript (ES6), 60 bytes
n=>[65,35,55,42,48,54,110].reduce((r,v,i)=>r^=n>>i&1&&v+v,0)

This works because:

Toggling 1 and 7 toggles the top segment only
Toggling 1, 2 and 6 toggles the top left segment only
Toggling 1, 2, 3, 5 and 6 toggles the top right segment only
Toggling 2, 4 and 6 toggles the centre segment only
Toggling 5 and 6 toggles the bottom left segment only
Toggling 2, 3, 5 and 6 toggles the bottom right segment only
Toggling 2, 3, 4, 6 and 7 toggles the bottom segment only

Not sure whether this should be accepted as a winner, because obviously you took some inspiration from Arnauld. But then, he also took some inspiration from your comment. Anyways, nice answer, both of you!

@kyrill My updated answer was also a suggestion from Neil. There's no doubt that his answer wins so far.

Jelly, 12 bytes
ị“A#7*06n‘^/

Try it online!
This does not brute force, and it is remarkably shorter than my other solution. Takes input as a list of turned-on segments, and outputs as LSB is top segment.
Output as list of digit moves.
How it works
This is going to be quick
ị“A#7*06n‘^/ - main link, takes input as a list of turned-on segments (eg. [1,3,6])
 “A#7*06n‘   - list literal [65,35,55,42,48,54,110] where each element is a 7-bit
                 integer, where each integer corresponds to how to turn off
                 a segment (eg. turn off the first segment with 7 and 1 =>2^7+2^1=>64)
ị            - get the elements in the list corresponding to the input indices
          ^/ - XOR reduce these elements to get a single 7-bit integer

Can't you take advantage of the fact that repetitive solutions are allowed when using this algorithm, to replace the XOR-reduce with something shorter (such as a flatten)? Or am I missing something?

The code as I have it now generates a list of 7-bit integers approximately equal to 1*use digit 1 + 2*use digit 2 + 4*use digit 3 ... 64*use digit 7, then XOR-reduces them @ais523. Flattening would work on a list of digits used which takes more characters.

JavaScript (ES6), 117 107 101 86 84 bytes
Saved 15 bytes thanks to Neil
Takes input as a 7-bit integer, where the LSB is the upper segment. Returns a 10-bit integer where the LSB is digit 0.
f=(n,k)=>[83,0,57,73,10,71,87,1,91,75].reduce((n,v,i)=>n^=k>>i&1&&v+36,n)?f(n,-~k):k

Demo

f=(n,k)=>[83,0,57,73,10,71,87,1,91,75].reduce((n,v,i)=>n^=k>>i&1&&v+36,n)?f(n,-~k):k

console.log("'1' shape", "-->", f(0b0100100).toString(2))
console.log("'7' shape", "-->", f(0b0100101).toString(2))
console.log("'H' shape", "-->", f(0b0111110).toString(2))

Recursion is shorter: f=(n,k=1023)=>[83,0,57,73,10,71,87,1,91,75].reduce((n,v,i)=>n^=k>>i&1&&v+36,n)?k--&&f(n,k):k. Or if you assume an answer exists, f=(n,k=0)=>[83,0,57,73,10,71,87,1,91,75].reduce((n,v,i)=>n^=k>>i&1&&v+36,n)?f(n,k+1):k.

@Neil Thanks! Yes, an answer always exists.

As it's always possible to create an answer using the digits 1-7, you can save a further 8 bytes by removing the 83 and the ,91,75 and using k+2.


text:
Can my favourite team still become Football Champion?
As a fan of an at most moderately successful footballBE team, towards the end of the season I often wonder whether my favourite team still has any theoretical chance left of becoming champion. Your task in this challenge is to answer that question for me.
Input
You will recieve three inputs: the current table, the list of remaining matches, and the current position of the team we are interested in.
Input 1: The current table, a sequence of numbers were the i-th number are the points gained by team i so far. For example, the input
[93, 86, 78, 76, 75] encodes the following table (only the last column is of importance):

Input 2: The remaining matches, a sequence of tuples where each tuple (i,j) stands for a remaining match between team i and j. In the above example, a second input of [(1,2), (4,3), (2,3), (3,2), (1,2)] would mean that the remaining matches are:
Chelsea vs Tottenham, Liverpool vs Man. City, Tottenham vs Man. City, Man. City vs Tottenham, Chelsea vs Tottenham

Input 3: The current position of the team we are interested in. For example, an input of 2 for the above example would mean that we'd like to know whether Tottenham can still become champion.
Output
For each remaining match of the form (i,j), there are three possible outcomes:

Team i wins: Team i gets 3 points, team j gets 0 points
Team j wins: Team i gets 0 points, team j gets 3 points
Draw: Team i and j both get 1 point

You must output a truthy value if there is some outcome for all remaining games such that at the end, no other team has more points than the team specified in the 3rd input. Otherwise, output a falsy value.
Example: Consider the exemplary input from the above section:
Input 1 = [93, 86, 78, 76, 75],
Input 2 = [(1,2), (4,3), (2,3), (3,2), (1,2)],
Input 3 = 2
If team 2 wins all its remaining matches (i.e. (1,2), (2,3), (3,2), (1,2)), it gets 4*3 = 12 additional points; none of the other teams gets any points from these matches. Let's say the other remaining match (i.e. (4,3)) is a draw. Then the final scores would be:
 Team 1: 93, Team 2: 86 + 12 = 98, Team 3: 78 + 1 = 79, Team 4: 76 + 1 = 77, Team 5: 75

This means that we have already found some outcome for the remaining matches such that no other team has more points than team 2, so the output for this input must be truthy.
Details

You may assume the first input to be an ordered sequence, i.e. for i < j, the i-th entry is equal to or greater than the j-th entry. The first input may be taken as a list, a string or the like.
You may take the second input as a string, a list of tuples or the like. Alternatively, you may take it as a two-dimensional array a where a[i][j] is the number of entries of the form (i,j) in the list of remaining matches. For example, a[1][2] = 2, a[2][3] = 1, a[3][2] = 1, a[4][3] = 1
corresponds to [(1,2), (4,3), (2,3), (3,2), (1,2)].
For the second and third input, you may assume 0-indexing instead of 1-indexing.
You may take the three inputs in any order.

Please specify the exact input format you chose in your answer.
Side node: The problem underlying this challenge was shown to be NP-complete in "Football Elimination is Hard to Decide Under the 3-Point-Rule". Interestingly, if only two points are awarded for a win, the problem becomes solvable in polynomial time.
Test Cases
All test cases are in the format Input1, Input2, Input3.
Truthy:

[93, 86, 78, 76, 75], [(1,2), (4,3), (2,3), (3,2), (1,2)], 2
[50], [], 1
[10, 10, 10], [], 3
[15, 10, 8], [(2,3), (1,3), (1,3), (3,1), (2,1)], 2

Falsy:

[10, 9, 8], [], 2
[10, 9, 9], [(2,3), (3,2)], 1
[21, 12, 11], [(2,1), (1,2), (2,3), (1,3), (1,3), (3,1), (3,1)], 2

Winner
This is code-golf, so the shortest correct answer (in bytes) wins. The winner will be chosen one week after the first correct answer is posted.

Fair warning. We have a large american population so adding (soccer) to the title may help avoid confusion

@Christopher it's football. Americans have it wrong

Also go Chelsea!

@cairdcoinheringaahing Americans are NEVR wrong. But my point still stands

@Christopher I can't tell if "NEVR" was intentional or not

@cairdcoinheringaahing it was XD

Nobody remembers Australians and Canadians.

Haskell (Lambdabot), 84 bytes
Thanks to @bartavelle for saving me a byte.
Without Lambdabot, add 20 bytes for import Control.Lens plus a newline.
The function takes its arguments in the same order as described in the OP, 0-indexed. Its second argument (the list of remaining matchups) is a flat list of indexes (e.g. [1,2,4,1] corresponds to [(Team 1 vs Team 2), (Team 4 vs Team 1)]).
The rules are a little vague as to whether or not this is allowed. If it isn't allowed, the function can take input in the format provided by the examples – a list of tuples. In that case, add 2 bytes to this solution's score, due to replacing a:b:r with (a,b):r.
(!)=(+~).element
(t?(a:b:r))s=any(t?r)[a!3$s,b!3$s,b!1$a!1$s]
(t?_)s=s!!t==maximum s

Explanation:
The first line defines an infix function ! of three variables, of type (!) :: Int -> Int -> [Int] -> [Int], which increments the value at a given index in a list. Since, oftentimes, code is easier to understand than words (and since Haskell syntax can be weird), here's a Python translation:
def add(index, amount, items):
    items[index] += amount
    return items

The second line defines another infix function ?, also of three variables (the challenge input). I'll rewrite it more readably here:

(t ? a:b:r) s = any (t ? r) [a ! 3 $ s, b ! 3 $ s, (b ! 1 $ a) ! 1 $ s]
(t ? _) s = (s !! t) == maximum s

This is a recursive implementation of exhaustive search. It recurs over the list of remaining games, branching on the three possible outcomes, and then, once the list is empty, checking whether or not our team has the maximum number of points. Again in (non-idiomatic) Python, this is:
def can_still_win(standings, games_left, our_team):
    if games_left == []:
        return standings[our_team] == max(standings)
    team1, team2, other_games = games_left[0], games_left[1], games_left[2:]
    team1Wins, team2Wins, tie = standings.copy(), standings.copy(), standings.copy()
    team1Wins[team1] += 3
    team2Wins[team2] += 3
    tie[team1] += 1
    tie[team2] += 1
    return (can_still_win(team1Wins, other_games, our_team)
            or can_still_win(team2Wins, other_games, our_team)
            or can_still_win(tie, other_games, our_team))

Try it online!
*Sadly, TiO doesn't support Lens, so this link won't actually run.

The flat list of indices is allowed as input format :)

It seems that you can save a byte by not using the guards : Try it online!

@bartavelle Good call! Thanks! I managed to shave off another byte by swapping the order of the function definitions so I could replace [] with _.

Microsoft SQL Server, 792 bytes
CREATE FUNCTION my.f(@s XML,@m XML,@ INT)RETURNS TABLE RETURN
WITH s AS(SELECT s.value('@p','INT')p FROM @s.nodes('S')s(s)),
m AS(SELECT m.value('@i','INT')i,m.value('@j','INT')j FROM @m.nodes('M')m(m)),
a AS(SELECT ROW_NUMBER()OVER(ORDER BY-p)t,p FROM s),
b AS(SELECT p+3*(SELECT COUNT(*)FROM m WHERE t IN(i,j))o FROM a WHERE t=@),
c AS(SELECT i,j,ROW_NUMBER()OVER(ORDER BY 1/0)k FROM m WHERE @ NOT IN(i,j)),
d AS(SELECT COUNT(*)u,POWER(3,COUNT(*))-1 v FROM c UNION ALL SELECT u,v-1 FROM d WHERE v>0),
e AS(SELECT v,u,v/3 q,v%3 r FROM d UNION ALL SELECT v,u-1,q/3,q%3 FROM e WHERE u>1),
f AS(SELECT v,p+SUM(IIF(t=i,r,(2-r))%3*3/2)s FROM a,c,e WHERE t IN(i,j)AND k=u GROUP BY v,t,p),
g AS(SELECT MAX(s)x FROM f GROUP BY v)SELECT SUM(IIF(o<ISNULL(x,p),0,1))f FROM a,(b OUTER APPLY g)WHERE t=1;

The function returns 0 for a false outcome and more than 0 for a truthy one.
The whole snippet:
SET NOCOUNT ON;
--USE tempdb;
USE rextester;
GO
IF SCHEMA_ID('my') IS NULL EXEC('CREATE SCHEMA my');
ELSE BEGIN
  IF OBJECT_ID('my.f', 'IF') IS NOT NULL DROP FUNCTION my.f;
  IF OBJECT_ID('my.s', 'U') IS NOT NULL DROP TABLE my.s;
  IF OBJECT_ID('my.m', 'U') IS NOT NULL DROP TABLE my.m;
  IF OBJECT_ID('my.c', 'U') IS NOT NULL DROP TABLE my.c;
END;
GO
CREATE TABLE my.c( -- Test cases
  c INT PRIMARY KEY CLUSTERED CHECK(c > 0), -- Test Case Id
  n INT CHECK(n > 0), -- Current position of the team of interest
);
CREATE TABLE my.s( -- Standings
  a INT FOREIGN KEY REFERENCES my.c(c) CHECK(a > 0), -- Test cAse Id
  p INT CHECK(p > 0) -- Team pts
);
CREATE TABLE my.m( -- Matches
  s INT FOREIGN KEY REFERENCES my.c(c) CHECK(s > 0), -- Test caSe Id
  i INT CHECK(i > 0), -- Team i
  j INT CHECK(j > 0), -- Team j
  CHECK(i != j)
);
GO
INSERT my.c(c, n) VALUES (1, 2), (2, 1), (3, 3), (4, 2), (5, 2), (6, 1), (7, 2);
INSERT my.s(a, p) VALUES (1, 93), (1, 86), (1, 78), (1, 76), (1, 75),
(2, 50), (3, 10), (3, 10), (3, 10), (4, 15), (4, 10), (4, 8),
(5, 10), (5, 9), (5, 8), (6, 10), (6, 9), (6, 9), (7, 21), (7, 12), (7, 11);
INSERT my.m(s, i, j) VALUES (1, 1, 2), (1, 4, 3), (1, 2, 3), (1, 3, 2), (1, 1, 2),
(4, 2, 3), (4, 1, 3), (4, 1, 3),(4, 3, 1), (4, 2, 1), (6, 2, 3), (6, 3, 2),
(7, 2, 1), (7, 1, 2), (7, 2, 3), (7, 1, 3), (7, 1, 3), (7, 3, 1), (7, 3, 1);
GO
CREATE FUNCTION my.f(@s XML,@m XML,@ INT)RETURNS TABLE RETURN
WITH s AS(SELECT s.value('@p','INT')p FROM @s.nodes('S')s(s)),
m AS(SELECT m.value('@i','INT')i,m.value('@j','INT')j FROM @m.nodes('M')m(m)),
a AS(SELECT ROW_NUMBER()OVER(ORDER BY-p)t,p FROM s),
b AS(SELECT p+3*(SELECT COUNT(*)FROM m WHERE t IN(i,j))o FROM a WHERE t=@),
c AS(SELECT i,j,ROW_NUMBER()OVER(ORDER BY 1/0)k FROM m WHERE @ NOT IN(i,j)),
d AS(SELECT COUNT(*)u,POWER(3,COUNT(*))-1 v FROM c UNION ALL SELECT u,v-1 FROM d WHERE v>0),
e AS(SELECT v,u,v/3 q,v%3 r FROM d UNION ALL SELECT v,u-1,q/3,q%3 FROM e WHERE u>1),
f AS(SELECT v,p+SUM(IIF(t=i,r,(2-r))%3*3/2)s FROM a,c,e WHERE t IN(i,j)AND k=u GROUP BY v,t,p),
g AS(SELECT MAX(s)x FROM f GROUP BY v)SELECT SUM(IIF(o<ISNULL(x,p),0,1))f FROM a,(b OUTER APPLY g)WHERE t=1;
GO
SELECT c, f
FROM my.c
OUTER APPLY(SELECT p FROM my.s S WHERE a = c FOR XML AUTO)S(s)
OUTER APPLY(SELECT i, j FROM my.m M WHERE s = c FOR XML AUTO)M(m)
OUTER APPLY my.f(s, m, n)
ORDER BY c
OPTION(MAXRECURSION 0);

Check It Online!

Out of all languages why this xD

For a diversity :)

That must have been fun to program :)

Python 2, 242 221 bytes
from itertools import*
def u(S,M,t,O):
 for m,o in zip(M,O):
  if t in m:S[t]+=3
  else:S[m[0]]+=(1,3,0)[o];S[m[1]]+=(1,0,3)[o]
 return S[t]>=max(S)
f=lambda s,m,t:any(u(s[:],m,t,O)for O in product([0,1,2],repeat=len(m)))

Try it online!
After a first pass with basic golf-thinking. Takes input with 0-based indexing; test cases in TIO adjust for this via the function F.
The product([0,1,2],repeat=len(m)) iteration evaluates the possible outcomes over tie/win/loss for each match unless the team-of-interest (TOI) is a part of the match (in which, the TOI is always assumed to win).

JavaScript (ES6), 145 bytes
(s,d,t,o=[],g=(c=s,i=0)=>d[i]?[3,,0,3,1,1].map((a,j)=>(j%=2,r=j?r:[...c],r[d[i][j]]+=a,g(r,i+1))):o.push(c))=>o.some(r=>r[t]==Math.max(...r),g())

Takes score input as an array ([93,86,78,76,75]), upcoming games as an array of 2-value arrays ([[0,1],[3,2],[1,2],[2,1],[0,1]]), and team index as an integer (1). Everything is 0-indexed.
Test Snippet

let f=
(s,d,t,o=[],g=(c=s,i=0)=>d[i]?[3,,0,3,1,1].map((a,j)=>(j%=2,r=j?r:[...c],r[d[i][j]]+=a,g(r,i+1))):o.push(c))=>o.some(r=>r[t]==Math.max(...r),g())

console.log("---Truthy---")
console.log(f([93, 86, 78, 76, 75], [[0,1], [3,2], [1,2], [2,1], [0,1]], 1))
console.log(f([50], [], 0))
console.log(f([10, 10, 10], [], 2))
console.log(f([15, 10, 8], [[1,2], [0,2], [0,2], [2,0], [1,0]], 1))
console.log("---Falsy---")
console.log(f([10, 9, 8], [], 1))
console.log(f([10, 9, 9], [[1,2],[2,1]], 0))
console.log(f([21, 12, 11], [[1,0], [0,1], [1,2], [0,2], [0,2], [2,0], [2,0]], 1))
.as-console-wrapper{max-height:100%!important}


text:
Build a staircase for my kid
The other day, my son asked me to build him a staircase using Lego-ish blocks. And I came up with something like this:

Then my kid asked me for a program using the least number of bytes that generated a similar staircase in a computer screen. I am not that good at code-golf, so I need your help. I need a program that:

Receives a positive integer with the number of levels the staircase needs to have.
Outputs a drawing of a staircase, with the pattern you see in the image.

The output will be in text format but the bricks can be distinguished one from another. For instance, you may use the '█' character as half a block and paint it in any color you want, or just choose any character of your choice.
Restrictions:

Blocks need to be of three different colors, which will be used as long as possible (if input is 1 or 2 there are not enough blocks to use all three colors). If you want, you may use the '░▒▓' characters, for instance, or just select three different characters.
No two blocks of the same color or pattern can be side to side in a single row.

My son does not really care about trailing spaces or new lines as long as a staircase is drawn.
Examples (sorry for the bad choice of characters):
Input: 1
Output:
██

Input: 2
Output:
██
 ▓▓

Input: 3
Output:
██
 ▓▓
██░░

Input: 5
Output:
██
 ██
██░░
 ██░░
██░░▓▓

Tell your child that the fun is in building / programming it himself :-)

@LuisMendo He is only three, he does not even know what programming is. :-)

By the way, this is my first question here, so any advice, corrections and/or improvements will be welcome!

Welcome to the site! Combining ASCII art and graphical output is usually frowned upon, as it results in sort of two parallel challenges. Also, if you go for ASCII, I would allow actual ASCII characters to be used (I think you already do, but perhaps be more explicit), as some languages may have difficulty with non ASCII characters

@LuisMendo thank you for the advice! I have restricted the game to just ASCII art.

FYI the blocks are called Duplo

I'm not clear on what it means for blocks to use three different colors as long as possible.

@dzaima no, the order does not matter as long as two bricks of the same color are not side to side.

@CarlosAlejo Does that mean we can only use two colors as long they alternate on each line?

@xnor no, you need to use three different "colors" in any way you want.

@cairdcoinheringaahing duplo doesn't have round buttons.

Do I need to handle case 0 or can I assume it will be at least 1?

@Christoph no, you can assume the integer will always be positive.

@cairdcoinheringaahing The blocks in the Question aren't Duplo, Duplo is Lego compatible, those are Lego Baby. They were originally called Duplo Primo and I wish they had a different name than either of those two, but they are technically a different product than both Lego and Duplo.

You may have to change the accepted answer, following Jonathan Allan's recent edit

Jelly,  21 19  16 bytes
d2SR+%3x2⁶;ṙḂµ€Y

A full program printing the result.
Uses 00, 11, and 22 as the blocks.
Try it online!
How?
d2SR+%3x2⁶;ṙḂµ€Y - Main link: number n
             µ€  - for €ach "row" in n (i.e. for row, r = 1 to n inclusive):
d2               -   divmod 2   -> [integer-divide by 2, remainder] i.e. [r/2, r%2]
  S              -   sum        -> r/2 + r%2
   R             -   range      -> [1, 2, 3, ..., r/2 + r%2]
    +            -   add r      -> [r+1, r+2, r+3, ..., r + r/2 + r%2]
     %3          -   modulo 3   -> [r%3+1, r%3+2, r%3+0, ..., (r + r/2 + r%2)%3]
                 -   e.g.: r: 1  , 2  , 3    , 4    , 5      , 6      , 7       , ...
                             [2], [0], [1,2], [2,0], [0,1,2], [1,2,0], [2,0,1,2], ...
       x2        -   times 2 - repeat each twice (e.g. [2,0,1,2] -> [2,2,0,0,1,1,2,2]
         ⁶       -   literal space character
          ;      -   concatenate (add a space character to the left)
            Ḃ    -   r mod 2 (1 if the row is odd, 0 if it is even (1 at the top))
           ṙ     -   rotate (the list) left by (r mod 2)
               Y - join with newlines
                 - implicit print (no brackets printed due to the presence of characters)

Python 2, 55 bytes
i=2
exec"print(i%2*' '+`2%i*1122`*i)[:i];i+=1;"*input()

Try it online!
Cycles between blocks of 22, 44, except the top row is 00. For example, on input 10, prints
00
 22
2244
 2244
224422
 224422
22442244
 22442244
2244224422
 2244224422

Prints rows of increasing length i=2,3,.. by creating a space for odd lengths, repeating the pattern i times, and trunctating to length i. The pattern is 2244 for all rows except the first one i=2 for which it's 0. This is achieved with the arithmetic expression 2%i*1122.

Uses only two colors for case 3.

Very clever fix!

JavaScript (ES6), 80 bytes
n=>eval(`for(s=11,i=1;i++<n;)s+='\\n'+(' '+'2233'.repeat(n)).substr(i%2,i+1);s`)

f=
n=>eval(`for(s=11,i=1;i++<n;)s+='\\n'+(' '+'2233'.repeat(n)).substr(i%2,i+1);s`)
console.log(f(+prompt()))

JavaScript (ES6), 87 bytes
Previous solution.
n=>[11,...Array(n).fill(' '+'2233'.repeat(n)).map((r,n)=>r.slice(n%2,n+3+n%2))].join`
`

05AB1E, 22 21 20 18 17 bytes
Uses the interesting fact that 4^(N+2)/5 = [3,12,51,204,...] = b[11,1100,110011,11001100,...]
F4NÌm5÷bDðì}r·IF,

Try it online!
Explanation
F                     # for N in 0...input-1 do
 4                    # push 4
  NÌ                  # push N+2
    m                 # push 4^(N+2)
     5÷               # integer division by 5
       b              # convert to binary
        D             # duplicate
         ðì           # prepend a space to the copy
           }          # end loop
            r         # reverse stack
             ·        # multiply top of stack by 2
              IF      # input times do
                ,     # print with newline

Sorry, I improved my answer - nice method though!

@JonathanAllan: Of course you did ;) Thanks! Pretty cool idea of handling the indentation with mod2 rotations in your answer.

SOGL, 31 28 27 25 bytes
∫³2\@*O"²b“2⁵I%*r*;I»«nKp

Explanation:
∫                          iterate input times, pushing 1-indexed counter
 ³                         get 3 total copies of it on stack
  2\                       1 if divides by 2, else 0
    @*                     get that many spaces
      O                    output in a new line
       "²b“                push 1122
           2⁵I%*           multiply 1122 by 2%(iteration+1)
                r          convert to string
                 *         multiply by iteration
                  ;I»«     get one iteration variable ontop of stack
                      n    increase, floor divide by 2, multiply by 2 (gets the amount of bricks in a line)
                       Kp  split that multiplied string in pieces of that length

using this technique
Example output for 9:
00
 22
2244
 2244
224422
 224422
22442244
 22442244
2244224422

22 bytes
∫³2\@*O"²b“2⁵I%*;I»«mp

The command m has been documentated on the 1st SOGL commit, just not implemented.

PHP, 61 59
aa<?for(;++$i<$argn;)echo"
",str_pad(" "[~$i&1],2+$i,bbcc);

works pretty much like the python versions but uses all three colors if possible. No trailing new line.
-2 bytes by @user63956. Thanks !

You can save two bytes with aa<?for....

Pyth, 29 bytes
VQI!%hN2pd)Vh/N2p*2@G%+NH3)pb

Test it online!
Explanations
VQI!%hN2pd)Vh/N2p*2@G%+NH3)pb

VQ                               For N in range(0, input)
  I!%hN2pd)                      If N is odd, print a leading space
           Vh/N2          )      For H in range(0, N / 2 + 1)
                   @G%+NH3       Select the letter at position (N + H) % 3 in the alphabet
                 *2              Then make it a two letters string ("aa" or "bb" or "cc")
                p                Print it
                           pb    End the line by printing a new line

I am sure there are a lot of ways to shorten that code, but I am king of tired right now... Will try later.

Batch, 125 bytes
@set s=█
@for /l %%i in (2,1,%1)do @call:c
:c
@set s= %s:█= %
@set s=%s:▓=█%
@set s=%s:░=▓%
@set s=%s:  =░░%
@echo %s%

Note: Save this in CP437 or CP850 or some such. Works by rotating the colours each time. Since I can't map over the string to perform the rotation, I use four replacements, using spaces as a temporary stage. This then also allows me to prefix a space every line, so that two spaces turn into a new block. Sample output:
░░
 ▓▓
░░██
 ▓▓░░
░░██▓▓

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Make your keyboard into a keyboard
Task
You should write a program that when a button is pressed, it outputs a different sound for each key.
The keys that you will use are:
1!2"34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm

The notes begin at C and each key above adds one semitone.
Lets make it slightly easier for you though. You can choose between 2 similar tasks,

1) Output a different note when a key is pressed that continues until another key is pressed. This program runs indefinitely
2) Take a string as input that only contains the characters above that will output each note for exactly 1 second (0.05 second variation allowed)

Input

A key being pressed
A single string containing only the symbols above

Output

A single musical note that sounds until another key is pressed
A series of notes, each one 1 second long

Notes
Letter | Note
-------+-------
   1   |  C
   !   |  C#
   2   |  D
   "   |  D#
   3   |  E
   4   |  F
   $   |  F#
   5   |  G
   %   |  G#
   6   |  A
   ^   |  A#
   7   |  B
   8   |  C
   *   |  C#
   9   |  D
   (   |  D#
   0   |  E
   q   |  F
   Q   |  F#
   w   |  G
   W   |  G#
   e   |  A
   E   |  A#
   r   |  B
   t   |  C    <-- middle C
   T   |  C#
   y   |  D
   Y   |  D#
   u   |  E
   i   |  F
   I   |  F#
   o   |  G
   O   |  G#
   p   |  A
   P   |  A#
   a   |  B
   s   |  C
   S   |  C#
   d   |  D
   D   |  D#
   f   |  E
   g   |  F
   G   |  F#
   h   |  G
   H   |  G#
   j   |  A
   J   |  A#
   k   |  B
   l   |  C
   L   |  C#
   z   |  D
   Z   |  D#
   x   |  E
   c   |  F
   C   |  F#
   v   |  G
   V   |  G#
   b   |  A
   B   |  A#
   n   |  B
   m   |  C

Rules

You may choose between the tasks but please say which one in your answer
You are given a ±0.05 second variation in task 2
Each symbol along increments the tone by 1 semitone.
The individual notes are shown above
This is a code-golf so shortest code wins

This was originally taken from here with caird coinheringaahing's consent

To open this up to languages that don't have audio libraries, I recommend a third output format: a WAV file containing the option 2 output, written to stdout. That would allow entries in any language that can print binary data.

Python 3, 154 140 bytes
from winsound import*
for i in input():Beep(int(65.406*2**('1!2"34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm'.find(i)/12)),999)

I chose the second task type.
The loop passes through each character and looks for the index of this element in the string. This index is the number of semitone up from Low C ('1'). Calculation of the desired frequency is made by this formula.
P.S. This library works only in Windows.
-13 bytes thanks to ovs.
-1 byte thanks to Jonathan Allan.

You should probably mention that this only works on Windows.

Golfed to 141 bytes: from winsound import* for i in input():Beep(int(65.406*2**('1!2"34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm'.find(i)/12)),1000)

But the question asked for a program....

The 0.05 tolerance should allow you to use 999.

@NeilA. https://codegolf.meta.stackexchange.com/a/6912/4163

JavaScript (ES6), 247 or 230 bytes
Decided to try out both options.
Saved a few bytes thanks to @darrylyeo for suggesting the with statement.
Thanks to @Кирилл Малышев for pointing out an issue with .search().
Option 1 - Keyboard Input, 252 246 247 bytes
_=>{c=new AudioContext;q=1;with(c.createOscillator())connect(c.destination),I.oninput=_=>(~(i='1!2"34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm'.indexOf(I.value,I.value=""))&&(frequency.value=65.4*2**(i/12),q&&start(q=0)))}

<input id=I

Relies on the input element receiving the actual letter typed, instead of character codes. Focus must be on the input box.
Option 2 - String Input, 234 229 230 bytes
s=>{c=new AudioContext;with(c.createOscillator())connect(c.destination),[...s].map((c,i)=>frequency.setValueAtTime(65.4*2**('1!2"34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm'.indexOf(c)/12),i)),start(),stop(s.length)}

Simply takes the string as the function parameter.
Combined Snippet
I suggest turning down your volume being running this, it can be loud. In order to stop playback, the snippet required adding o= inside each with(c.createOscillator()).

f= // keyboard input
_=>{c=new AudioContext;q=1;with(o=c.createOscillator())connect(c.destination),I.oninput=_=>(~(i='1!2"34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm'.indexOf(I.value,I.value=""))&&(frequency.value=65.4*2**(i/12),q&&start(q=0)))}

g= // string input
s=>{c=new AudioContext;with(o=c.createOscillator())connect(c.destination),[...s].map((c,i)=>frequency.setValueAtTime(65.4*2**('1!2"34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm'.indexOf(c)/12),i)),start(),stop(s.length)}

swap=_=>{keyboard=!keyboard;A.innerHTML=keyboard?"Keyboard":"String";S.style.display=keyboard?"none":"inline";window.c&&c.close();window.o&&o.stop();keyboard?f():I.oninput=null;I.value="";}
keyboard=0;
swap();
 Input:

<input id="I">
<button id="S" onclick="g(I.value)">Run</button>

<button onclick="swap()">Swap</button>

You can put the oscillator object in a with statement to golf out all instances of o., like this: _=>{c=new AudioContext;with(c.createOscillator())connect(c.destination),I.oninput=_=>(~(i='1!2"34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm'.search(I.value,I.value=""))&&(frequency.value=65.4*2**(i/12),r||(start(),r=1)))}

@darrylyeo Thanks, will implement the with statement, but it breaks the last bit (o.r||(o.start(),o.r=1)) since I was using the fact that o.r is undefined up until that point, but now it errors out since r hasn't been declared. Turns out it was shorter to just declare that variable separate from any objects, so I did that.

When you enter the symbol '$', a very high frequency is produced.

@КириллМалышев Good catch, that's cause .search() treats the input as regex. Switched to .indexOf().

AHK, 130 bytes
s=1!2"34$5`%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm
Loop,Parse,1
SoundBeep,55*2**((InStr(s,A_LoopField,1)-10)/12),999

I chose Option 2.
Explanation:
Storing the search string as the variable s was shorter than escaping that mess directly in the SoundBeep function. I had to escape the percent sign since that's an escape character for variable names but the rest of the string is OK as is.
By default, the variable 1 is the first input parameter. Feeding that into a parsing loop without specifying a delimiter will result in each character in the input string being analyzed individually.
SoundBeep takes in a frequency in Hz and a duration in milliseconds and plays that note for that long.
The fun part was figuring out the right frequencies. Referencing the piano key frequency table from Wikipedia and the formula on the same page, I found the shortest encoding was to use A1 as the reference note because it's frequency is the nice round 55 Hz. Since we want to start at C1, we have to adjust from A1 (the 13th note) to C1 (the 4th note). That, plus the fact that InStr is one-indexed, is why we subtract 10 from the result of the InStr function.

authors: Кирилл Малышев


text:
Print a shuffled deck of cards
Input
None
Output
52 cards. No duplicates. Cards are represented as their unicode characters, e.g. .
The Unicode codepoints follow the following format:

The first three digits are 1F0.
The next digit is A, B, C, or D for spades, hearts, diamonds, and clubs respectively.
The next digit is 1 through C and E for the various numbers/face cards. 1 is ace, 2-A are the number cards, and B, D,  and E are the jack, queen, and king respectively. (C is the knight, which isn't in most decks.)

Example output:

Rules:

This is code-golf. Shortest answer wins.
Forbidden loopholes are forbidden.
Your deck must be actually randomized. If run 20 times, 20 random (and most likely unique) outputs must be generated.

Note
If you only see boxes, install the DejaVu fonts.

Let us continue this discussion in chat.

Can there be spaces between each character?

I think you mean it should be random and that all permutations should have a none zero probability of occurrence.

Who else is seeing a bunch of boxes?

@SuperJedi224 Read the bottom section

@Mendeleev you should also post a warning that that download is almost a gigabyte!

@Noodle9 That's only if you download the CJK fonts. All the other ones should be less than 50M total, and you should only need Sans, Serif, and Mono anyway.

The example output is showing as just 52 boxes for me.

@carusocomputing Please read the bottom section of the challenge

If you only see boxes, install Google's Noto fonts. Yeah, I can't do that on my phone...

From which of the linked fonts are these cards? I've installed all of them (except for NotoColorEmoji.ttf, which gives an error), but I still see boxes..

Noto Emoji contains one playing card (U+1F0CF PLAYING CARD BLACK JOKER), and it doesn't even appear in your challenge!

Ooooops... I linked the wrong fonts!

@Dennis Should be fixed now

@KevinCruijssen Should be fixed now

@SuperJedi224 Try installing the newly linked fonts

Can confirm, DejaVu Sans is what my desktop computer uses by default and indeed has the playing cards.

@carusocomputing I've updated the font section, try again

Is the Knight used in any set of cards? Google searches seem to suggest tarot cards?

Jelly,  25 23  21 bytes
62R%⁴g180<11T+“¢¬⁷’ẊỌ

A niladic link returning a list of characters, or a full program that prints the shuffled deck.
Try it online!
How?
62R%⁴g180<11T+“¢¬⁷’ẊỌ - Main link: no arguments
62                    - literal 62
  R                   - range(62) -> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62]
    ⁴                 - literal 16
   %                  - modulo    -> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,  0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,  0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,  0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14]
      180             - literal 180
     g                - G.C.D.    -> [1,2,3,4,5,6,1,4,9,10, 1,12, 1, 2,15,180, 1, 2, 3, 4, 5, 6, 1, 4, 9,10, 1,12, 1, 2,15,180, 1, 2, 3, 4, 5, 6, 1, 4, 9,10, 1,12, 1, 2,15,180, 1, 2, 3, 4, 5, 6, 1, 4, 9,10, 1,12, 1, 2]
          11          - literal 11
         <            - less than?-> [1,1,1,1,1,1,1,1,1, 1, 1, 0, 1, 1, 0,  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0,  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0,  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1]
            T         - truthy    -> [1,2,3,4,5,6,7,8,9,10,11,   13,14,       17,18,19,20,21,22,23,24,25,26,27,   29,30,       33,34,35,36,37,38,39,40,41,42,43,   45,46,       49,50,51,52,53,54,55,56,57,58,59,   61,62]
              “¢¬⁷’   - base 250 number 127136
             +        - addition (vectorises) -> card character ordinals
                   Ẋ  - shuffle the list
                    Ọ - convert to characters
                      - full program has an implicit print

Why is it always Jelly that does this magic?

JavaScript (ES6), 107 106 108 bytes
a=[]
for(S of'ABCD')for(N of'123456789ABDE')a.splice(Math.random()*-~a.length,0,eval(`'\\u\{1F0${S+N}}'`))
a

a=[]
for(S of'ABCD')for(N of'123456789ABDE')a.splice(Math.random()*-~a.length,0,eval(`'\\u\{1F0${S+N}}'`))
a

o.innerHTML = a.join``

-1 byte thanks to @nderscore

JavaScript (ES6), 120 119 121 bytes
Previous version.
a=[],[...'ABCD'].map(S=>[...'123456789ABCE'].map(N=>a.splice(Math.random()*-~a.length|0,0,eval("'\\u\{1F0"+S+N+"}'")))),a

Whoa, never seen [...'ABCD'] before. That's cool :)

@SteveBennett Indeed! It's nice that strings are iterable by char like that. :)

But you still can't do things like "ABCD".map(...). I'm sure there are sensible reasons why that's the case.

@SteveBennett Yeah, I'd guess it's because it's ambiguous whether such a method would return a string or an array.

The map method is only part of the Array prototype, not the String prototype.

Very nice one. I took the liberty of modifying the snippet for a more graphical output, but feel free to rollback.

-1 byte with eval(\'\u{1F0${S+N}}'`)`

@Arnauld Awesome, thanks! Nice to hear from a well seasoned JS golfer. :)

@nderscore Done.

123456789ABCE includes the cavaliers in the output instead of the queens; it should be 123456789ABDE.

Also, this always places the ace of spades last.

@Shaggy Fixed the queens. Including the ace of spades in the shuffle cost me two bytes.

Python 3,  106  94 bytes
-5 bytes thanks to musicman523 (1. use sample(...,52) as an inline equivalent to shuffle [thanks to totallyhuman]; 2. use ~v&2 instead of v%4<2; plus a further 1 byte as a consequence as a space may be removed)
from random import*
print(*sample([chr(v+127137)for v in range(63)if~v&2or~v%16>4],52),sep='')

Try it online!

Well I wasn't able to get my own Python solution any better, but I got yours down to 97 using totallyhuman's switch to sample. Try it online!

Additionally, you can change v%4<2 to ~v&2 to save one more byte.

Nicely done! I had thought maybe another random function could help there. Another byte on top as or ~... can be or~....

Bash + coreutils, 56 bytes
printf %b\\n \\U1F0{A..D}{{1..9},A,B,D,E}|shuf|tr -d \\n

We use printf to write each card on its own line, shuffle the lines, then concatenate all the lines by removing the newline characters.
Note that although the coreutils printf command requires exactly 8 hexadecimal digits after \U, the Bash built-in printf lets us omit leading zeros.

I got as far as echo 16iF09F8{2A,2B,38,39}{{1..9},A,B,D,E}0AP|dc|shuf|tr -d \\n, but yours is better.  I didn't know about %b.

@Digital - neither did I, until writing this answer!

05AB1E, 22 21 bytes
Saved 1 byte thanks to carusocomputing.
…1F0A4£14L13KhJâ«Hç.r

Try it online!
Explanation
…1F0                    # push the string "1F0"
    A4£                 # push the string "abcd"
       14L              # push range [1 ... 14]
          13K           # remove 13
             h          # convert to hexadecimal
              J         # join to string "123456789ABCE"
               â        # cartesian product
                «       # prepend the string to each char in the list
                 H      # convert to decimal
                  ç     # get the chars with those code points
                   .r   # randomize

…1F0A4£14L13KhJâ«Hç.r for 21 bytes (edited because I forgot to remove knights). Does help you tie jelly though.

@carusocomputing: Good idea to do the cartesian before the concatenation, so we can skip the split. Thanks!

Charcoal, 50 bytes
Ａ¹²⁷¹³⁶χＡ⪫Ｅ…χ⁺⁶⁴χ℅ιωσＷσ«Ａ‽σχＡ⪫⪪σχωσ¿﹪﹪﹪℅χ¹⁶¦¹⁵¦¹³χ

Try it online! Link is to verbose version of code. Creates the string of all the 64 characters in the block but filters invalid cards out as they are randomly selected. (Speaking of which, random selection without replacement from a string is only 11 bytes, compared to 17 for an array.)
Edit: Subtraction from an array and other Charcoal improvements have cut down the size to 41 bytes: Try it online!

PHP>=7, 102 bytes
for(;$i++<64;)in_array(($c=127136+$i)%16,[0,12,15])?:$q[]=IntlChar::chr($c);shuffle($q);echo join($q);

No Online Interpreter available for the IntlChar::chr method
PHP, 112 bytes
for(;$n++<4;shuffle($r))for($i=0;$i++<14;)$i==12?:$r[]=pack("c*",240,159,131-($n>2),$n*16+112+$i);echo join($r);

Try it online!
PHP, 116 bytes
for(;$c=ab89[$n++];shuffle($r))for($i=0;$i++<14;)$i==12?:$r[]=hex2bin(f09f8.(2+($n>2)).$c.dechex($i));echo join($r);

Try it online!
PHP, 121 Bytes
for(;$c=ABCD[$n++];shuffle($r))for($i=0;$i++<14;)$i==12?:$r[]=json_decode('"\ud83c\udc'.$c.dechex($i).'"');echo join($r);

Try it online!

APL (Dyalog), 40 38 bytes
Jonathan Allan's method
⎕UCS((11>180∨16|⍳62)/127136+⍳62)[?⍨52]

(…) on the following array
 ⍳62 the first 62 integers
 127136+ add 127136 to that
 (…)/ filter that with the Boolean
  ⍳62 first 62 integers
  16| modulus 16
  180∨ GCD of 180 and that
  11> whether 11 is greater than those
[…] select the following elements
 ?⍨52 shuffle the first 52 integers (pick 52 random integers out of a bag of the first 52 integers)
⎕UCS convert to corresponding symbols in the Unicode Character Set

Version 16.0 (currently in beta) solution (33 characters)
⎕UCS(127136+⍸11>180∨16|⍳62)[?⍨52]

(…) on the following array
 ⍳62 first 62 integers
 16| modulus 16
 180∨ GCD of 180 and that
 11> whether 11 is greater than those
 ⍸ indices where True
 127136+ add 127136 to that
[…] select the following elements
 ?⍨52 shuffle the first 52 integers (pick 52 random integers out of a bag of the first 52 integers)
⎕UCS convert to corresponding symbols in the Unicode Character Set

Old solution
⎕UCS(126976+16⊥¨,(9+⍳4)∘.,12~⍨⍳14)[?⍨52]

(…) on the following array
 ⍳14 the first 14 integers
 12~⍨ except 12
 (…)∘., Cartesianly concatenated to
  ⍳4 the first 4 integers
  9+ added to 9
 , ravel (flatten) that
 16⊥¨ evaluate each in base 16
 126976+ add 126976 to that
[…] select the following elements
 ?⍨52 shuffle the first 52 integers (pick 52 random integers out of a bag of the first 52 integers)
⎕UCS convert to corresponding symbols in the Unicode Character Set

Python 3, 107 bytes
Saved 6 bytes thanks to @totallyhuman and 3 thanks to @CCB60!
from random import*
print(*sample([chr(int('1F0'+a+b,16))for a in'ABCD'for b in'123456789ABDE'],52),sep='')

Try it online!

Golfed it a little. This is only valid if spaces are allowed as separators though.

@totallyhuman adding ,sep='' fixes the spaces, of course – but makes it 112 bytes

I forgot about random.sample! I'll let the OP decide about spaces. I can add ,sep='' to get rid of them, and still save 6 bytes.

chr(int(f'0x1F0{a}{b}',16)) can be shortened by 3 bytes to chr(int('0x1F0'+a+b,16))

@CCB60 I'm a fool. Good catch

@musicman523 You mean you're a

Python 3, 112 bytes
from random import*
*a,=map(chr,range(127136,127200))
del a[::16],a[::-15],a[11::14]
shuffle(a)
print(*a,sep='')

Try it online!

Can you explain the magic going on in the del statement?  I've been trying to figure it out by breaking it down into three sequential statements, but I end up deleting the wrong items in the list.  For example, a[::16] gives me one card and three uninterpreted unicodes.

The del statement does break down sequentially from left to right. The first element of of a[::16] is U+1F0A0 PLAYING CARD BACK, which should be deleted. We also need to delete the Knight and Joker cards that are stuck in between the normal 52. See https://en.wikipedia.org/wiki/Playing_cards_in_Unicode#Playing_cards_deck.

Vyxal, 23 bytes
kA4Ẏk^ḢṪ\DoẊ`1F0`vpHCÞ℅

Try it Online!
Port of 05AB1E.
How?
kA4Ẏk^ḢṪ\DoẊ`1F0`vpHCÞ℅
kA4Ẏ                    # Get the first 4 letters of the uppercase alphabet
    k^                  # Push string "0123456789ABCDEF"
      ḢṪ                # Remove head and tail: "123456789ABCDE"
        \Do             # Remove the D: "123456789ABCE"
           Ẋ            # Cartesian product of strings: ["A1", "A2", "A3", "A4", ..., "DC", "DE"]
            `1F0`       # Push string "1FO"
                 vp     # Prepend to each: ["1FOA1", "1FOA2", ..., "1FODE"]
                   H    # Convert each from hexadecimal: [127137, 127137, ..., 127198]
                    C   # Convert each to their unicode representation: ["", "", ... ""]
                     Þ℅ # Randomly shuffle

Port of Jelly is same byte count:
Vyxal, 23 bytes
62ɾ16%180ġ11<T»ƛǔḭ»+CÞ℅

Try it Online!
How?
62ɾ16%180ġ11<T»ƛǔḭ»+CÞ℅
62ɾ                     # Push range [1, 2, ..., 62]
   16%                  # Modulo each by 16
      180ġ              # GCD each with 180: [1, 2, 3, 4, 5, 6, 1, 4, 9, 10, ..., 12, 1, 2]
          11<T          # Indices where item is less than 11: [0, 1, 2, 3, ... 13, 16, 17, ..., 26, ...]
              »ƛǔḭ»     # Push compressed integer 127137
                   +    # Add to each (vectorizes)
                    C   # Convert each to their unicode representation
                     Þ℅ # Randomly shuffle

For both solutions, add s flag if it needs to be a string instead of a list.

Alice, 34 bytes
'?rwd.n$@U,!6?44*%a7+-F$K?'+OK

Try it online!
Explanation
'?r                               push numbers 0-63 onto stack
   w                              store return address (start main loop)
    d                             get stack depth
     .n$@                         if zero, terminate
         U                        random number in [0, depth)
          ,                       move corresponding stack element to top
           !                      store on tape
             ?                    copy back from tape
              44*%                mod 16
                  a7+-            subtract 17
            6         F           does the result divide 6?
                       $K         if so, return to start of main loop
                         ?        copy card number from tape again
                          '+     add 0x1F0A1
                             O    output
                              K   return to start of main loop

><>, 49 50 49 bytes
""v
=?v>:1+}:88+%:c-:3-**?!~{l4d*
{>x
o^>l?!;

Try it online!
(+1 byte to make the randomness better)
I'm interpreting "random" to mean "every possible outcome has a non-zero probability". This isn't a uniform distribution.
There are two stages to this code. First, the fish puts all the cards on the stack, using the first two lines. Starting with the ace of spades, the fish duplicates and increments it, then checks if the previous card's hex code ends in  0, C or F by multiplying together x (x-12) (x-15), where x is the charcode mod 16, and checking if that's zero. If it is, it deletes the offending card from the stack. It repeats until the stack has 52 cards, then swims into stage 2:
  v
{>x
o^>l?!;

This bit of code shuffles and prints the stack. The x sets the fish's direction randomly:

If the fish swims up, it hits the v and goes back to the x without doing anything. The left direction is similar.
If the fish swims right, it wraps and hits the {, rotating the entire stack to the left, then returns to the x.
If the fish swims down, it prints the card at the front of the stack then returns to the x.

It's clear that every possible order of the cards can be produced: at any point in stage 2, every card that hasn't been printed yet can be printed next if the fish swims rightwards enough times. This shuffling technique usually doesn't move cards very far apart if they were already near each other, but then again, neither does shuffling by hand.

R, 61 bytes
cat(intToUtf8(sample(c(127137:127198)[-c(12,28,44,47,60)])))

Randomly sample the vector of integer representations of the cards unicode values (which can be obtained from utf8ToInt() fucntion) and remove the unwanted knight/joker cards.

57 bytes

C# (146 141 bytes)
using System.Linq;()=>Enumerable.Range(0,52).OrderBy(i=>System.Guid.NewGuid()).Aggregate("",(s,i)=>s+"\uD83C"+(char)(56481+i+i/13*3+i%13/12))

Online demo
This uses extremely bad style in shuffling with Guid.NewGuid(), but it's code-golf. It then builds the surrogate pairs manually.

Does this actually work? Whenever I tried casting the dynamic int to a char, it threw an exception?

@TheLethalCoder, I don't have any dynamic values. But as proof that it works, I've attached an Ideone link.

I meant the int created for the second part of the surrogate pair.

You can save a byte by not including the trailing semicolon

Says 147 bytes, reads as 146

Perl 5, 75 bytes
@c=map{7946+$_%4+$_/64}4..51,56..59;print chr(16*splice@c,@c*rand,1)while@c

Note that this uses the code points for queens as given in the question (i.e. last digit C). For the actual code points (last digit D), replace 51,56 with 47,52.

Java 8, 216 bytes
import java.util.*;()->{List<Long>l=new ArrayList();for(long i=52;i-->0;l.add(i));Collections.shuffle(l);for(Long x:l)System.out.print((char)(x.parseLong("1F0"+(char)(65+x/12)+((x%=4)>9?(char)(x>2?69:65+x):x),16)));}

Explanation:
Try it here.
NOTE: Untested because even though I've installed the linked font, I still see boxes. Probably have to restart my PC or something..
import java.util.*;               // Required import for List, ArrayList and Collections
()->{                             // Method without parameter nor return-type
  List<Long>l=new ArrayList();    //  List
  for(long i=52;i-->0;l.add(i));  //  Fill the list with 1 through 52
  Collections.shuffle(l);         //  Randomly shuffle the list
  for(Long x:l)                   //  Loop over the shuffled list
    System.out.print(             //   Print the following character:
      (char)(x.parseLong(         //    Convert the following String to a character:
        "1F0"+                    //     The literal String "1F0" +
         (char)(65+x/12)+         //     either A, B, C or D by using x/12, adding 65,
                                  //      and casting it to a char +
         ((x%=4)>9?               //     If the current item mod-4 is 10 or higher:
            (char)(x>2?69:65+x)   //      Convert it to A, B, C or E
           :                      //     Else (1 through 9):
            x)                    //      Simply add this digit
      ,16))
    );
}                                 // End of method

Japt, 51 41 39 22 bytes
With some inspiration from Jonathan's Jelly solution.
#?ö¬k@B§XuG y#´Ãmd##

Try it (or view output with increased font-size)

Explanation
#?                         :63
  ö¬                       :Random permutation of range [0,63)
    k                      :Remove elements that return true
     @                     :When passed through this function
      B                    :  11
       §                   :  Less than or equal to
        X                  :  Current element
         u                 :  Modulo
          G                :  16
            y              :  GCD
             #´            :  180
               Ã           :End function
                m          :Map
                  ##       :  Add 127136
                 d         :  Get character at that codepoint

Dyalog APL, 35 bytes
⎕ucs(∊127150+(16×⍳4)-⊂2~⍨⍳14)[?⍨52]

based on Adám's answer
uses ⎕io←0


text:
Count the number of "e"s in a string without using the letter "e"
Your code may not contain the letter "e", but must count the number of "e"s in the inputted string and output that as a number. Bonus points if you use a language that is not a codegolf language and a language that actually uses the letter e (unlike brainfuck) --- not a required criteria.

Case sensitive, I assume?

Up to your discretion

Is it okay if output is in unary?

yes @ComradeSparklePony

Edit: New challenge! Don't use the characters "101" Please don't arbitrarily change the rules once answers have been posted. For future challenges I advise you to use the sandbox before posting here

Japt, 7 6 4 bytes
Nope, definitely didn't use e!
è'Ev

Try it online

Explanation
    :Implicit input of string U
è   :Count.
'E  :"E".
v   :Convert to lowercase.
    :Implicit output of result.

Nice. I had this, èEsG, èdcÄ, and èfcÉ

MATL, 5 bytes
101=s

Try it online!

Mathematica, 42 bytes
#~StringCount~StringDrop[ToString[2<1],4]&

input

["dfhjkeehjke"]

output

3

You can save a byte by using infix notation: ToString[2<1]~StringDrop~4 as the second argument to StringCount.

or infix StringCount

Jelly, 5 bytes
Oċ“d’

A monadic link returning the count.
Try it online!
How?
Oċ“d’ - Link: list of characters
O     - cast to ordinals
  “d’ - base 250 number 101
 ċ    - count occurrences

Alternatives:
O’ċȷ2 - decrement (’) and count occurrences of 100 (ȷ2);
ƓO’ċ³ - evaluate a line from STDIN (Ɠ), decrement (’) and count occurrences of 100 (³)

It's unfortunate that using an argument instead of STDIN overwrites the ³ == 100 mapping.

I really like how you used base 250 number 101

@DJMcMayhem Yes, that and ⁹==256 do bite the count fairly often (pun-intended), and occasionally ⁸==“”.

APL, 9 bytes
2 bytes saved thanks to @Adam
≢⍞∩22⊃⎕AV

How?
    22⊃⎕AV  ⍝ 'e'
 ⍞∩         ⍝ intersect with input
≢            ⍝ count

Save two bytes: ≢⍞∩22⊃⎕AV

@Adám thanks! can ⊃ always be used for single element indexing?

For single elements from a vector, yes. However.

CJam, 8 bytes
q'd)f=:+

Case sensitive.
Try it online!
Explanation
q             Read input string
    f=        For each character in that string, see if it equals
 'd           character "d"
   )          increased by 1 (that is, character "e")
      :+      Sum the results. Implicitly display

brainf***, 215 bytes
case sensitive
+[>>>>+++++[-<++>]<[-<++++++++++>]<[-<<->>]<<-[>-<[-]]>+<,]>[>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]<

155 of the bytes are from printing the number, from here.
Try it online!

Python 3, 30 26 24 bytes
Extremely basic:
lambda s:s.count('\x65')

4 bytes off thanks to @Challenger's suggestion (adapted to this solution).
51 46 44 bytes, but I like it better:
lambda s:''.join('1'for i in s if i=='\x65')

Output is in unary. I found it first in the hopes that the other way was impossible; for once I'm annoyed that Python lets me do things the easy way.
5 bytes off thanks to @Challenger.
2 bytes off of each thanks to @xnor.
Attribution for the simple method:
 https://stackoverflow.com/questions/1155617/count-occurrence-of-a-character-in-a-string
Attribution for the unary one:
 https://stackoverflow.com/questions/1450897/python-removing-characters-except-digits-from-string

You can golf the second solution: lambda s:''.join('1'for i in s if i==chr(101))

@Challenger5 change the input() to s and that'll work

You can write 'e' as '\x65'.

if i=='\x65' => if'\x65'==i

Aceto, 21 19 bytes
Ic!_
o=ML
d'I`
,dOp

We read a character and duplicate it, then push a "d" and increment its value to have an e. We then store the equality with M. Now we invert the input to get True when we're done, and conditionally jump to the print command at the end. Otherwise, we load our other truth value (whether it was an e), conditionally increment, and jump back to the Origin.

CJam, 10 bytes
It's annoying that the operation to count the number of instances, e=, contains an e.
q"&dd<":)~

This creates a string &dd< , increments every code point to get 'ee=, and then executes it.

PHP, 27 Bytes
<?=count_chars($argn)[101];

Try it online!

Scala, 20 bytes
_.count(_=='\u0065')

Try it online!

05AB1E, 4 bytes
Ƶ0ç¢

Try it online!
Ƶ0   # Push 101
  ç  # Convert to a character
   ¢ # Count the occurrences of that character

Retina, 11 bytes
T`d-f`_f_
f

Try it online! e is indirectly referred to in the translation by creating a range from d to f. The ds and fs are deleted and the es are translated to fs (we can't use d because that would expand to 0-9). It then suffices to count the fs.

[d-f-[df]] saves one byte.

@KritixiLithos I had no idea you could do that; I think you should go ahead and post that as your own answer.

Since the challenge is closed, I can't. But I found a large improvement, \x65 for just 4 bytes.

@KritixiLithos Ah of course, use of decimal/hex codes was why the challenge got closed in the first place...


text:
Insert a simulated Ken Thompson virus into a program
A Ken Thompson virus is a virus that infects your compiler and other programs. Since it infects all your tools, you can not detect it without using tools from before the virus was introduced.
Your will create a prototype for inserting the Ken Thompson virus into code. The goal of this virus will be to allow you to (fake) destroy any computer running a program infected with it.
Inserting a Ken Thompson virus is defined as follows. Start with an input program P. Your program will output a modified program Q that works as follows:

If the input to Q is aNouIQ5xKvUfdZVzo0Xs, it will output BOOM (in a real Ken Thompson virus, this would actually do something bad, but since it this is a fake virus, outputing BOOM is done instead).
For any other input to Q, run program P with that input

If the output of P is valid source code in the language you are using, insert the Ken Thompson virus into it and then Q will output the resulting infected program.
Otherwise, the output of Q is just the output of P.

You will write a program that takes P's code as input and produces Q's code as output.
You can use either a currently (at the time of this post) existing programming language, or a subset of one, for this challenge. (The idea is that language you are using would be the target language of some self-compiling compiler, but this is not required.) Since you want to be as subtle as possible, the shortest code (in bytes) wins!

Sandbox entry is here: https://codegolf.meta.stackexchange.com/a/12710/16842

Voting to close as asking for malicous code is never a good idea. https://codegolf.meta.stackexchange.com/q/4829/15599

I'm voting to close this question as off-topic because I agree with @LevelRiverSt, this is malicious.

@NoOneIsHere @LevelRiverSt This is clearly not malicious. Insert a simulated Ken Thompson virus into a program, The goal of this virus will be to allow you to (fake) destroy any computer. All the "virus" does is print BOOM. There is absolutely nothing malicious.

@MDXF ok, VTRO-ing. I guess I didn't read the question well.

The program P only ever has one input?

I don't understand why this is downvoted. Seems like a quine variant that may actually be interesting for once.

An answer with a compiler doesn't actually seem to be valid though, since a compiler's output is in a different language than the source code it gets as input.

Here i do not write virus

@MDXF The OP's intention is not malicious, but in theory at least, code submitted here could be used to create a virus. The possibility of that happening is extremely remote, but if it did happen it would bring this site into serious disrepute. That's why I say: asking for malicious code is never a good idea. Per the question I linked, Martin, Peter and a majority of voters at the time tended to agree.

@JonathanAllan yes

@LevelRiverSt or they could just create a virus themselves. All code on this site is so obfuscated that it's easier to start from scratch.

@RosLuP it's a simulated virus, not a real one.

@LevelRiverSt if anything, the algorithm I posted is more dangerous than any code posted.

@Jonathan Allan, you could use a subset of Jelly

Must it be a program, or a function will work? Must it take the compiled in bytecode program? (I think) This is quite trivial in some programming language.

@user202729 a function is fine. It must process source code in it's only language (so if you inserting the virus into assembly, you must publish your program in assembly).

@feersum this challenge "assumes" that you are writing the code in the target language of the compiler

I'd argue the question is asking for such a minor component of a malicious task, that it's not malicious in itself.  We're tasked with writing a separate pre-compiler that injects source code.  The challenging parts. infecting a machine, injecting this pre-compiler into an existing compiled compiler, and circumventing OS-level security controls, far outweigh this task in complexity.

How is the input P provided to the program and how should the output Q be delivered?

For some other languages, determining If the output of P is valid source code in the language you are using is almost impossible, unless you use/rewrite a compiler. For some other languages you can eval a string and catch for error, if any. However, for Mathematica, it is just check for if the head of the result is a function - Mathematica doesn't allow output invalid function, like 1!-!&.
So,
Mathematica, 209 bytes
(obviously can be golfed more, for example by assign long names to global variables)
With[{p=#,c=With[{p=#,c=6},If[#==="aNouIQ5xKvUfdZVzo0Xs","BOOM",With[{r=p@#},If[Head@r===Head@p,(c/.3!->c)[r],r]]]&]&},If[#==="aNouIQ5xKvUfdZVzo0Xs","BOOM",With[{r=p@#},If[Head@r===Head@p,(c/.3!->c)[r],r]]]&]&

The function takes a function as input, and output a function according to the specification.
Note that the input must be a pure function, not something like f[x_] := .... So all Mathematica built-in functions fail the criteria.
Although Mathematica have #0 parameter, I explicitly disallow that in my answer because a quine is not allowed to read the code of itself.
(I thought that question is trivial until I read the third rule)


text:
Tips for golfing in V
What general tips do you have for golfing in V? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to V (e.g. "remove comments" is not an answer).
Since V is heavily based on vim, most of the tips for golfing vim would apply too. But there are some features in V that don't really apply to vim.
Please post one tip per answer.

Take advantage of implicit endings!
In V, every single command will be implicitly finished if you don't actually finish out the command. For example, if the program ends in insert mode, the <esc> will be filled in automatically. Usually, this doesn't make any difference. However, if you have a count before the i, you have to actually hit <esc> at the end for the text to be inserted multiple times. So you can do 2i2i for a quine, whereas in vim you would need 2i2i<esc>, which is no longer a quine.
This also applies to ex commands, and psuedo ex-commands such as compressed regexes. So where vim needs
:foo<cr>

V can do
:foo

if it's at the end of the program.
But here is where it gets really cool: The implicit ending applies several layers deep. For example, consider this command:
òçfoo/óa

This translates to:
ò           " Recursively:
 çfoo/      "   On every line matching 'foo'
      óa    "     Remove the first 'a'

Without implicit endings, the ó needs a <cr>, the ç needs a <cr>, and the ò needs another ò. But none of these are needed with implicit endings! The interpreter will fill in the needed ò, the recursive command will fill in the <cr> that ç needs, and the ç command will fill in the <cr> that ó needs. This saves us 3 bytes.

Carefully choose how you take input.
V can take input two different ways: input and args. It can even take both at the same time! Choosing how you take input can sometimes save you many bytes. Here is how the two input formats work:

The input is the text that is loaded into the buffer. Generally, this is more convenient for string inputs.
The args are stuffed into the first n registers, depending on how many args are given. For example, if 5 args are given, these will be loaded into registers a-e. Since you can run these registers with @<reg>, these are generally more convenient for numeric input.

Lets make a hypothetical example. Our hypothetical challenge is:

Given a string s, and an integer n, output s n times, separated by a newline.

In vim, you can only take input into the buffer. So you'd need to take the input on two lines, for example
n
s

And run
DJY@-pdd

The D to delete n into register '-', the J to remove the extra newline, and then @-p to paste s n times, and dd to take care of the extra copy. In V, you can take s as input, and n as an arg. Then you could shorten this too:
@apdd

of course, there's still a few ways to shorten this even more. For example, Ä makes n copies, rather than pasting n times. And À, or <M-@> will cycle through all of these args, so the first time it's called it is equivalent to @a. So you can simply do:
ÀÄ

The À will command will also loop back once you go through all of the args. So if you have 3 arguments, running À repeatedly will run
@a
@b
@c
@a
@b
@c
@a
...

And what happens when you go over @z?

@erikthegolfer I don't know. I've never used that many args.

what unprintable put that in my inbox?


text:
Expand that Australian state
There are 8 Australian states and territories, each with a 2 or 3 letter abbreviation:

ACT: Australian Capital Territory
NSW: New South Wales
NT: Northern Territory
QLD: Queensland
SA: South Australia
TAS: Tasmania
VIC: Victoria
WA: Western Australia

Your task is to write a function/program which takes a valid Australian state abbreviation in upper case, and returns the correct full name (case-sensitive as above).

No extra whitespace permitted, other than a single trailing newline where this is an unavoidable side-effect of every program in that language.
For example:
f("TAS") => "Tasmania"
Standard code-golf rules (shortest code in bytes wins!) and loopholes apply.

I think we need to create the [[tag:state-abbreviation]] tag at this point.

What about "New South (Far) Wales"? (For those who don't realize, it's "NSFW")

while I was playing around with a solution, NSW was expanding to "New South Western ales" which I quite liked :)

Weird. I created the tag and added it, but someone removed it again.

state-abbreviation might be too specific. maybe make the tag something about abbreviations/acronyms?

Retina, 135 121 bytes
13 bytes golfed thanks to @Neil by using clever space insertion tactics, which inspired one more byte being golfed
AS
asmania
^W
Western
NT
NorthernT
T$
 Territory
A
Australia
aC
an Capital
IC
ictoria
LD
ueensland
SW
ew SWales
S
South

Try it online!
Note the trailing spaces on the fourth and the last lines.

If you replace AS with asmania first, then you can replace all the remaining As with Australia.

You can also get creative with your space insertion, something like this: Try it online!

(But for that, \B[A-Z] would have saved you two bytes.)

@Neil Thanks for the tips, I used your suggestions to golf one more byte.

Haskell, 193 192 bytes
f"NSW"="New South Wales"
f"QLD"="Queensland"
f"ACT"=a++"n Capital"++t
f"VIC"="Victoria"
f"TAS"="Tasmania"
f"SA"="South "++a
f"NT"="Northern"++t
f"WA"="Western "++a
a="Australia"
t=" Territory"

Somewhat naive solution, but I wanted to go for a fairly simple challange for my first. I'm not even sure if better is possible in Haskell.
Saved a byte by moving the space into t

Welcome to PPCG!

Jelly, 56 bytes
OS%15ị“ÞÑṿ“ıÐṁṾṗ“¡ʋẹḢ⁾ḅ“¢T¡ż¶““msẒw²ẉṪP“ØÑĊ“©$Ḅ3ẊḳƓ“ÇH°»

A monadic link taking and returning lists of characters.
See all cases at Try it online!
Note: Reusing the words "Australia" and "Territory" does not help reduce the byte count.
How?
Taking the sum of the ordinals of the eight state abbreviations modulo 15 gives 8 unique values. Taking the results of those modulo 9 maintains uniqueness.
OS%15ị“ ... » - Main link: list of characters a
O             - cast to ordinals
 S            - sum
  %15         - modulo 15
      “ ... » - list of compressed strings:
              -   "Victoria"
              -   "Western Australia"
              -   "Northern Territory"
              -   "South Australia"
              -   ""
              -   "Australian Capital Territory"
              -   "Tasmania"
              -   "New South Wales"
              -   "Queensland"
     ị        - index into (1-indexed and modular - hence the single empty entry)

Sad that reusing Australia and Territory doesn't help :/

Mathematica, 177 bytes
Obvious solution: (199 bytes)
<|"ACT"->"Australian Capital Territory","NSW"->"New South Wales","NT"->"Northern Territory","QLD"->"Queensland","SA"->"South Australia","TAS"->"Tasmania","VIC"->"Victoria","WA"->"Western Australia"|>

Improved solution: (182 bytes, only runnable on my Wolfram Mathematica 10.2 computer)
{,"Northern Territory","Queensland",,,,,"Australian Capital Territory","New South Wales",,,"Tasmania",,,"Western Australia","Victoria",,,,,,,,,,,,"South Australia"}[[Hash@#~Mod~29]]&

Best solution:
{,"Northern Territory","Queensland",a="Australia",,,,a<>"n Capital Territory","New South Wales",,,"Tasmania",,,"Western "<>a,"Victoria",,,,,,,,,,,,"South "<>a}[[Hash@#~Mod~29]]&

Unfortunately repeat " Territory" can save only 0 bytes.
It seems that the default Hash function of Mathematica change over versions. But adding a method will make code longer.
Using the default Hash function of Mathematica sandbox now can make code shorter by about 9 bytes.
Mathematica (sandbox - now - version 11), 168 bytes
{a="Australia","Western "<>a,,,,"South "<>a,,a<>"n Capital Territory",,,,"Tasmania","Northern Territory",,,,"New South Wales","Victoria","Queensland"}[[Hash@#~Mod~20]]&

Damn, only 21 bytes better than trivial answer.

Wait, so Mathematica has no builtin for this?

@Neil I should have thought about that first.

Python, 181 bytes
1 byte saved thanks to @Jonathan Allan
lambda a,s='Australia',t=' Territory':[s+'n Capital'+t,'New South Wales','Northern'+t,'Queensland','South '+s,'Tasmania','Victoria','Western '+s]['ACNSNTQLSATAVIWA'.index(a[:2])//2]

Try it online!

t=' Territory' should save a byte I think.

Sed, 167 157 bytes
s/T$/ Territory/
s/N /Northern /
s/AS/asmania/
s/IC/ictoria/
s/LD/ueensland/
s/W$/Wales/
s/A/Australia/
s/C/n Capital/
s/NS/New S/
s/^W/Western /
s/S/South /

I did originally defer ern , but that cost more than it saved for just two usages.

PHP, 148 143 bytes
<?=strtr(["0n Capital 3",Victoria,Queensland,West20,10,Tasmania,North23,"New 1 Wales"][md5(hj.$argn)%8],[Australia,"South ","ern ",Territory]);

Saved 5 bytes thanks to Jörg Hülsermann.

C#, 289 bytes

Data

Input String s The abbreviation of the state.
Output String The expanded state name

Golfed
(string s)=>{return new System.Collections.Generic.Dictionary<string,string>(){{"ACT","Australian Capital Territory"},{"NSW","New South Wales"},{"NT","Northern Territory"},{"QLD","Queensland"},{"SA","South Australia"},{"TAS","Tasmania"},{"VIC","Victoria"},{"WA","Western Australia"}}[s];};

Ungolfed
( string s ) => {
    return new System.Collections.Generic.Dictionary<string, string>() {
        { "ACT", "Australian Capital Territory" },
        { "NSW", "New South Wales" },
        { "QLD", "Queensland" },
        { "TAS", "Tasmania" },
        { "VIC", "Victoria" },
        { "NT", "Northern Territory" },
        { "SA", "South Australia" },
        { "WA", "Western Australia" }
    }[ s ];
};

Ungolfed readable
// Takes a state name abbreviated
( string s ) => {

    // Creates a dictionary with the state name abbreviated and the full state name and returns the one that match
    return new System.Collections.Generic.Dictionary<string, string>() {
        { "ACT", "Australian Capital Territory" },
        { "NSW", "New South Wales" },
        { "QLD", "Queensland" },
        { "TAS", "Tasmania" },
        { "VIC", "Victoria" },
        { "NT", "Northern Territory" },
        { "SA", "South Australia" },
        { "WA", "Western Australia" }
    }[ s ];
};

Full code
using System;
using System.Collections.Generic;

namespace Namespace {
   class Program {
      static void Main( String[] args ) {
         Func<String, String> f = ( string s ) => {
             return new System.Collections.Generic.Dictionary<string, string>() {
                 { "ACT", "Australian Capital Territory" },
                 { "NSW", "New South Wales" },
                 { "QLD", "Queensland" },
                 { "TAS", "Tasmania" },
                 { "VIC", "Victoria" },
                 { "NT", "Northern Territory" },
                 { "SA", "South Australia" },
                 { "WA", "Western Australia" }
             }[ s ];
         };

         List<String>
             testCases = new List<String>() {
                 "ACT",
                 "NSW",
                 "QLD",
                 "TAS",
                 "VIC",
                 "NT",
                 "SA",
                 "WA",
             };

         foreach( String testCase in testCases ) {
             Console.WriteLine( $"Input: {testCase}\nOutput: {f( testCase )}\n");
         }

         Console.ReadLine();
      }
   }
}

Releases

v1.0 - 289 bytes - Initial solution.

Notes

None

(string s) can just be s, You can use an implicit return: s=>new System.... and you can remove the trailing semicolon.

Rexx (Regina), 148 147 bytes
a=Australia
t=Territory
s=South
ac=a'n' Capital t
ns=New s Wales
nt=Northern t
qs=Queensland
sa=s a
ta=Tasmania
vi=Victoria
wa=Western a
arg x 3
say value(x)

Try it online!

Seems to output in uppercase?

JavaScript (ES6), 167 bytes
s=>({A:`${A='Australia'}n Capital ${T='Territory'}`,N:s[2]?'New South Wales':'Northern '+T,T:'Tasmania',Q:'Queensland',S:'South '+A,V:'Victoria',W:'Western '+A}[s[0]])

f=
s=>({A:`${A='Australia'}n Capital ${T='Territory'}`,N:s[2]?'New South Wales':'Northern '+T,T:'Tasmania',Q:'Queensland',S:'South '+A,V:'Victoria',W:'Western '+A}[s[0]])

console.log('ACT NSW NT QLD SA TAS VIC WA'.split(' ').map(f))