text:
Formula One Strategist
Introduction
Formula One is a complex sport and as with complex sports, strategy is very important.Some teams will manage better strategy than others and those teams will often win the races.
After last weekends' amazing German GP, which saw last years Champion Lewis Hamilton pit 6 times (in comparison, some races just have 1 stop per driver), I was really impressed with all the strategy that was involved by most of the teams. Some really great calls, such as going to soft (from inters) by Racing Point, saw their driver finish 4th which was a rare sight.

Challenge
Your task will be to suggest what tire configuration should be used for the race.

Tires
Here are the 3 available tire types :
All of this data unofficial data, this is unreal data that was made juste for a fun challenge. I tried to keep a little sense in choosing how durable the tires wowuld be, but as I repeat, this is UNOFFICIAL
Name                           Soft   Medium   Hard
Degradation (per character)    15     10       8
Degradation (per corner)       263    161      128
Time delta (per corner) (ms)   0      +30      +45

There is no time delta on the straights so all tire perform the same
A tires life span is calculated by how many COMPLETE laps it can do before dying. It's health starts at 100 000 and will decrease by the degradation value in the above table.

Pit
You will be able to change tires by going to the pits but a pit stop will cost you time.
That time is measured by the distance between P to P (the length EXCLUDES the Ps on the start/finish straight multipled by 1750 milliseconds.
time for pits = (length between P to P) x 1750 ms

You must just complete the lap on the previous set of tires. So in a way, you are changing them at an imaginary line between the # and the character before it. Tire degradation in the pits are as if you were driving on track.

Tracks:
A corner is where the characters changes (look at exeption bellow)
All ascii characters can be used for the track (except the exceptions bellow that have specific meaning)
This does not count as a corner, it is just a kink. This is just extra info seeing as the drawings are not considered official and just a representation to give users a better idea or to validate an algorithm.
Ex 1
______
      ______

Ex 2
\
   \
      \

The P does not represent a corner , it is the pit entrance and exit. It still counts in track length though.
_____P_______________P__________

The # represents the start/finish line (the start and finish line will be the same for the purposes of simplifying things. They also count in track length. The race will start at an imaginary line between the # and whatever comes before it, so yes, the # will degrade the tires when the race starts. The # is also the first character in the input. You may assume that the last character of the track will be the same as the first character after the start/finish line (#).

INPUT
The track:

A list/array of all the characters in order
A string with all the characters in order

Bonus. The track map drawing made out of the ascii characters (unofficial as it I won't garantee at this point int time that both the drawing and the string bellow are the same
Number of laps:

An integer, however you want to receive it.

Ex.1 ["_P_#_P_||_______||", 250]
Ex.2 ["_","P","_","#","_","P","_","|","|","_","_","_","_","_","_","_","|","|"], 69

OUTPUT
The tire strategy with 3 distinct characters to represent the 3 tire compound. Tires can be identified either with letters, numbers, or even words if you want.
You must output all the tires necessary for the race. Tire output must be from softest to hardest compouds.
Ex.1  [S, M, H]
Ex.2  [0, 1]
Ex.3  [Hard]

OBJECTIVE
TL;DR: find the tire combination that optimizes time delta.
You must use all the tire data (constants) and the race data (track and number of laps, this will be your input) to optimize the best tire strategy (output) in order to minimize the time delta.
A time delta of 0 will be the perfect (but impossible) score, where you would run the soft tires (the fastest) the whole race. Thus, you must use a combinations of tires and run them for how many laps you want as long as it is still in the tires life span. Running soft for the whole race is fastest, but each time you change them at the end of a tire's life span, it will raise your time delta, because you must pit.

Rules

This is code golf so shortest code wins!
The rest is almost a free-for-all (just don't hard code the answers in!)

Example
Note, drawings are not offial, it is just for representation.
Also, the output aren't checked by another person then me yet, so if you are doing the challenge and find some errors, please notify me.

1. Circuit de Spa-Francorchamps:
(yes I know it looks like a gun, but it isn't gun related, I promise, Google the track if you want):
                __________
        _____^^^          ___________________________
 _P_____                                             \___
<_____#_____P                                            |
             |_____________                  ________    |
                            \               /        |   |
                              \            /         |___|
                                \         |
                                 |        |
                                 |       _|
                                 |      |
                                 |______|

INPUT :
#_____<_P__________^^^_____________________________________\___||||___||________//|||_||______||||\\\_____________|P_____

44 laps per race (according to Wikipedia, Belgian GP 2018)

OUTPUT: [Medium, Medium]

2. Autodromo Nazionale Monza:
________
\       \
 \        \
  \          \
   \___        \
       \         \____
         \            \__________________________
           \                                      \
             \                                    /
               \ _____/___P__#_________P________/

INPUT :
#__P_____/_____\\\\\___\\\\________\\\\\____\__________________________\//________P_________

53 laps per race (according to Wikipedia, Italian GP 2018)

OUTPUT : [Soft, Medium]

3. Circuit Gilles Villeneuve:
            ____
       ____|    ____
    __/             \___________
   /    ____#___                _______
  /P___/        |P______________________>

INPUT :
#____/___P//__/____|________\__________________>______________________P|___

70 laps per race (according to Wikipedia, Canadian GP 2019)

OUTPUT : [Soft, Soft, Medium]

4. Pocono Raceway (not an F1 track, but here to test edge-cases)
             / \
            /    \
           /       \
          /          \
         /             \
        /                \
       /                   \
      /                      \
     /                         \
    /                            \
   /                               \
  /                                  \
 /                                     \
  ________P______#_______________P_____

INPUT :
#_______________P_______\\\\\\\\\\\\\/////////////_________P_____

110 laps per race

Number of laps is innacurate, according to USA Today, it is going to be 160 laps for the 2019 Sunday's Gander Outdoors 400, the 21st race in the Monster Energy NASCAR Cup Series. In F1, races are at least 305km, making any race around this raceway around 76 laps.
OUTPUT : [Hard]

@JonathanAllan Added in Pocono Raceway (not an F1 track but at least a real track. Only 3 corners so minimum tire degradation). I put the number of laps so that it fits exactly with the tire life of Hard tires

@Arnaud, Actually, just output the order in order of softest to hardest. Because Running a [Soft, Hard] is slightly different then [Hard, Soft], in the sense that you will not be running the hard to it's fullest extent before changing it

Jelly, 105 102 bytes
³;`ẹ”PḊIḢ’×⁽£ż×’
ḟ⁾#PnƝS,L{ḋ“Ðẏ½Ƥ®x‘s2¤ÄUż“¡œ-‘¤ȷ5W¤÷Ḟµ⁴÷ḢḢĊ3ṗⱮẎịµZżÄŻ⁴_Ʋ{Ṃ€żʋ/>0Ḣ$ƇẈṪ,P€LÑ+SƲNƊƲ)MḢḃ3

Try it online!
A full program that takes the track as a string as its first argument and the number of laps as its second argument. Returns a list of integers representing 1 for soft, 2 for medium and 3 for hard.
Explanation
Helper link: calculate pit time from number of tyres needed
³                 | First argument for program (track as Jelly string)
 ;`               | Concatenate to itself
   ẹ”P            | Indices of "P"
      Ḋ           | Dequeue (remove first element)
       I          | Differences between consecutive numbers
        Ḣ         | Head (i.e. difference between indices of the 2nd and 3rd Ps in the concatenated track)
         ’        | Decrease by 1
          ×⁽£ż    | Multiply by 1750
              ×   | Multiply by:
               ’  | - Argument to this link subtracted by 1

Main link: stage 1
ḟ⁾#P                                   | Remove all "#" and "P" from track
    nƝ                                 | Neighbours not equal (will return 1 for every change in symbol)
      S                                | Sum (i.e. number of corners)
       ,L{                             | Pair with length of original track
          ḋ                   ¤        | Dot product with following as a nilad: (Will calculate degradation per lap for each tyre type and also extra time for the corners; works because of the way Jelly vectorises)
                     ¤                 | - Following as a nilad
           “Ðẏ½Ƥ®x‘                    |   - 15, 248, 10, 151, 8, 120
                   s2                  |   - Split into twos [15,248],[10,151],[8,120]
                      Ä                | - Vectorised cumulative sum [15,263],[10,161],[8,128]
                       U               | - Vectorised reverse [263,15],[161,10],[128,8]
                        ż“¡œ-‘         | - Zipped with 0,30,45
                               ȷ5W¤÷   | Divide 100,000 by the first element of each (the degradation), leaving the additonal time per corner alone
                                    Ḟ  | Floor
                                     µ | Start a new monadic link with this as its argument

Main link: stage 2
⁴÷          | Second argument (number of laps) divided by output of stage 1
  Ḣ         | Head (values for soft tyres)
   Ḣ        | Head (laps per tyre for aoft tyres)
    Ċ       | Ceiling (i.e. max number of tyres that might be needed)
     3ṗⱮ    | 3 to the Cartesian power of each number from 1 to the max number of tyres needed
        Ẏ   | Tighten (remove one level of lists)
         ị  | Index into output from stage 1
          µ | Start a new monadic link with this as its argument

Main link: stage 3
                                 )     | For each of the possible tyre combinations:
Z                                      | - Transpose, so we have a list of laps per tyre set and another list of the extra time for corners per lap
           ʋ/                          | - Reduce using following as a dyad:
 ż    Ʋ{                               |   - Zip with following as a monad (applied to the list of laps per tyre set)
  Ä                                    |     - Cumulative sum
   Ż                                   |     - Prepended with zero
    ⁴_                                 |     - Subtracted from the number of laps
        Ṃ€                             |   - Minimum of each
          ż                            |   - Zip with additional time for corners
             >0Ḣ$Ƈ                     | - Filter those where the first number (the number of laps used for those tyres) is greater than zero
                              Ʋ        | - Following as a monad:
                  ẈṪ                   |   - Tail of the lengths (will be 2 if all laps accounted for, 1 if not)
                    ,        Ɗ         |   - Paired with following as a monad:
                     P€                |     - Product of each (additional time for each tyre set from corners for all laps driven)
                           Ʋ           |     - Following as a monad:
                       LÑ              |       - Helper link applied to length (number of tyre sets)
                         +             |       - Plus:
                          S            |         - Sum (of additional times for each tyre set)
                            N          |     - Negated
                                  M    | Indices of maximum
                                   Ḣ   | Head
                                    ḃ3 | Bijective base 3

JavaScript (ES6), 234 bytes
Takes input as (track)(laps), where track is an array of characters. Returns a string with \$0\$ = soft, \$1\$ = medium, \$2\$ = hard.
a=>k=>(a.map(c=>(C++,d+=P,c=='P'|c=='#'?P^=350:t+=p!=(p=c)),p=a[1],P=d=C=t=0),m=g=(n,L=k,x=0,o='')=>L?g(n>>2,L-=j=(j=1e5/(C*[15,10,8][n&=3]+t*[263,161,128][n]))>L?L:j|0,x-j*t*!!n*~n*3+d,o+n):(m=m<x|m==x&o>P?m:(P=o,x),n?P:g(++N)))(N=0)

Try it online!

Python3, 557 bytes
E=enumerate
I=lambda t,c:(c+1)%len(t)
F=lambda t,C:t[C]not in{'P','#'}and t[I(t,C)]not in{'P','#'}and t[C]!=t[I(t,C)]
def f(t,l):
 H=100000
 T=[[15,263,0],[10,161,30],[8,128,45]]
 q=[(H,l,[i],0,0)for i,_ in E(T)]
 U=[]
 for h,l,u,r,c in q:
  if l==0:U+=[(u,r)];continue
  if c==0 and h<H:l-=1
  m=T[u[-1]]
  if'P'==t[c]:
   C,K,W=I(t,c),0,0
   while'P'!=t[C]:W+=1;K+=F(t,C);C=I(t,C)
   if h<m[0]*W+m[1]*K:
    for i,_ in E(T):q+=[(H,l,u+[i],r+W*1750,I(t,c))]
    continue
  q+=[(h-m[0]-F(t,c)*m[1],l,u,r+F(t,c)*m[2],I(t,c))]
 return min(U,key=lambda x:x[1])

Try it online!

F=lambda t,C:t[C]not in'P#'and t[I(t,C)]not in'P#'+t[C] ... H,T,U=100000,[[15,263,0],[10,161,30],[8,128,45]],[] ... l-=(c==0)*(h<H) ... K=W=0;C=I(t,c)

source: Stack Exchange

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

sort: votes


text:
Decode an URL string
Challenge
I think everyone of us heard of URL encoding mechanism - it's basically everywhere.
Given an URLEncoded string on stdin, decode it, and output the decoded form to stdout.
The encoding is very simple, + or %20 is representing space. Every percent followed by two hex digits (uppercase or lowercase) has to be replaced with ASCII character code of this number.
Related, but it's the other way round
Example
100%25+working
=>
100% working

%24+%26+%3C+%3E+%3F+%3B+%23+%3A+%3D+%2C+%22+%27+%7E+%2B+%25
=>
$ & < > ? ; # : = , " ' ~ + %

%414243
=>
A4243

Test case that fails:
%24%XY+%%%
   ^~~~~~~
=>
$

Rules

Loopholes are forbidden.
If your programming language has built-in function to decode the URL, using it (the function) is forbidden.
Assume ASCII character set. No Unicode and all that stuff.
This is a code-golf, so the answer with the fewest bytes used to accomplish the task wins.
Please include a link to an online interpreter for your code.
Your program has to decode until EOF or an error (eg. percent without valid hex digits - %xy) is spotted (you can safetly terminate).
If anything is unclear, please let me know down in the comments.

has to decode until * ... this feels like it assumes a specific method of solving the problem, i.e that you will decode left to right.

The whole validation part of this is just additional to the challenge. I don't see why
it's added on, it makes it two separate challenges. i.e URL decode a string (the named challenge) and validate whether a string is a valid URL encoded string (which is a different challenge imo)

@ExpiredData Are you serious? How do you read stdin right to left? How do you urlencode the other way, eg. 02%? It's just specifics of the challenge, I'm unable to see the problem.

Validation makes the challenge a bit more spicy, because simple tasks are pretty boring and can be accomplished eaisly.

Who says I'm going to read it right to left, what if I split the input by %, and then do my work. What if I read right to left and determine if I see two characters and then a percent and then do work on it etc. etc. just because you aren't capable of understanding how a problem may be solved doesn't make it the impossible.

I am capable of understanding how the problem could be solved, but really, is it so hard for example to perl to regex two characters straight after the percent? You're speaking like this challenge was literally impossible with the minimal checking.

No worries, well I've downvoted because I don't think this is a good challenge for the reasons I've stated. See this meta post

It's not about it being impossible, it's about it being condusive to golfing in a variety of ways. I can solve this challenge trivially in many languages, but the competition is not about whether you CAN solve the challenge, it's about in how few bytes. Hence constraining the challenge to a specific solution is just idiotic.

@ExpiredData I'll read this linked post, but I think my way of stating the challenge is better. Thanks for your contribution to the question.

Do we have to handle %00?

@Sanchises yes.

(also, you could change the name of the challenge to "Decode the URL as far as possible" or similar - I don't think it's a bad challenge at all if you set the correct expectations from the start)

(@Sanchises Exactly what I was going to write.) It would indeed prevent people from getting mad at you if they overlook that rule.

What do you mean by you can safetly terminate?

@JoKing I'm suggesting action of program when error or EOF is spotted.

What happens if there is a percentage sign not followed by two characters e.g. at the end of the input?

Program terminates. Obviously it won't display anything. @KevinCruijssen's answer got everything properly so you might check it out.

Does it absolutely need to be stdin, rather than default IO rules? Also, agreed the required input validation makes it feel like a chameleon challenge... on some platforms the code to do that may be longer than the actual challenge.

05AB1E, 41 30 bytes
'+ð:Δć©'%Qi2ôćuDHç©Ç`hÊiq}J}®?

-11 bytes thanks to @Grimy.
Try it online or verify all test cases.
Explanation:
'+ð:                  '# Replace all "+" in the (implicit) input with spaces
Δ                      # Loop until the result no longer changes:
 ć                     #  Extract head; pop and push remainder-string and first character
  ©                    #  Store the character in variable `®` (without popping)
   '%Qi               '#  If this character is a "%":
       2ô              #   Split the remainder-string into parts of size 2
                       #    i.e. "abcde" → ["ab","cd","e"]
         ć             #   Extract head again
          u            #   Convert it to uppercase
           D           #   Duplicate it
            H          #   Convert it from hexadecimal to integer
                       #   (NOTE: even if it isn't a valid hexadecimal string,
                       #    it will still result in an integer regardless)
             ç         #   And then from integer to ASCII-character with this codepoint
              ©        #   Replace variable `®` with this (without popping)
               Ç`h     #   Reverse process: ASCII-character → integer → hexadecimal string
                  Êi   #   If both are NOT equal (so it initially was invalid hexadecimal):
                    q  #    Stop the program
                   }J  #   And join the list of 2-char strings back together
      }®?              #  And then print `®` without newline

Fails on lowercase (challenge explicitly says lowercase hex has to be handled too).

@Grimy Straight-forward fix with +3 bytes for now (adding Dl«). Thanks for reporting. I did check if H would convert lowercase or mixed case characters correctly, but forgot about my å check..

36

30

@Grimy Nice, thanks. :)

JavaScript (V8), 112 bytes
u=>u.match(/([^%]|%[\da-f]{2})*/i)[0].replace(/%..|./g,d=>d=="+"?" ":d[1]?String.fromCharCode("0x"+d[1]+d[2]):d)

Try it online!
Noticed Arnauld's 92 byte Node.js answer shortly after spending some time golfing this. Porting that method would save quite a few bytes (with the main difference being Buffer vs. String.fromCharCode), but I wanted to post this one as it's more interesting and the V8 port wouldn't be worth a separate answer.
This challenge requires input validation, so the first .match takes only the valid part of the URL. Then, each part of it is replaced using a function. One trick I used that's kind of neat is the "0x"+d[1]+d[2]. Ordinarily you can convert hexadecimal to decimal using +("0x"+n), but it seems String.fromCharCode casts to number on its own, saving three bytes. Instead of slicing the initial %, I just concatenate the second and third characters, which is shorter.

Gema, 45 characters
+=
%<X2>=@int-char{@radix{16;10;$1}}
%=@fail

Insensitive on hexadecimal case.
Sample run:
bash-5.0$ gema '+= ;%<X2>=@int-char{@radix{16;10;$1}};%=@fail' <<< $'100%25+working\n%24+%26+%3C+%3E+%3F+%3B+%23+%3A+%3D+%2C+%22+%27+%7E+%2B+%25\n%414243\n%24+%XY+%%%'
100% working
$ & < > ? ; # : = , " ' ~ + %
A4243
$

Try it online!

Perl 5 (-0777p -Mre=/si), 45 bytes
s/%.?[^\da-f].*//;y/+/ /;s/%(..)/chr hex$1/ge

TIO

Python 3, 90 bytes
def d(s):t='%'!=s[0];print(end=t*s[0].replace('+',' ')or chr(int(s[1:3],16)));d(s[3-2*t:])

Try it online!
Explanation
Checks if the first character is %. If that is the case, it will try to hex-decode the following two characters and print the result. If not, it will just print the first character and replaces x with  if necessary.
If the first character was %, the first three characters are sliced off the string and the function is called recursively. If not, only the first character is sliced off and the function is called again.
Raises an error if the hex string cannot be decoded or if end of line is reached.

JavaScript (Node.js), 92 bytes
f=([x,y,z,...a])=>x=='%'?1/(n='0x'+y+z)?Buffer([n])+f(a):'':x?(x=='+'?' ':x)+f([y,z,...a]):a

Try it online!

Jelly, 35 bytes
ṣ”+Kṣ”%µḊḢ;ḢƊ€ŒuØHiⱮⱮ’ḅ⁴⁸żFO<0œṗƊḢỌ

Try it online!
A monadic link that takes a string as its argument and returns the decoded string, terminating early at any invalid hex.
I’ve assumed for now that standard I/O rules apply. If it really has to be stdin, that will cost a byte.

Perl 6, 62 bytes
{S:g{(<-[%]>*)\%?(..)?}={TR/+/ /}($0).print+print chr "0x"~$1}

Try it online!
Anonymous code block that outputs to STDOUT and then errors. This assumes that the input cannot contain spaces.

Charcoal, 65 bytes
≔Ｅ¹⁶⍘ιφθＷθ«≔⮌⪪Ｓ%ι⊟ιＷ∧ι⊟ι«¿∧›Ｌκ¹⬤01№θ↧§κμ«℅⍘↧…κ²¦¹⁶✂κ²»«≔υι≔υθ»»Ｄ⎚

Try it online! Link is to verbose version of code. Note that Charcoal prompts "Enter input:" if it runs out of input. Explanation:
≔Ｅ¹⁶⍘ιφθ

Grab the list of hex digits into a variable.
Ｗθ«

Repeat while the variable is not empty. This is used as a flag to break out of the loop, since Charcoal has no other way of terminating the loop.
≔⮌⪪Ｓ%ι

Read the next line of text and split it on %s.
⊟ι

Output the first split.
Ｗ∧ι⊟ι«

Repeat while there are more splits to process, but stop if any of them are empty.
¿∧›Ｌκ¹⬤01№θ↧§κμ«

Also check that the length of the split is at least 2 and that the first 2 characters are hex digits. (Inconveniently I can't use a literal 2, I have to use a string of length 2 instead.)
℅⍘↧…κ²¦¹⁶

Convert the first two characters from hex and output the character with that code.
✂κ²

Output the rest of that split.
»«≔υι≔υθ»»Ｄ⎚

Otherwise clear the loop variables so that we terminate processing. The canvas is also printed after each loop as otherwise Charcoal's input handling gets in the way again.

Python 3, 91 bytes
lambda s:re.sub('%([A-Fa-f\d]{2})',lambda t:chr(int(t[1],16)),s.replace('+',' '))
import re

Try it online!
Approach this with regular expressions.

Nice approach, but prints $%XY %%% instead of $ in the fourth example.

Stax, 29 bytes
í☼∩ò☺µ◘Γπ╓l▄╓█₧ß:♦+ÇP¢Y╚↑░ºHÑ

Run and debug it
It's mostly regex.

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


text:
longest ungolfable quine
Create a quine that cannot be golfed. Your score is your byte count, where higher is better. If someone finds a shorter version, their score is your original byte count, and you lose points
Scoring example:
original submission, 34 bytes // score is 34
function(this){self.printquine();}

golfed, 31 bytes              // score is 34, original submission is scored 31
function(this){_.printquine();}

golfed again by someone else, 18 bytes // score is 31, first golfed submission is scored 18
this.printquine();

Here "golfing" is defined as creating a shorter version of someone else's source file exclusively by removing characters or rearranging existing characters (without affecting its quine-ness). This seems like a good way to define it because otherwise googling the shortest quine in a given language would be the only reasonable starting point.
Standard loopholes apply, unless you have a creative use of one then go for it.
Use this site's definition of a valid quine, if you can actually find one that's agreed on.

Could someone that thinks this is unclear please say what they think is unclear?

I can't speak for others, but I voted this as unclear for two reasons -- the first is regarding "chain" scoring. Say that A scores 100, but then B comes and golfs it down to 95, thus B scores 100. Then C comes along and golfs it further down to 90. Does C score 95 or 100? /// The second is the second-to-last sentence. Opening up standard loopholes is almost always a recipe for disaster.

@AdmBorkBork Those seem like bad choices rather than sources of unclarity.

@AdmBorkBork valid point i'll clarify the scoring.

Now your first golf (swapping self for _) is invalid according to your definition of golfing (exclusively by removing characters or rearranging existing characters).

ノ( º _ ºノ) yeet do you have a constructive suggestion? @AdmBorkBork

Well, it looks like you're contradicting yourself by saying that changing self to _ is valid but also saying that it's not valid. I suggest editing this question to clarify whether golfs like this one are valid or not.

Also, do I understand it right, should someone's else quine display MY source code, or his?

this might be better as a [tag:cops-and-robbers] challenge, but with no "safe" time frame? This is why we have a sandbox: to improve challenges so they don't get downvoted / closed.

I'm actually voting to close as off-topic, because: Standard loopholes apply, unless you have a creative use of one then go for it, which means that there are basically no rules, and this thus has no objective winning criterion. I think the core of the challenge is an interesting play on the "golf" idea and the scoring has potential, but it needs refinement before it fits our standards.

Use Malbolge! Nobody will ever want to golf a quine program in this language.

HQ9+, 1 byte
I guess I'm not winning any points for creativity.
Q

I don't think this fits our standard rules of what makes a quine, as outlined in the bottom paragraph of the challenge.

ok but [HQ9+], 0 bytes
checkmate

@KennethTaylor my quine is longer, therefore I still win

That's not how the scoring works...


text:
Regex golf and ccTLDs, hooray!
Write a regex that only matches valid country code top level domains (ccTLDs). Your regex must match both the domains with the dot and without the dot (it must match tv and .tv). Any domain that is not a ccTLD or does not exist (e.g. .info or .jobs or .xz) must not be matched.
Use Perl, POSIX, PCRE or Python.
For reference, this is the full list of ccTLDs, as of challenge creation:
.ac .ad .ae .af .ag .ai .al .am .ao .aq .ar .as .at .au .aw .ax .az .ba .bb .bd .be .bf .bg .bh .bi .bj .bm .bn .bo .br .bs .bt .bw .by .bz .ca .cc .cd .cf .cg .ch .ci .ck .cl .cm .cn .co .cr .cu .cv .cw .cx .cy .cz .de .dj .dk .dm .do .dz    .ec .ee .eg .er .es .et .eu .fi .fj .fk .fm .fo .fr .ga .gd .ge .gf .gg .gh .gi .gl .gm .gn .gp .gq .gr .gs .gt .gu .gw .gy .hk .hm .hn .hr .ht .hu .id .ie .il .im .in .io .iq .ir .is .it .je .jm .jo .jp .ke .kg .kh .ki .km .kn .kp .kr .kw .ky .kz .la .lb .lc .li .lk .lr .ls .lt .lu .lv .ly .ma .mc .md .me .mg .mh .mk .ml .mm .mn .mo .mp .mq .mr .ms .mt .mu .mv .mw .mx .my .mz .na .nc .ne .nf .ng .ni .nl .no .np .nr .nu .nz .om .pa .pe .pf .pg .ph .pk .pl .pm .pn .pr .ps .pt .pw .py .qa .re .ro .rs .ru .rw .sa .sb .sc .sd .se .sg .sh .si .sk .sl .sm .sn .so .sr .ss .st .sv .sx .sy .sz .tc .td .tf .tg .th .tj .tk .tl .tm .tn .to .tr .tt .tv .tw .tz .ua .ug .uk .us .uy .uz .va .vc .ve .vg .vi .vn .vu .wf .ws .ye .yt .za .zm .zw -- open for registration
.an .bl .bq .bv .eh .gb .mf .sj .su .tp .um -- not open (still must be matched)
^ and $ anchors are not needed.

There are a lot of different flavors of regex (some of which are not even regular expressions) and there are a lot of things that are regular expressions under the computer science definition.  You don't have to specify a single flavor but it would be nice to know exactly what counts as a regex for this challenge, that is what langauges can compete.

You could do this in a programming language by checking if google.(insert domain name here) exists.

275 bytes
\.?([cmst][cdghk-orvz]|[agim][delmq-t]|[dft][jkmo]|[acms]x|[bcgkmp][ghmnrwy]|[psu][agksy]|[aen][cegru]|[abcn][fioz]|l[abcikr-vy]|[bdjkprsvy]e|[bcgmnqvz]a|[behpsty]t|[cghmrv]u|[fgksv]i|[gjkmn]p|b[bdjs]|h[kmnr]|[gptw]f|[artz]w|v[cgn]|[joz]m|[ijr]o|[erw]s|[dku]z|[np]l|fr|in|sb)

(277 bytes including ^$.) A Python program was used to autogenerate part of this regular expression. Here is the first version of the program:
def makeregex(list):
  if len(list) == 1:
    return alpha[list[0]]
  regex = "["
  j = list[0]
  while j < 26:
    if j in list:
      if j + 1 in list and j + 2 in list and j + 3 in list:
        regex += alpha[j] + "-"
        while j + 1 in list:
          j += 1
      regex += alpha[j]
    j += 1
  return regex + "]"

def perform(rows, cols):
  replaced = '|'.join([alpha[j] + alpha[k] for j in rows for k in cols if array[j][k] > 0])
  regex = makeregex(rows) + makeregex(cols)
  print regex, 'replaces', replaced, 'saving', len(replaced) - len(regex), 'bytes'
  for j in rows:
    for k in cols:
      if (array[j][k]):
        array[j][k] = -1
      else:
        raise Exception("filling illegal entry")

all = ['ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al', 'am', 'ao', 'aq', 'ar', 'as',
       'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh',
       'bi', 'bj', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bw', 'by', 'bz', 'ca',
       'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr',
       'cu', 'cv', 'cw', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz',
       'ec', 'ee', 'eg', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo',
       'fr', 'ga', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp',
       'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht',
       'hu', 'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', 'it', 'je',
       'jm', 'jo', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw',
       'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv',
       'ly', 'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo',
       'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na',
       'nc', 'ne', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om',
       'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt',
       'pw', 'py', 'qa', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd',
       'se', 'sg', 'sh', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'ss', 'st',
       'sv', 'sx', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl',
       'tm', 'tn', 'to', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'us',
       'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye',
       'yt', 'za', 'zm', 'zw']
alpha = 'abcdefghijklmnopqrstuvwxyz'
array = [[alpha[i] + alpha[j] in all for j in range(26)] for i in range(26)]

#perform([2, 12, 18, 19], [2, 3, 6, 7, 10, 11, 12, 13, 14, 17, 21, 25])
#perform([0, 6, 8, 12], [3, 4, 11, 12, 16, 17, 18, 19])
#perform([3, 5, 19], [9, 10, 12, 14])
#perform([0, 2, 12, 18], [23])

while max(max(row) for row in array) > 0:
  best = 0
  i = 1
  while i < 1 << 26:
    row = [-1 for j in range(26)]
    for j in range(26):
      if (i & 1 << j):
        for k in range(26):
          if array[j][k] == 0:
            row[k] = 0
          elif array[j][k] == 1 and row[k]:
            row[k] = max(row[k], 0) + 1
        if max(row) < 1:
          break;
    if max(row) > 0:
      total = 3 * sum(max(j, 0) for j in row)
      if total > best:
        rows = [j for j in range(26) if i & 1 << j]
        cols = [j for j in range(26) if row[j] > 0]
        total -= len(makeregex(rows)) + len(makeregex(cols)) + 1
        if total > best:
          best = total
          bestrows = rows
          bestcols = cols
      i += 1
    else:
      i += i & -i
  if best:
    perform(bestrows, bestcols)
  else:
    print '|'.join([alpha[j] + alpha[k] for j in range(26) for k in range(26) if array[j][k] > 0])
    break

This 282-byte regex results from its output:
\.?([bgmps][aeghmnrsty]|[cmst][cdghk-orvz]|[acn][cfgiloruz]|[agim][delmq-t]|[bck][ghimnrwyz]|[elm][cr-u]|[dft][jkmo]|[agpt][fltw]|[gnv][aegiu]|[lpu][aksy]|[gjkm][emp]|h[kmnrtu]|b[bdfjo]|r[eosuw]|[ls][biv]|[acms]x|[cmz][amw]|[dey]e|dz|eg|fi|fr|in|io|jo|np|om|qa|ug|uz|vc|vn|wf|ws|yt)

The program can also be seeded by adding calls to perform, so I tried seeding it with [cmst][cdghk-orvz]|[agim][delmq-t]|[dft][jkmo]|[acms]x but that just resulted in a rearranged regex. Obviously this wasn't good enough. The problem seemed to be that I was comparing the performance against a simple alternation. I therefore developed a slower but more accurate scoring function, which works by assuming that all of the remaining matches should be either x[yz] or [xy]z alternations, generating the largest alternations first, and compares the result with and without the trial regex.
def makeregex(list):
  if len(list) == 1:
    return alpha[list[0]]
  regex = "["
  j = list[0]
  while j < 26:
    if j in list:
      if j + 1 in list and j + 2 in list and j + 3 in list:
        regex += alpha[j] + "-"
        while j + 1 in list:
          j += 1
      regex += alpha[j]
    j += 1
  return regex + "]"

def simple(array):
  unused = [[j > 0 for j in row] for row in array]
  regex = ""
  while max(max(row) for row in unused):
    rowcount = [sum(row) for row in unused]
    colcount = [sum(col) for col in zip(*unused)]
    if max(colcount) > max(rowcount):
      colindex = colcount.index(max(colcount))
      col = zip(*unused)[colindex]
      regex += "|" + makeregex([j for j in range(26) if col[j]]) + alpha[colindex]
      for j in range(26):
        unused[j][colindex] = 0
    else:
      rowindex = rowcount.index(max(rowcount))
      row = unused[rowindex]
      regex += "|" + alpha[rowindex] + makeregex([j for j in range(26) if row[j]])
      unused[rowindex] = [0 for j in range(26)]
  return regex

def perform(rows, cols):
  previous = simple(array)[1:].split('|')
  for j in rows:
    for k in cols:
      if (array[j][k]):
        array[j][k] = -1
      else:
        raise Exception("filling illegal entry")
  regex = (makeregex(rows) + makeregex(cols) + simple(array)).split('|')
  replaced = '|'.join(j for j in previous if not j in regex)
  regex = '|'.join(j for j in regex if not j in previous)
  print regex, 'replaces', replaced, 'saving', len(replaced) - len(regex), 'bytes'

all = ['ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al', 'am', 'ao', 'aq', 'ar', 'as',
       'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh',
       'bi', 'bj', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bw', 'by', 'bz', 'ca',
       'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'cr',
       'cu', 'cv', 'cw', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz',
       'ec', 'ee', 'eg', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo',
       'fr', 'ga', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp',
       'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht',
       'hu', 'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', 'it', 'je',
       'jm', 'jo', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw',
       'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv',
       'ly', 'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo',
       'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', 'mz', 'na',
       'nc', 'ne', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om',
       'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'ps', 'pt',
       'pw', 'py', 'qa', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd',
       'se', 'sg', 'sh', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sr', 'ss', 'st',
       'sv', 'sx', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl',
       'tm', 'tn', 'to', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'us',
       'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye',
       'yt', 'za', 'zm', 'zw']
alpha = 'abcdefghijklmnopqrstuvwxyz'
array = [[alpha[i] + alpha[j] in all for j in range(26)] for i in range(26)]

#perform([2, 12, 18, 19], [2, 3, 6, 7, 10, 11, 12, 13, 14, 17, 21, 25])
#perform([0, 6, 8, 12], [3, 4, 11, 12, 16, 17, 18, 19])
#perform([3, 5, 19], [9, 10, 12, 14])
#perform([0, 2, 12, 18], [23])

while max(max(row) for row in array) > 0:
  best = simple(array)[1:]
  bestrows = []
  bestcols = []
  i = 1
  while i < 1 << 26:
    row = [-1 for j in range(26)]
    for j in range(26):
      if (i & 1 << j):
        for k in range(26):
          if array[j][k] == 0:
            row[k] = 0
          elif array[j][k] == 1 and row[k]:
            row[k] = max(row[k], 0) + 1
        if max(row) < 1:
          break;
    if max(row) > 0:
      rows = [j for j in range(26) if i & 1 << j]
      cols = [j for j in range(26) if row[j] > 0]
      unused = [row[:] for row in array]
      for j in rows:
        for k in cols:
          unused[j][k] = 0
      total = makeregex(rows) + makeregex(cols) + simple(unused)
      if len(total) < len(best):
        best = total
        bestrows = rows
        bestcols = cols
      i += 1
    else:
      i += i & -i
  if bestrows:
    perform(bestrows, bestcols)
  else:
    print best
    break

Now without seeding, this actually produces the worse 286-byte regex:
\.?([bgp][ae-hmnrstwy]|[cst][cdghk-orvz]|[nv][acegiu]|m[acdeghk-z]|a[c-gilmoq-uwxz]|k[eghimnprwyz]|l[abcikr-vy]|i[del-oq-t]|s[abeistxy]|c[afiuwxy]|e[cegr-u]|b[bdijoz]|d[ejkmoz]|f[ijkmor]|g[dilpqu]|h[kmnrtu]|n[floprz]|u[agksyz]|r[eosuw]|j[emop]|t[fjtw]|z[amw]|p[kl]|w[fs]|y[et]|om|qa|vn)

When seeded with [cmst][cdghk-orvz] (which I had independently discovered manually before writing the first program) this improves to this 282-byte regex, thus equalling the first program:
\.?([cmst][cdghk-orvz]|[bgmps][aeghmnrsty]|[ag][d-gilmq-uw]|[pt][fkltw]|[acs][cioxz]|[nv][acegiu]|k[eghimnprwyz]|l[abcikr-vy]|i[del-oq-t]|b[bdfijowz]|e[cegr-u]|d[ejkmoz]|f[ijkmor]|h[kmnrtu]|n[floprz]|u[agksyz]|c[afuwy]|m[pquwx]|r[eosuw]|j[emop]|z[amw]|w[fs]|y[et]|gp|om|qa|sb|tj|vn)

After some experimentation I discovered that when seeded with [cmst][cdghk-orvz]|[agim][delmq-t]|[dft][jkmo]|[acms]x (selected from the output of the first version), it results in the given 275-byte regex.
For completeness, I think the best I achieved manually was the following 282-byte regex:
\.?(a[c-gilmoq-uwxz]|b[abd-jostz]|c[afiuwxy]|d[ejkmoz]|e[cegr-u]|f[ijkmor]|g[ad-ilp-u]|h[kmnrtu]|i[del-oq-t]|j[emop]|k[ipz]|l[abcikr-vy]|m[aep-y]|n[acefgilopruz]|om|p[aflst]|qa|r[eosuw]|s[abeistxy]|t[fjtw]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]|[cmst][cdghk-orvz]|[bgkp][eghmnrwy])

282 bytes
\.?([abcmpt][fglmnrw]|[abgim][delmnq-t]|[acms]x|[adkn][ez]|[aemsv][cegu]|[afn][ior]|[bcmst][dghl-orvz]|[bgls][abirsty]|[clmpu][aky]|[clnv][aciu]|[dfst][jkmo]|[egp][eghrst]|[gmnt][fglpr]|[gr][esuw]|[ir]o|[ty]t|bj|h[kmnrtu]|j[emop]|k[ghimnprwy]|lv|om|qa|tc|u[gmsz]|vn|w[fs]|ye|z[amw])

Try it online!
276 bytes—old list
\.?([abt][dfgmortwz]|[aclnv][ciu]|[acms]x|[agim][delmq-t]|[bcgkmp][ghmnrwy]|[bdijnr][eo]|[cgnp][afglr]|[cmst][cdghk-orvz]|[dft][jkmo]|[dknu]z|[epsy][et]|[fgks]i|[gjkmn][ep]|[gmv][aegnu]|[jo]m|[psu][agksy]|b[abijs]|e[cgrsu]|fr|h[kmnrtu]|in|l[abkr-vy]|qa|r[suw]|sb|w[fs]|z[amw])

Try it online!

Back in 2014 you claimed an incredible 17 character score on Glob of Regex Golf. Nobody has come close; somebody got 21 eventually; I've only been able to get 22 (the best published one is 23). Could you please share your amazing solution now? I think it's been long enough :) Or give a hint as to what schema was used. It would be sad for your solution to disappear into the mists of time. (My attempts to email you have failed, so I'm trying this now.)


text:
Complete the grid-filling meander
A grid-filling meander is a closed path that visits every cell of a square \$N \times N\$ grid at least once, never crossing any edge between adjacent cells more than once and never crossing itself. For example:

Once filled, each cell of the grid can be represented by one of the following 8 tiles:

Numbered this way, the tiles of the above meander can be represented by this matrix:
5 6 5 6
4 8 3 2
5 7 6 2
4 3 4 3

Your task is to complete a grid-filling meander given an incomplete set of tiles. For example, the incomplete meander:

...which can be represented using 0s for missing tiles:
5 0 0 0 6
0 0 7 0 0
0 0 0 0 3
2 4 0 0 0
0 0 3 0 0

...could be completed like this:

...i.e.:
5 6 5 1 6
4 8 7 6 2
5 7 7 7 3
2 4 8 8 6
4 1 3 4 3

Specifications

The input will always have at least \$1\$ and at most \$N^2\$ (non-empty) tiles, where \$2 \le N \le 7\$.
You may use any set of values to represent the tiles, as long as it's specified in your answer.
Your input and output may be in any format and order, as long as it's specified in your answer.
At least one valid solution will exist for all inputs (i.e. you don't need to handle invalid input).
Standard I/O rules apply.
Standard loopholes are forbidden.
Explanations, even for "practical" languages, are encouraged.

Test cases

Input (Θ):
0 6
0 0

Output (Θ):
5 6
4 3

Input (Θ):
5 6 5 6
4 0 3 2
5 7 6 2
4 3 4 3

Output (Θ):
5 6 5 6
4 8 3 2
5 7 6 2
4 3 4 3

Input (Θ):
5 0 0 0 6
0 0 7 0 0
0 0 0 0 3
2 4 0 0 0
0 0 3 0 0

Output (Θ):
5 6 5 1 6
4 8 7 6 2
5 7 7 7 3
2 4 8 8 6
4 1 3 4 3

Sandboxed: https://codegolf.meta.stackexchange.com/a/17888/11261

@Arnauld You're correct; it's not valid. A meander is a single closed path.

@Arnauld Thanks, I’ve made that change. I didn’t realize MathJax was enabled on this site!

JavaScript (ES7),  236 ... 193  185 bytes
Outputs by modifying the input matrix.
m=>(g=(d,x,y,v,r=m[y],h=_=>++r[x]<9?g(d,x,y,v)||h():r[x]=0)=>r&&1/(n=r[x])?x|y|!v?n?g(d='21100--13203-32-21030321'[n*28+d*3+7&31],x+--d%2,y+--d%2,v+=n<7||.5):h():!m[v**.5|0]:0)(0,0,0,0)

Try it online!
(includes some post-processing code to print the result both as a matrix and as a flat list compatible with the visualization tool provided by the OP)
Results

Test case #1
Test case #2
Test case #3

How?
Variables
\$g\$ is a recursive function taking the current direction \$d\$, the current coordinates \$(x,y)\$ and the number of visited cells \$v\$.
The following variables are also defined in the scope of \$g\$:

\$r\$ is the current row of the matrix.
r = m[y]

\$h\$ is a helper function that tries all values from \$1\$ to \$8\$ for the current cell and invokes \$g\$ with each of them. It either stops as soon as \$g\$ succeeds or sets the current cell back to \$0\$ if we need to backtrack.
h = _ => ++r[x] < 9 ? g(d, x, y, v) || h() : r[x] = 0

Initial checks
We first make sure that our current location is valid and we load the value of the current cell into \$n\$:
r && 1 / (n = r[x]) ? ... ok ... : ... failed ...

We test whether we're back to our starting position, i.e. we're located at \$(0,0)\$ and we've visited at least a few cells (\$v>0\$):
x | y | !v ? ... no ... : ... yes ...

For now, let's assume that we're not back to the starting point.
Looking for a path
If \$n\$ is equal to \$0\$, we invoke \$h\$ to try all possible values for this tile.
If \$n\$ is not equal to \$0\$, we try to move to the next tile.
The tile connections are encoded in a lookup table, whose index is computed with \$n\$ and \$d\$, and whose valid entries represent the new values of \$d\$.
d = '21100--13203-32-21030321'[n * 28 + d * 3 + 7 & 31]

The last 8 entries are invalid and omitted. The other 4 invalid entries are explicitly marked with hyphens.
For reference, below are the decoded table, the compass and the tile-set provided in the challenge:
   | 1 2 3 4 5 6 7 8
---+-----------------
 0 | 0 - - 1 3 - 3 1          1
 1 | - 1 - - 2 0 2 0        0 + 2
 2 | 2 - 1 - - 3 1 3          3
 3 | - 3 0 2 - - 0 2

We do a recursive call to \$g\$ with the new direction and the new coordinates. We add \$1/2\$ to \$v\$ if we were on a tile of type \$7\$ or \$8\$, or \$1\$ otherwise (see the next paragraph).
g(d, x + --d % 2, y + --d % 2, v += n < 7 || .5)

If \$d\$ is invalid, \$x\$ and \$y\$ will be set to NaN, forcing the next iteration to fail immediately.
Validating the path
Finally, when we're back to \$(0,0)\$ with \$v>0\$, it doesn't necessarily mean that we've found a valid path, as we may have taken a shortcut. We need to check if we've visited the correct number of cells.
Each tile must be visited once, except tiles \$7\$ and \$8\$ that must be visited twice. This is why we add only \$1/2\$ to \$v\$ when such a tile is visited.
In the end, we must have \$v = N^2\$. But it's also worth noting that we can't possibly have \$v > N^2\$. So, it's enough to test that we don't have \$v < N^2\$, or that the \$k\$th row of the matrix (0-indexed) does not exist, where \$k=\lfloor\sqrt{v}\rfloor\$.
Hence the JS code:
!m[v ** .5 | 0]

Formatted source
m => (
  g = (
    d,
    x, y,
    v,
    r = m[y],
    h = _ => ++r[x] < 9 ? g(d, x, y, v) || h() : r[x] = 0
  ) =>
    r && 1 / (n = r[x]) ?
      x | y | !v ?
        n ?
          g(
            d = '21100--13203-32-21030321'[n * 28 + d * 3 + 7 & 31],
            x + --d % 2,
            y + --d % 2,
            v += n < 7 || .5
          )
        :
          h()
      :
        !m[v ** .5 | 0]
    :
      0
)(0, 0, 0, 0)

Nice work. I'd love to read an explanation of the code.

@Arnauld are you brute-forcing it or using another algorithm?

@Jonah I'm currently writing an explanation. Basically, yes, it's a brute-force approach but the algorithm backtracks as soon as some inconsistency is detected rather than trying each and every possible board.


text:
Tile the chessboard with four-colored triominoes
Task:
Consider the problem: "given a chessboard with one square missing, cut it into 21 L-triominoes". There is a well-known constructive proof that this can be done for any square chessboard size that is a power of two. It works by splitting the chessboard into a smaller chessboard with the hole in it and one big triomino and then observing that that triomino can be cut into four triominoes recursively.
In this task, you are required to cut an 8x8 chessboard into L-shaped triominoes and then to color them with four colors such that no two adjacent triominoes have the same color.
Specification:
Your input is the position of the hole, given as a pair of integers. You may choose which one is the column index and which one is the row index. You may choose if each starts at 0 or at 1 and away from which corner they increase. You may require A..H as the first coordinate instead of 0..7 or 1..8. You may also accept both coordinates packed into a single integer 0..63 or 1..64 in lexicographical order (row-major or column-major, left to right or right to left, up to down or down to up). You may write a full program, or a function.
You may output the tiling as ASCII, as colored ASCII or as graphical primitives. If you choose ASCII output, you may choose any four printable ASCII characters to represent the four colors. If you choose colored ASCII, you may choose any four printable ASCII characters or just one character other than space. The hole must be represented by the space character. If one of your characters is the space character, no triomino adjacent to the hole or at the chessboard edge may be of this color.
If you choose colored ASCII or graphical output, you may choose any four colors out of #000, #00F, #0F0, #0FF, #F00, #F0F, #FF0, #FFF or their closest equivalents available in your environment. If you choose graphical output, your graphical primitives must be filled squares at least 32x32 pixels in size and separated by no more than two pixels of other color. If the above exceeds the screen resolution of your environment, the minimum size requirement is relaxed to the largest square size that still fits on the screen.
You may choose any valid tiling of the given chessboard. You may choose any four-coloring of the tiling you choose. Your choice of four colors must be the same across all outputs, but you aren't required to use every color in every output.
Examples:
Possible output for input = [0, 0] (top left corner)
 #??##??
##.?#..?
?..#??.#
??##.?##
##?..#??
#.??##.?
?..#?..#
??##??##

Another possible output of the same program (input = [0, 7]):
??#??#?
?##?##??
..xx..xx
.?x#.?x#
??##??##
..xx..xx
.?x#.?x#
??##??##

A different program may also produce, for the input of "D1" (note the nonstandard but allowed chessboard orientation),
AABBCCAA
ACBACBAC
CCAABBCC
 ABBAADD
AABDABDC
BBDDBBCC
BABBACAA
AABAACCA

If there is input it's not really Kolmogorov complexity

@JonathanAllan the tag description uses who's that pokemon as an example of a kolmogorov complexity question that takes input. It's up to you if you want to compress a set of 64 constant solutions or if you want to implement a procedure to tile the chessboard and then color it.

@JonathanAllan meta discussion regarding non-constant kolmogorov complexity questions

Is the input guaranteed to be valid? I.e. the given coordinate of the gap won't be a corner of the chessboard? Also, I agree with @JonathanAllan here. In the "Who's that Pokémon?" challenge the only non-KC part was given the number input, index it into the string you generated to get the output. Whereas with your challenge, the layout could change quite a bit depending on the coordinate of the gap (I'd imagine, not sure if it differs that much).

@KevinCruijssen the chessboard is possible to tile if the gap is in the corner (one of the solutions is to respect the diagonal symmetry and to color the tiling with three colors) . And yes, you may assume the input is valid.

Removing the kolmogorov-complexity tag as per popular demand.

Aren't three colors enough?

@Arnauld you are allowed, but not required to, limit yourself to just three-colorings. I provide no guarantee such constraint is satisfiable. I welcome a sketch of a proof that it is satisfiable.

@Arnauld I'll allow that. I'll edit.

JavaScript (ES6),  184 ... 171  163 bytes
Takes input as (x)(y), with \$0\leq x\leq7\$ and \$0\leq y\leq7\$. Outputs as a string with 3 colors (marked as \$0\$, \$1\$ and \$2\$).
h=>v=>(a=[...'3232132031021010'],a[5+(v&4|h>3)]^=3,a[v/2<<2|h/2]=v%2*2+h%2,g=x=>y&8?'':(x<8?x-h|y-v?a[y/2<<2|x/2]^y%2*2+x%2?(x^y)&2:1:' ':`
`)+g(-~x%9||!++y))(y=0)

Try it online!
Method
We work on a matrix of \$4\times4\$ triominoes:
$$\begin{pmatrix}
t_0&t_1&t_2&t_3\\
t_4&t_5&t_6&t_7\\
t_8&t_9&t_{10}&t_{11}\\
t_{12}&t_{13}&t_{14}&t_{15}
\end{pmatrix}$$
Each triomino is one of:

The initial configuration of the matrix is as follows:
$$\begin{pmatrix}
3&2&3&2\\
1&3&2&0\\
3&1&0&2\\
1&0&1&0
\end{pmatrix}$$
We alternate the first 2 colors just like we would on any chessboard, which gives:

The next steps are:

According to the quadrant in which the hole is located, we rotate one of the 4 center triominoes (\$t_5\$, \$t_6\$, \$t_9\$ or \$t_{10}\$) by 180°.
We rotate the triomino on which the hole is located (it may be the same triomino as in step #1), so that it does not cover the hole.
We fill the holes with the 3rd color (except the 'real' hole).

For instance, assuming that the hole is located at \$(3,0)\$, this gives:

And it that case, the final matrix is:
$$\begin{pmatrix}
3&\color{red}1&3&2\\
1&\color{red}0&2&0\\
3&1&0&2\\
1&0&1&0
\end{pmatrix}$$
Commented
h => v => (                       // (h, v) = hole coordinates
  a = [...'3232132031021010'],    // a[] = flat representation of the 4x4 matrix
  a[5 + (v & 4 | h > 3)] ^= 3,    // first rotation, achieved by XOR'ing with 3
  a[v / 2 << 2 | h / 2] =         // second rotation according to the
    v % 2 * 2 + h % 2,            // position of the hole within the triomino's square
  g = x =>                        // g is a recursive function that converts the 4x4
                                  // matrix into a 8x8 ASCII art
    y & 8 ?                       // if y = 8:
      ''                          //   stop recursion and return an empty string
    :                             // else:
      ( x < 8 ?                   //   if this is not the end of the row:
          x - h | y - v ?         //     if this is not the position of the hole:
            a[y / 2 << 2 | x / 2] //       if this part of the triomino located at this
            ^ y % 2 * 2 + x % 2 ? //       position is 'solid':
              (x ^ y) & 2         //         use either color #0 or color #2
            :                     //       else:
              1                   //         use color #1
          :                       //     else:
            ' '                   //       the hole is represented with a space
        :                         //   else:
          `\n`                    //     append a linefeed
      ) + g(-~x % 9 || !++y)      //   append the result of a recursive call
)(y = 0)                          // initial call to g with x = y = 0

Graphical output
Click on the picture to set the position of the hole.

f=
h=>v=>(a=[...'3232132031021010'],a[5+(v&4|h>3)]^=3,a[v/2<<2|h/2]=v%2*2+h%2,g=x=>y&8?'':(x<8?x-h|y-v?a[y/2<<2|x/2]^y%2*2+x%2?(x^y)&2:1:' ':`
`)+g(-~x%9||!++y))(y=0)

;(u = (x, y) => { for(out = '', a = f(x)(y).split('\n'), y = 0; y < 8; y++) for(x = 0; x < 8; x++) out += `<div class="b b${a[y][x] == ' ' ? 'H' : a[y][x]}"></div>`; o.innerHTML = out; })(0, 0); o.onclick = e => u(e.clientX >> 4, e.clientY >> 4)
body { margin: 0; padding: 0; }
#o { width: 128px; height: 128px; }
.b { float: left; width: 14px; height: 14px; border: solid 1px; }
.b0 { background-color: #44f; border-color: #66f #22d #22d #66f; }
.b1 { background-color: #652e65; border-color: #874f87 #430c43 #430c43 #874f87; }
.b2 { background-color: #ffc90e; border-color: #ffeb2f #dda70c #dda70c #ffeb2f; }
.bH { border-color: #000; }

Constructive proof that three colors are always sufficient, very nice!

Love the clickable graphical output!

Charcoal, 78 bytes
ＮθＮη”{⊞⊟¦≦⁶q×fΣ\⊙t×_⊟✳-Y⁴℅=⁶υ”≔›θ³ζ≔›η³εＦζ≦⁻⁷θＦε≦⁻⁷ηＪ⊕÷θ²⊕÷η²§#$⁺ⅈⅉＪθη Ｆζ‖Ｆε‖↓

Try it online! Link is to verbose version of code. Outputs using #$% characters. Explanation:
ＮθＮη

Input the co-ordinates of the blank square.
”{⊞⊟¦≦⁶q×fΣ\⊙t×_⊟✳-Y⁴℅=⁶υ”

Output a compressed string. It contains newlines so to avoid breaking up the flow of this explanation you'll find the string at the end of the answer.
≔›θ³ζ≔›η³εＦζ≦⁻⁷θＦε≦⁻⁷η

If either co-ordinate is greater than 3 then remember that fact and subtract the co-ordinate from 7.
Ｊ⊕÷θ²⊕÷η²§#$⁺ⅈⅉ

Jump to the nearest % of the top-left square of %s and overwrite it with a # or $ as appropriate. (But this will get overwritten by the blank if it was already in this square.)
Ｊθη Ｆζ‖Ｆε‖↓

Blank out the square at the reduced co-ordinates and then reflect the output as necessary to get the blank to the original position.
##$$##$$
#%%$#%%$
$%%#$$%#
$$##%$##
##$%%#$$
#%$$##%$
$%%#$%%#
$$##$$##

I tried starting with the square of %s in the centre and working my way out to the desired co-ordinates but that took 90 bytes.

Python3, 936 bytes
Naive search from scratch with random candidate neighbor piece selection and restart. Still, fairly efficient on test cases.
import random
R=range
P=[[(0,x),(y,0)]for x in[1,-1]for y in[1,-1]]
M=[(0,1),(0,-1),(-1,0),(1,0)]
F=random.sample
def W(c):
 while c:
  (x,y),*c=c;c={*c}
  q,s=[(x,y)],[(x,y)]
  for x,y in q:
   for X,Y in M:
    if(U:=(x+X,y+Y))in c:c-={U};q+=[U];s+=[U]
  if len(s)<3:return 0
 return 1
C=lambda c:[(x,y)for x,y in c if sum((x+X,y+Y)not in c for X,Y in M)>1]
def f(h):
 c={(x,y)for x in R(8)for y in R(8)}-{h}
 q=[(c,[])]
 for c,T in q:
  if not c:T={tuple(i):0 for i in T};break
  if not W(c):continue
  s=C(c)
  if s:
   O=[]
   for x,y in c:
    for p in P:
     if len(U:=[(x,y)]+[t for X,Y in p if(t:=(x+X,y+Y))in c])==3 and s[0]in U:O+=[U]
   if O:
    for U in F(O,min(2,len(O))):q+=[(c-{*U},T+[U])]
 q=[(T,T)]
 for a,T in q:
  if[]==a:return T
  n,*a=a
  if(L:={*R(1,5)}-{T[j]for j in T if j!=n and any((x+X,y+Y)in j for x,y in n for X,Y in M)}):
   for i in F(L,1):q+=[(a,{**T,n:i})]
def X(h):
 while not(b:=f(h)):1
 return b

Try it online!


text:
Generate a random point outside a given rectangle within a map
Introduction
Given this visualization of a playing field:
(0,0)
+----------------------+(map_width, 0)
|           A          |
|-----+-----------+----|
|  D  |     W     | B  |
|-----+-----------+----|
|           C          |
+----------------------+(map_width, map_height)
(0, map_height)

The entire map the game is played on is the rectangle with the corner coordinates (0,0) and (map_width, map_height). The points eligible for spawning enemies is the Union $$S = \bigcup (A, B, C, D) $$
The Challenge
Write code that returns a random point(x, y) that is guaranteed to be inside S. Your code cannot introduce any additional bias, meaning that the probability of each coordinate is uniformly distributed given the assumption that your choice of generating randomness (e.g. function|library|dev/urandom) is unbiased.
Shortest solutions in bytes win!
Input
You will be given a total of 6 positive integer input variables in order:
map_width, map_height, W_top_left_x, W_top_left_y, W_width, W_height. You can assume that the (calculated) surface area of all regions(A,B,C,D,W) is each >10, so there are no empty spaces/regions.
Example Input: 1000, 1000, 100, 100, 600, 400
The input has to contain the 6 values described above but it can be passed as fewer numbers of arguments and in any order. For instance passing (map_width, map_height) as python tuple is allowed. What is not allowed of course are calculated parameters like the bottom right point of the W.
Output
2 randomly generated integers (x, y) where
$$(0 \leq x \lt \text{map_width}) \land (0 \leq y \lt \text{map_height}) \land[\neg (\text{W_top_left_x} \leq x \lt \text{W_top_left_x} + \text{view_width})\lor \neg (\text{W_top_left_y} \leq y \lt \text{W_top_left_y} + \text{view_height})]$$
holds.
Examples
Input                                    Output(valid random samples)

1000 1000 100 100 600 400                10 10
1000 1000 100 100 600 400                800 550
1000 1000 100 100 600 400                800 10
1000 1000 100 100 600 400                10 550

For details and limitations for input/output please refer to the default input/output rules

I think you should explicitly state that the output coordinates are integers (which I infer as your implicit intention).

Can we use the default input/output rules?

@agtoever it says so in the "output" section; 2 randomly generated integers (x, y)

may we take inputs in a different (consistent) order?

@agtoever yes output has to be an integers as stated in the "output" section.

@NickKennedy yes, added that to the post!

Python 2, 114 106 102 101 bytes
lambda w,h,X,Y,W,H:choice([(i%w,i/w)for i in range(w*h)if(W>i%w-X>-1<i/w-Y<H)<1])
from random import*

Try it online!

I am not sure but I think it should be [i%w, i/w]  because the range w*h/w=h but x is tied to the width in this example not the height.

@jaaq Yeah, you're right. Fixed now, thanks :)

I just checked the contents of the list you generate and it seems that your solution is incorrect. Plotting the points shows that all values are along a line and do not fill out the entire region of S as intended. Also the list you generate contains non-integer values.

@jaaq I'm not sure what you mean? The coordinates are always integers, and not on a line (eg)

sorry that was an error on my part, I messed up my scatterplot xD Could you please explain how your code works? It's really amazing but I don't get how you managed to exclude the given view from the list.

Okay I just tested the output again, just deleted the choice around and printed and plotted the resulting list for input (10,10,2,7,2,2).
also cleary i/w has to result in floating point results, since if i=77 and width=55 the result is of course 1.4

but I think the fix is as easy as doing i//w instead, didn't thoroughly test that though.

@jaaq In Python 2, a/b is already floor division, if a and b are integers (which they are here).

@jaaq Are you perhaps running the code as Python 3?

correct, my bad I did run it in Python3.

R, 89 73 bytes
function(w,h,K,D,`*`=sample){while(all((o<-c(0:w*1,0:h*1))<=K+D&o>K))0
o}

Try it online!
Takes input as width,height,c(X,Y),c(W,H).
Samples from \$[0,w]\times[0,h]\$ uniformly until it finds a point outside the inner rectangle.

05AB1E, 23 21 20 18 17 bytes
L`â<ʒ²³+‹y²@«P≠}Ω

Input is in the format [map_width, map_height], [W_top_left_x, W_top_left_y], [W_width, W_height].
Thanks to @Grimy for -1 byte, and also for making me realize I introduced a bug after my latest edit.
Try it online, output 10 possible outputs at the same time or verify all possible coordinates. (Minor note: I've decreased the example input by a factor 10, because the filter and random choice builtin arer pretty slow for big lists.)
Explanation:
The inputs map_width, map_height, [W_top_left_x, W_top_left_y], [W_width, W_height] are referred to as [Wm, Hm], [x, y], [w, h] below:
L          # Convert the values of the first (implicit) input to an inner list in
           # the range [1, n]: [[1,2,3,...,Wm],[1,2,3,....,Hm]]
 `         # Push both inner lists separated to the stack
  â        # Get the cartesian product of both lists, creating each possible pair
   <       # Decrease each pair by 1 to make it 0-based
           # (We now have: [[0,0],[0,1],[0,2],...,[Wm,Hm-2],[Wm,Hm-1],[Wm,Hm]])
    ʒ      # Filter this list of coordinates [Xr, Yr] by:
     ²³+   #  Add the next two inputs together: [x+w, y+h]
        ‹  #  Check for both that they're lower than the coordinate: [Xr<x+w, Yr<y+h]
     y     #  Push the coordinate again: [Xr, Yr]
      ²    #  Push the second input again: [x, y]
       @   #  Check for both that the coordinate is larger than or equal to this given
           #  input: [Xr>=x, Yr>=y] (the w,h in the input are ignored)
     «     #  Merge it with the checks we did earlier: [Xr<x+w, Yr<y+h, Xr>=x, Yr>=y]
      P≠   #  And check if any of the four is falsey (by taking the product and !=1,
           #  or alternatively `ß_`: minimum == 0)
    }Ω     # After the filter: pick a random coordinate
           # (which is output implicitly as result)

Thanks for adding the verify part :) great solution!

@jaaq Thanks! I've used the verifier myself after my initial version, which is when I noticed a bug I had to fix, since it was including coordinate [map_height, 0] as possible random output without the ¨. :)

*Ý¨¹‰ could be L`â< by taking the first two inputs as [map_height, map_width]. Also II could be Š, unless I missed something.

@Grimy Thanks for the L`â<. As for the II+ to Š+, you're indeed right that it would be the same.. Unfortunately I made an error myself and it should have been ²³+ instead of II+, since it would use the third input for both I (just like it would take two times the third input with Š) after the first iteration of the filter.. So implicitly thanks for making me realize I had a bug. :)

PowerShell, 85 73 bytes
-12 bytes thanks to mazzy
param($a,$b,$x,$y,$w,$h)$a,$b|%{0..--$x+($x+$w+2)..$_|random
$x,$w=$y,$h}

Try it online!
Nice simple answer which cobbles together an array made of the range of values for each dimension and then picks one randomly for x and y. Manages to reuse most of the code by first processing x, then overwriting $x with $y and running it again.

you can save a few bytes Try it online!

@mazzy I actually did stumble across the range optimization but applied it backwards, saving 0 bytes.

C# (Visual C# Interactive Compiler), 110 bytes
(a,b,c,d,e,f)=>{int g=c,h=d;for(var z=new Random();g>=c&g<e+c|h>=d&h<f+d;h=z.Next(b))g=z.Next(a);return(g,h);}

Try it online!

Julia, 76 71 67 bytes
f(w,h,a,b,c,d)=rand(setdiff((0:w-1)'.=>0:h-1,(a:a+c-1)'.=>b:b+d-1))

Try it online!

Jelly, 11 bytes
p/’$€+2¦ḟ/X

Try it online!
A dyadic link that takes two arguments, [map_width, map_height], [W_width, W_height] and W_left, W_top and returns a randomly selected point meeting the requirements.
Explanation
   $€       | For each of member of the left argument, do the following as a monad:
p/          | - Reduce using Cartesian product (will generate [1,1],[1,2],... up to the width and height of each of the rectangles)
  ’         | - Decrease by 1 (because we want zero-indexing)
     +2¦    | Add the right argument to the second element of the resulting list
        ḟ/  | Reduce by filtering members of the second list from the first
          X | Select a random element

Wolfram Language (Mathematica), 84 68 60 bytes
RandomChoice[g=Join@@List~Array~##&;#~g~0~Complement~g@##2]&

Try it online!
Take inputs as {map_width, map_height}, {W_width, W_height}, {W_top_left_x, W_top_left_y}.

Java (OpenJDK 8), 100 bytes
W->H->r->{int x=0,y=0;for(;r.contains(x+=W*Math.random(),y+=H*Math.random());x=y=0);return x+","+y;}

Try it online!
Uses java.awt.Rectangle as holder of some of the parameters. Naturally, those use int fields, and not float or double.

Oh, nice way to take the challenge literally with the Rectangle#contains builtin! :D

Python 2, 100 bytes
Input should be in the form of ((map_width, W_top_left_x, W_width),(map_height, W_top_left_y, W_height))
Output is given in the form: [[x],[y]]
lambda C:[c(s(r(i[0]))-s(r(i[1],i[1]+i[2])),1)for i in C]
from random import*;c=sample;r=range;s=set

Try it online!
Random outputs obtained from the example input:
[[72], [940]]
[[45], [591]]
[[59], [795]]
[[860], [856]]
[[830], [770]]
[[829], [790]]
[[995], [922]]
[[23], [943]]
[[761], [874]]
[[816], [923]]

Charcoal, 55 43 bytes
ＮθＮηＦＥ²Ｎ⊞υ⟦ιＮ⟧Ｉ‽ΦＥ×θη⟦﹪ιθ÷ιθ⟧⊙υ∨‹§ιμ§λ⁰¬‹§ιμΣλ

Try it online! Link is to verbose version of code. Explanation:
ＮθＮη

Input the map size. (If they were last, I could input the height inline for a 1-byte saving.)
ＦＥ²Ｎ⊞υ⟦ιＮ⟧

Input the inner rectangle. (If I could input in the order left, width, top, height then I could use Ｆ²⊞υＥ²Ｎ for a 3-byte saving.)
Ｅ×θη⟦﹪ιθ÷ιθ⟧

Generate a list of all co-ordinates in the field.
Φ...⊙υ∨‹§ιμ§λ⁰¬‹§ιμΣλ

Filter out entries where both co-ordinates lie inside the rectangle.
Ｉ‽...

Print a random element of those that are left.

Perl 5 -ap, 84 bytes
sub c{($c=0|rand((pop)+($l=pop)-"@_"))<$l?$c:$c+"@_"-$l}say c@F[4,2,0];$_=c@F[5,3,1]

Try it online!

J, 54 47 45 39 bytes
(0?@{[)^:((-1&{)~(<*/@,0<:[)2{[)^:_{~&1

Try it online!
Take input as a 3 x 2 grid like:
grid_height  grid_width
inner_top    inner_left
inner_height inner_width

Pick a random point on the entire grid: 0?@{[
Shift it left and down by the upper-left point of the interior rectangle: (-1&{)~
Return to step 1 if the chosen spot is within (<*/@,0<:[) the similarly shifted interior rectangle 2{[.  Otherwise return the original, unshifted random point.
Seed the whole process with a point we know is invalid, namely the upper left point of the interior rectangle, defined by elements 2 and 3 of the input list: {~&1

Another approach, 45 bytes
{.#:i.@{.(?@#{])@-.&,([:<@;&i./{:){1&{|.i.@{.

Try it online!
This one is conceptually simpler, and doesn't bother with looping.  Instead, we construct a matrix of all the numbers 0 to (w x h), shift it by the inner starting point, grab just the points in the (0, 0) to (inner w, innner h) subgrid, remove them from the overall grid after flattening both, pick one at random from the remainder, and convert the integer back into a point using divmod <.@% , |~

Scala, 172 bytes
Randomness? Gotcha.
(a:Int,b:Int,c:Int,d:Int,e:Int,f:Int)=>{var r=new scala.util.Random
var z=(0,0)
do{z=(r.nextInt(a),r.nextInt(b))}while((c to e+c contains z._1)|(d to e+d contains z._2))
z}

A fun implementation I could think of.
How it works: Generate a random pair in the map. If it is in the inner rectangle, try again.
Try it online!