text:
Ants on a Natural Log
This is a good beginner challenge and a good time killer.
I only said a -natural- log because the title was too short, this has nothing to do with logarithms.
Given 2 variables:

The number of ants n.
The width of the log w.

Output a log of width w with n ants (Example shown w=3, n=6)
|             |
| \O/ \O/ \O/ |
| -O- -O- -O- |
| /o\ /o\ /o\ |
|  ^   ^   ^  |
|             |
| \O/ \O/ \O/ |
| -O- -O- -O- |
| /o\ /o\ /o\ |
|  ^   ^   ^  |
|             |

A single ant looks like this:
\O/ # Upper-case O
-O- # Upper-case O
/o\ # Lower-case o
 ^

A few ant laws:

Ants may not touch each other nor the edge of the log directly, they
prefer to touch spaces.
Each row of ants must be w wide, with n/w rows of ants.
Ants always need a log, the log width is greater than 0, guaranteed.
Ants also... well, need ants, the number of ants is greater than 0, guaranteed.
Ants are also surprisingly well organized, they will fill a log from left to right, top to bottom; as if they were reading a book.

Ant-xamples
w=3, n=5
|             |
| \O/ \O/ \O/ |
| -O- -O- -O- |
| /o\ /o\ /o\ |
|  ^   ^   ^  |
|             |
| \O/ \O/     |
| -O- -O-     |
| /o\ /o\     |
|  ^   ^      |
|             |

w=1, n=1
|     |
| \O/ |
| -O- |
| /o\ |
|  ^  |
|     |

w=1, n=3
|     |
| \O/ |
| -O- |
| /o\ |
|  ^  |
|     |
| \O/ |
| -O- |
| /o\ |
|  ^  |
|     |
| \O/ |
| -O- |
| /o\ |
|  ^  |
|     |

This is code-golf, the person with the smallest bytecount wins.

Related.

@AdmBorkBork I DO remember that now. I got halfway done with it and misread the spec, may have subconsciously stole part of that idea.

These are ant-y-logs.

"Each row of ants must be w wide". If w>n should there be extra space before the right hand | or not, or is it up to us?

(note: some answers do it one way, some the other.)

There MUST be space, the log must be rectangular.

-1 for Ant-xamples (I hate puns)

can we take one input in unary?

Jelly,  44  43 bytes
Crossed out 44 is not 44 with use of
⁶ṁ;⁶jÐ€“\-/“OOo^ ”;UṖz⁶¤Y
sÇ€⁶;YỴz⁶Zj@€⁾||Y

Try it online!
How?
⁶ṁ;⁶jÐ€“\-/“OOo^ ”;UṖz⁶¤Y - Link 1, make a row of ants: list x (could be integer = length)
⁶                         - literal ' '
 ṁ                        - mould like x (makes a list of that many spaces)
  ;⁶                      - concatenate one more space
                       ¤  - nilad followed by link(s) as a nilad
       “\-/“OOo^ ”        -   literal      ["\-/","OOo^ "] ("..." a list of chars really)
                   U      -   reverse each [" ^oOO","/-\"]
                  ;       -   concatenate  ["\-/","OOo^ "," ^oOO","/-\"]
                    Ṗ     -   pop          ["\-/","OOo^ "," ^oOO"]
                      ⁶   -   literal ' '
                     z    -   transpose & fill ["\O/","-O-","/o\"," ^ ","   "]
    jÐ€                   - join left mapped over right
                          -   (join the spaces with each of the ant parts in turn)
                        Y - join with newlines

sÇ€⁶;YỴz⁶Zj@€⁾||Y - Main link: n, w
s                 - split n into chunks of length w (implicitly makes a range of length n)
 Ç€               - call the last link (1) as a monad for €ach
   ⁶;             - a space concatenated with that
     Y            - join with newlines
      Ỵ           - split at newlines (both the ones we just joined with AND the others!)
       z⁶         - transpose & fill with space characters (making the shorter rows,
                  -   including the single space as long as the longest one)
         Z        - transpose it back the right way
             ⁾||  - literal ['|','|']
          j@€     - join with reverse arguments for €ach (put each row between pipes)
                Y - join back up with newlines
                  - implicit print

I have asked about w<n in a comment since it's slightly ambiguous.
If the log needs to be w ants wide rather than just the ants being w wide, it costs two bytes:
⁶ṁ;⁶jÐ€“\-/“OOo^ ”;UṖz⁶¤Y
+RsÇ€YỴz⁶Zj@€⁾||ṫ5Y

This does the same as before except rather than prepending a single space to make the first, blank line it creates a whole extra row of ants and chops off all but its trailing blank line.

PHP>=7.1, 150 Bytes
for([,$w,$n]=$argv;$i<ceil($n/$w)*5+1;)echo str_pad("| ".str_repeat(["","\O/ ","-O- ","/o\ "," ^  "][$i%5],$n<$w*ceil($i++/5)?$n%$w:$w),$w*4+2)."|\n";

Online Version

I got error when clicking "online version" and "execute code".

@KjetilS. change the PHP Version to 7.1

Yes, 7.1 is ok.

V, 70, 68 bytes
i \O/
 -O-
 /o\
  ^  Àä{ò@bf }C GïpòÇÓ/d
HÄÒ çÞ/ÙÒ
ëI|yê$p

Try it online!
00000000: 6920 5c4f 2f20 0a20 2d4f 2d20 0a20 2f6f  i \O/ . -O- . /o
00000010: 5c20 0a20 205e 2020 1bc0 e416 7bf2 4062  \ .  ^  ....{.@b
00000020: 6620 167d 4320 1b47 ef70 f2c7 d32f 640a  f .}C .G.p.../d.
00000030: 48c4 d220 e7de 2fd9 d220 0a16 eb49 7c1b  H.. ../.. ...I|.
00000040: 79ea 2470                                y.$p

This has never happened to me before, but a known bug has actually saved me bytes!
It's kinda hard to explain exactly what's going on, but unfortunately when you try to duplicate something by columns, V will move one column over before duplicating. Which is why originally I did:
h<C-v>{dÀp

which doesn't use the duplicate operator. However, because we already needed to move one line over, we can simply do
hÀä<C-v>{

Nice! A potential nomination for the bug exploitation :P.

Python 2, 144 bytes
n,w=input()
s=' ';k='|';a=k+s*w*4+s+k;print a
while n>0:
 for i in['\\O/','-O-','/o\\',' ^ ']:print k+s+(i+s)*min(w,n)+s*4*(w-n)+k
 n-=w;print a

Try it Online!

SOGL, 74 71 74 bytes
 |pe4*I@*o |o→L:"╔O¦‘2n;"nΤ↕¬┐α┐PΝld‘*┼eG-’⁵@**┼ |4*┼OL→ALbe÷:?{eA}}be%:?A

First part: function which outputs an empty log part
             →L  define function L
 |p              output in a newline "|"
   e4*           multiply width by 4
      I          increace that
       @*        get that many spaces
         o       append [to current line] that
           |o    append "|"

The second part has a compressed string "nΤ↕¬┐α┐PΝld‘, which is the ant. It decompresses to \-/ OOo^/-\     .
That's the ant (with spacing to the right), but taken top-to-down then to right like
159d
26ae
37bf
48cg

It's stored like that because the ┼ function appends strings like that (that's because then you can multiply the string to add multiple instances to it).
The part itself: function which asks for a number on stack denoting how many ants to draw.
                                    Example input: width 3, on stack 2
:                                   duplicate the input                             [2,2]
 "╔O¦‘                              push "| | | | "                                 [2,2,"| | | | "]
      2n                            split into chunks of two                        [2,2,["| ","| ","| ","| "]]
        ;                           put one of the input copies ontop of the stack  [2,["| ","| ","| ","| "], 2]
         "...‘*                     multiply that many ants                         [2,["| ","| ","| ","| "], "\\-/ OOo^/-\\     \\-/ OOo^/-\\     "]
               ┼                    add horizontally the ants                       ["| \O/ \O/ \O/ ",
                                                                                "| -O- -O- -O- ",
                                                                                "| /o\ /o\ /o\ ",
                                                                                "|  ^   ^   ^  "]
                e                   get the width                                   [["| \\O/ \\O/ \\O/ ", "| -O- -O- -O- ", "| /o\\ /o\\ /o\\ ", "|  ^   ^   ^  "], 3]
                 G-                 subtract input from it                          [["| \\O/ \\O/ \\O/ ", "| -O- -O- -O- ", "| /o\\ /o\\ /o\\ ", "|  ^   ^   ^  "], 1]
                   ’⁵@*             push 16 spaces                                  [["| \\O/ \\O/ \\O/ ", "| -O- -O- -O- ", "| /o\\ /o\\ /o\\ ", "|  ^   ^   ^  "], 1, "                "]
                       *            multiply [the 16 spaces and empty place count]  [["| \\O/ \\O/ \\O/ ", "| -O- -O- -O- ", "| /o\\ /o\\ /o\\ ", "|  ^   ^   ^  "], "                "]
                        ┼           add that horizontally                           [["| \\O/ \\O/ \\O/     ", "| -O- -O- -O-     ", "| /o\\ /o\\ /o\\     ", "|  ^   ^   ^      "]]
                          |4*┼      add 4 vertical bars to the array                [["| \\O/ \\O/ \\O/     |", "| -O- -O- -O-     |", "| /o\\ /o\\ /o\\     |", "|  ^   ^   ^      |"]]
                              O     output the array                                []
                               L    call the empty line function                    []
                                →A  define as A

And the main function:
L                  call the empty line drawing function
 be÷               push floor(b/e) (the amount of full lines)
    :?{eA}}        that many times call A with the full width on the stack
           be%     push b%e (the leftovers)
              :?   if truthy (aka !=0)
                A   call A with for the leftovers

05AB1E, 47 bytes
"   \O/-O-/o\ ^ "5äðìI.D)IôvyøJ'|ì})˜¬¸«.B„ |«»

Try it online!
Explanation
"   \O/-O-/o\ ^ "                                # push the ant-string
                 5ä                              # split into 5 parts
                   ðì                            # prepend a space to each
                     I.D                         # copy input-1 number of times
                        )                        # wrap in a list
                         Iô                      # split into parts each the size of input-2
                           v                     # for each row of ants
                            yø                   # zip, so body parts are on the same row
                              J'|ì               # join to string and prepend a pipe to each
                                  }              # end loop
                                   )˜            # wrap in a flattened list
                                     ¬¸«         # append a copy of the first row (spaces)
                                        .B       # pad rows to equal length with spaces
                                          „ |«   # append " |" to each row
                                              »  # merge on newlines

Perl 5, 159 bytes
($w,$n)=@ARGV;
print
$_%$w?"":"| ",
['   \O/-O-/o\\ ^ '=~/.../g]->[($_<5*$w*int$n/$w||$_%$w<$n%$w?$_/$w:0)%5],
($_+1)%$w?" ":" |\n"
for 0..$w*(6+5*int(($n-1)/$w))-1

Try it online!
Perl 5, 152 bytes
Another one based on the Python solution:

($w,$n)=@ARGV;
$b=' 'x($w*4+1);$j=$a="|\n|";
map$j.=' '."$_ "x($w<$n?$w:$n).'    'x($w-$n).$a,'\\O/','-O-','/o\\',' ^ 'and$n-=$w
while$n>0;
print"|$b$j$b|"

Try it online!

Mathematica 210 Bytes
StringRiffle[If[#2==c||#2==1,"|",If[r-#1<6&&#2>2+4 (a+w-h w),Table[" ",5,4],Characters@"    \\O/ -O- /o\\  ^  "~Partition~4][[1+Mod[#1-1,5],1+Mod[#2+1,4]]]]&~Array~{r=5(h=⌈(a=#)/(w=#2)⌉)+1,c=4w+3},"\n",""]&

Thinking I need to make a Mathematica based golfing language.

Python 2, 166 bytes
w,n=input()
print'\n'.join(['|'+' '*w*4+' |']+[' '.join(['|']+[p]*r+['   ']*(w-r)+['|'])for r in[w]*(n/w)+[[],[n%w]][n%w>0] for p in['\O/','-O-','/o\\',' ^ ','   ']])

Charcoal, 43 bytes
ＮθＦ⪪× Ｎθ«←Ｐ↓⁶Ｍ⊗⊕⊗θ→Ｐ↓⁶⸿Ｅ⪪\O/-O-/o\ ^ ³⭆ι⁺μκ

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

Input w.
Ｆ⪪× Ｎθ«

Input n, then create a string of n spaces and split it into rows of length w (except the last piece which may be smaller). Loop over those rows.
←Ｐ↓⁶Ｍ⊗⊕⊗θ→Ｐ↓⁶⸿

Print the sides of the log section.
  \O/-O-/o\ ^           Literal string
 ⪪            ³         Split into (4) pieces of length 3
Ｅ                       Map over each piece
               ⭆ι       Map over each row space
                 ⁺μκ    Appending the piece
                        Implicitly print the results on separate lines


text:
Tips for golfing in Charcoal
Charcoal is a language created by ASCII-only and DLosc that specialises in ASCII art challenges.
What tips do you have for golfing in Charcoal? Obviously I am looking for tips related specifically to Charcoal, not those which can be applied to most - if not all - languages.

Screw it, I'll go try to do a charcoal answer on something, brb. Maybe I can give minor pointers on this thread.

Take advantage of the deverbosifier
Using the deverbosifier means you can write in ASCII (--dv or --deverbosify to deverbosify, -v or --verbose to execute as verbose code). Furthermore, it compresses strings for you, which can be useful in some ASCII-art challenges when the string to compress is too long.
@Neil recommends using -vl or -v --sl. This is short for --verbose --showlength, meaning it will be interpreted as verbose Charcoal, and the length of the normal Charcoal code will be shown. Also, when deverbosifying, check the output to make sure that the input has actually been parsed correctly, since Charcoal generally ignores parse errors. If there is a syntax error, use -a (--astify) or --oa (--onlyastify) to help figure out the problem.

Further to this, I recommend using -v -sl. Also, when deverbosifying, check the output to make sure that the input actually got parsed correctly, as you don't always get a parse error.

Learn your reflections and rotations
There are a lot of variations of the basic reflection and rotation, so it pays to know what the subtle differences are. Key to tables:

Command: Name of the command in Verbose mode.
Transform: Whether Charcoal should attempt to flip or rotate the characters as it mirrors or rotates them. For instance, a / might become \ after a rotate or flip.
Keep Original: Whether Charcoal should merge the result with the original canvas.
Overlap: (Only applies when Keep Original is Yes.) Determines the position of the axis of reflection/rotation, in half characters from the border. In the case of reflections, equivalent to the number of rows/columns that are not affected and end up in the middle of the result. In the case of rotations, the rotated copy is allowed to overwrite clear areas (but not spaces) in the original.

Reflections
|         Command         | Transform | Keep Original | Overlap |
|-------------------------|-----------|---------------|---------|
| Reflect                 | No        | No            | n/a     |
| ReflectCopy             | No        | Yes           | 0       |
| ReflectOverlap          | No        | Yes           | 1       |
| ReflectOverlapOverlap   | No        | Yes           | n       |
| ReflectTransform        | Yes       | No            | n/a     |
| ReflectMirror           | Yes       | Yes           | 0       |
| ReflectButterfly        | Yes       | Yes           | 1       |
| ReflectButterflyOverlap | Yes       | Yes           | n       |

The direction of reflection is optional. The default is to reflect once to the right. For those reflections that keep the original, a multiple direction is allowed, which simply repeats the command for each direction. (This means that for instance ReflectMirror(:¬) will actually create four copies in total.)
The cursor is moved along with the reflection (even when the original is kept).
Rotations
|         Command         | Transform | Keep Original | Overlap |
|-------------------------|-----------|---------------|---------|
| Rotate                  | No        | No            | n/a     |
| RotateCopy              | No        | Yes           | 0       |
| RotateOverlap           | No        | Yes           | 1       |
| RotateOverlapOverlap    | No        | Yes           | n       |
| RotateTransform         | Yes       | No            | n/a     |
| RotatePrism             | Yes       | Yes           | 0       |
| RotateShutter           | Yes       | Yes           | 1       |
| RotateShutterOverlap    | Yes       | Yes           | n       |

For those rotations that keep the original, there is an optional origin of rotation. The default is the bottom right of the canvas. Allowable values are any of diagonal directions.
The amount of rotation (in 45° increments) is optional. The default is 2, i.e. 90° anticlockwise (counterclockwise). For those rotations that keep the original, there are two alternative options: a multidigit integer specifies to rotate the canvas once for each digit and then merge the results, while an integer list simply repeats the command for each rotation, with variable results depending on how the canvas changes in between.

Question: What does Transform mean?

@CalculatorFeline Good question. The cases where Transform is no are simply a character-for-character copy. For instance, a standard reflection of "4>2" is just the characters in reverse order, i.e. "2>4". This isn't always desirable, so Transform attempts to switch characters in the most appropriate manner, thus the reflection of "4>2" would become "2<4". Transform may not be the best description of this, so feel free to suggest something better.

Can't think of anything better, so you should just explain how Transform works in the answer somewhere.

@CalculatorFeline I've added a key to the table, just in case the other columns weren't clear either.

The bugs should be fixed now. Also thank you so much for taking the time to write this explanation!

You might want to mention that the cursor will (well at least it should) end up on the same position on the final copy as before the transformation.

@ASCII-only Indeed, it does for reflections and basic rotations but for the rotations that keep a copy the cursor doesn't quite end up at the same place. (I think I have at least one answer that depends on the buggy behaviour...)

@ASCII-only Also while testing I found that diagonal reflections with an overlap of more than 1 don't work properly.

If you mean they move vertically that's intended behaviour, I guess that isn't exactly useful (btw can you accept/decline the GitHub invite pls)

@ASCII-only Why would you want ReflectOverlap(:DownRight, 2); to overlap 1 horizontally and 2 vertically?

Let us continue this discussion in chat.

Hi, Is there a way to reflect a specific line in a drawn oblong, something like: cl -v -c "Oblong(60,24, '/////'+5*'\');JumpTo(0,Plus(4,(8)));Ref*();" , That after executing line 4,8 be reflected.

@jixperson I'm not sure what you're trying to achieve but the various Reflect commands can only reflect the whole canvas. For your second comment you're trying to draw a line of length 36028797018963968. That's not a reasonable thing to do, sorry. Did you mean Print(Cast(c));?

I wanted to shorten the length of this program: Try it online! by reflecting the line instead of jump and print, Oh shoot i thought character -*n is just a representation of that number.

@jixperson Well, you can immediately save a byte by using Oblong for the other lines. Best I could do offhand is Oblong(5, 4, "/"); ReflectMirror(:Down, :Right); ReflectMirror(:Down, :Right); ReflectMirror(); ReflectButterflyOverlap(20); ReflectButterflyOverlap(:Down, 8);.

Oh so the use of reflect would be to reflect/print from the starting point and extend the previous ones instead. cool.

Use the predefined variables
Here is a list of all the variables that can be used, giving the succinct greek letter and the verbose letter that represents it.
α/a: The uppercase alphabet
β/b: The lowercase alphabet
γ/g: A string of all the ASCII characters from space to ~
δ/d: The fifth input
ε/e: The fourth input
ζ/z: The third input
η/h: The second input
θ/q: The first input
υ/u: An empty array
φ/f: 1000
χ/c: 10
ψ/y: The null character
ω/w: The empty string

The variables representing inputs will be empty if not enough input exists, but all other variables not shown here must be assigned before use.

These should be fixed on TIO now, it would be nice if you could verify that it works

@ASCII-only Can you confirm that y and f are the other way around from what I've pasted? (I may have misread the greek letters when I originally wrote this.)

Yeah they're the other way around

Use overloads
For example, many commands only need one argument:

Rectangle, Oblong and Box make a square if only one argument is given
Reflect commands default to reflecting right
Rotate commands default to 90 degrees counterclockwise
Polygon and PolygonHollow can accept a multidirectional and a side length. This can be used if all of the sides are the same length.

I discovered that fact about PolygonHollow by accident. You can even have several multidirectionals, but they have to come before normal arrows (I don't know whether this limitation is intentional). I used that in my answer to the "Draw a cube" challenge.

Hmm the limitation is kinda intentional, but I guess I should change it because it wouldn't hurt anyway

I see you fixed Polygon to accept arrows and multidirectionals in any order, thanks! While I'm here, I was expecting ReflectButterfly dls to call ReflectButterfly for each direction, but (as the wiki correctly documents) it actually calls ReflectOverlap.

@Neil lol oops, I'll try to fix that ASAP (I think that's a coincidence too haha)

Avoid consecutive constants of the same type
For example, Plus(Times(i, 2), 1) translates as ⁺×ι²¦¹, but you can save a byte by switching the parameters: Plus(1, Times(i, 2)) translates as ⁺¹×ι² and Plus(Times(2, i), 1) as ⁺×²ι¹ both of which save a byte. Plus(1, Times(2, i)) (which translates as ⁺¹×²ι) would be even better if there was another numeric constant following it.

Use multidirectionals
Some commands can accept multidirectionals: +X*|-\/<>^KLTVY7¬⌊⌈. What they expand to are here. In general, the direction list starts from up and continues clockwise.

Any particular reason why some commands accept multidirectionals but others require a direction list? (There might be a good reason for this that I'm overlooking, but I was trying to do ReflectButtterflyOverlap(:¬, Modulo(g, 2));.)

@Neil I don't think so, will change ASAP

Use commands without a command character
An expression that is not part of a command is printed.
If it is preceded by a direction, the expression is printed in the specified direction.
Numbers are printed as a line with the specified length using a character selected from \/-|.
If a direction is not followed by an expression, it is counted as a move one space in the specified direction.
Note: This may sometimes be counted as part of the previous command so the command character may actually be required. (thanks Neil for reminding me)

You have to watch out for ambiguities though because the previous command may accept an optional parameter.

Make full use of Sum
Sum has lots of handy overloads:

On a list of strings, concatenates them together. However, if it's possible that the list might be empty, this would give None, so in this case, use Join(..., "") instead.
On a non-empty list of numbers, simply takes their sum.
On a non-empty list of lists, concatenates them together (flattens to depth 1).
On an integer, takes the sum of its digits. (Floating-point values are truncated to integer. If you want the sum of the decimal places, cast to string first.)
On a string containing only digits and optionally one . character, takes the sum of the digits.
On a string containing numbers and separators, takes the sum of the numbers cast to int or float (but note that - counts as a separator).

A convenient side-effect of the last two rules is that if you use Sum on a character then the digits 1-9 get cast to their value and everything else returns zero, unlike Cast, which fails for non-digit values.

Note that while these all work on the version of Charcoal on ATO, the version currently on TIO is buggy and won't Sum a list of lists.

Use Filter to slice the first character from an array or string
Even if you're lucky, using Slice to slice the first character from a string takes 2 bytes: Slice(..., 1). It will take longer if the expression to be sliced ends in a number, requiring a separator, or if the following code can be interpreted as an expression, as in that case Slice will want to consume it as an additional parameter.
Instead, just use Filter(..., k), which drops the first element, thus achieving the desired result. (Obviously use the appropriate loop index variable if your expression is nested inside another loop.) This is always 2 bytes and cannot be affected by surrounding code.

Additionally, if you want the first element of a string, then CycleChop(..., 1) will fail if the string is empty, so for the condition of a while loop you would consider Slice(..., 0, 1, 1), but Filter(..., Not(k)) will also return an empty string in that case.

Use switch instead of if (Equals(...)) where possible
The construct
if (Equals(q, h)) ...
else ...

takes 4 bytes but written as a switch it only takes 3 bytes:
switch (q) {
case h: ...
default: ...
}

However this only works if the else portion can be unambiguously parsed as a command rather than an expression. In particular:

If the else portion is empty, then this only works at the end of a block or program, but that was true for the original if statement.
If the else portion contains multiple commands, then this works as an if but not as a switch.
If the else portion prints an expression, then this only works as a switch at the end of a block or program.

Some useful uses of Base
Base(array, 1) is like Sum(array) for a numeric array, but it returns 0 when the array is empty, while Sum returns None, which is usually inconvenient to process, unless you're using it in a Boolean context.
Base(array, 0) returns the last element of a numeric array (or 0 if the array is empty) without modifying the array.
Base([x, y], Negate(1)) returns y-x. This is useful to compare the elements of a two-element array for equality (typically calculated from a Map).
Base(array, number) also works to substitute a number in a polynomial.
In all the above cases the two parameters can be exchanged if it is inconvenient to have the number second (i.e. if it would require two consecutive numbers to be separated).

Use split for a string array, split and cast for a number array
Split for a string array is only three characters of overhead, and split and cast is only four characters of overhead. Compare this to writing the array literally, which would require array start and end, and a separator between every array element.
If your number array only has numbers less than 95, use either a cast (if all numbers are less than 10) or index into one of the predefined variables.

source: Stack Exchange

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/

sort: votes


text:
Grow Some Flowers!
Spring has recently arrived, and it is almost the time when flowers start to sprout. So I want you to help them grow.
Your task:
Given two numbers, m, and n, output m flowers randomly placed on an n*n grid.
A single flower looks like this:
&
|

A flower's position is defined by where its & is. When randomly placing two flowers, no two can be in the same place. If one flower's & overlaps another flower's |, display the &. The bottom row of flowers may not contain any &.
Input can be as a number or a string, through any of the standard methods.
Output can be a list of strings, each string representing one row of the grid, or a delimited string following the same guideline as the list. Standard methods of output. Trailing whatevers are allowed, and you can use tabs to separate your flowers. Note that every grid must be completely filled, with spaces or something.
Note that the input will always be valid, you will always be able to legally fit the m flowers into the n by n grid.
Test cases:
Since only very tight test cases can be guaranteed, due to the whole "random placement" bit, that will be the only kind of test case with an answer provided. But I will try all submissions online to make sure that they are valid using some test cases too.
Input for the test cases is given in the form m, n.
Input: 2, 2
Output:

&&
||
--------------
Input: 6, 3
Output:

&&&
&&&
|||

Note that the newline after the word Output: in the test cases is optional.
Other test cases:

1, 10
0, 100
5, 8
6, 3

Code golf so shortest code wins!
Thank you to ComradeSparklePony for making this challenge and posting it in the Secret Santa's gift box!. Sandbox post

When you say "randomly", does every possible outcome need to have equal probability?

Jelly, 33 bytes
²‘;⁹R¤ṬṖs⁸×’¤Ẋ€ṙ2B¤F€ZḄị“&|& ”s⁸Y

Try it online!
How?
²‘;⁹R¤ṬṖs⁸×’¤Ẋ€ṙ2B¤F€ZḄị“&|& ”s⁸Y - Main link: n, m        e.g. 3, 2
²                                 - square n                    9
 ‘                                - increment                   10
     ¤                            - nilad followed by link(s) as a nilad:
   ⁹                              -     link's right argument   2
    R                             -     range                   [1,2]
  ;                               - concatenate                 [10,1,2]
      Ṭ                           - untruth (1s at indexes)     [1,1,0,0,0,0,0,0,0,1]
       Ṗ                          - pop                         [1,1,0,0,0,0,0,0,0]
            ¤                     - nilad followed by link(s) as a nilad:
         ⁸                        -     link's left argument    3
           ’                      -     decrement               2
          ×                       -     multiply                6
        s                         - split into chunks           [[1,1,0,0,0,0],[0,0,0]]
             Ẋ€                   - shuffle €ach       (maybe:) [[0,1,0,0,1,0],[0,0,0]]
                  ¤               - nilad followed by link(s) as a nilad:
                2B                -     2 in binary             [1,0]
               ṙ                  - rotate (vectorises)         [[[0,0,0],[0,1,0,0,1,0]],[[0,1,0,0,1,0],[0,0,0]]]
                   F€             - flatten €ach                [[0,0,0,0,1,0,0,1,0],[0,1,0,0,1,0,0,0,0]]
                     Z            - transpose                   [[0,0],[0,1],[0,0],[0,0],[1,1],[0,0],[0,0],[1,0],[0,0]]
                      Ḅ           - from binary (vectorises)    [0,1,0,0,3,0,0,2,0]
                        “&|& ”    - literal                     ['&','|','&',' ']
                       ị          - index into                  [' ','&',' ',' ','&',' ',' ','|',' ']
                               ⁸  - link's left argument        3
                              s   - split into chunks           [[' ','&',' '],[' ','&',' '],[' ','|',' ']]
                                Y - join with newlines          [' ','&',' ','\n',' ','&',' ','\n',' ','|',' ']
                                  - implicit print

My mind has been blown

Did You swap meanings of m and n or why do you square m? wth is a nilad?

Are these 33 characters really only 33 bytes?

@Titus I did not swap the meanings, I swapped the input order (and in doing so messed up the explanation), so thanks for catching that. A nilad, (as opposed to a monad or a dyad or ...) is a function that takes no inputs and returns a value - as such a constant is a nilad, as is a single input to a function or program. These really are 33 different bytes - the characters are just an encoding of the 256 bytes Jelly uses as linked to by the word bytes in the header.

You almost lost me at rotate. Great job; excellent breakdown!

@Titus rotate  takes a list and moves everything left, circling back around, so [3,1,4,1,5,9]ṙ2 would yield [4,1,5,9,3,1]. It vectorises, so, for example, [3,1,4,1,5,9]ṙ[2,4] would yield [[4,1,5,9,3,1],[5,9,3,1,4,1]]. I hope that de-mystifies it!

PHP (>=7.1), 135 131 128 116 110 109 bytes
for([,$m,$n]=$argv,$z=$q=$n*$n;$q;)echo" |&"[$m&&rand(0,--$z-$n)<$m?$s[$q]=2+!$m--:$s[$q+$n]/2],"
"[--$q%$n];

takes input from command line arguments; run with -nr or test it online.
breakdown
for([,$m,$n]=$argv,     # import arguments
    $z=$q=$n*$n;        # $q = number of total fields, $z-$n = available for flowers
    $q;                 # loop $q down to 0
)
    echo" |&"[              # print:
        $m&&rand(0,--$z-$n)<$m  # if (probability $m/($z-$n)), decrement $z
            ?$s[$q]=2+!$m--     # then index 2 (flower), set $s[$q], decrement $m
            :$s[$q+$n]/2        # else if flower above, then 1 (stalk), else 0 (space)
        ],
        "\n"[--$q%$n]           # print newline every $n characters
    ;

You did add the bytes for the flag right?

@Christopher -r is free; it tells PHP to run code from command line argument. -n resets PHP to default settings.

@JonathanAllan The version preset there seems to depend on your previous visit; probably a cookie.

Python 2, 150 bytes
from random import*
n,m=input()
b=[1]*m+[0]*(n*~-n-m)
shuffle(b)
for r in range(n):print''.join(' &|'[f^-s]for s,f in zip([0]*n+b,b+[0]*n)[r*n:r*n+n])

Try it online!
How?
Takes input() from STDIN and unpacks the tuple provided (a comma separated string of decimal integers like 3,6) into n and m.
Creates an ordered, one dimensional n*(n-1) long "flowerbed", b, by concatenating:
 - a list containing a "flower" [1] repeated m times; and
 - a list containing a "space" [0] repeated n*~-n-m times*.
* The tadpole operator ~ (~x=-1-x) saves 2 bytes with n*~-n-m in place of the more normal looking n*(n-1)-m.
Shuffles (using random's shuffle function) this flowerbed to place the flowers and spaces randomly amongst the n*(n-1) positions.
Steps through the 0-indexed rows, r, and prints each in turn to create a two dimensional flowerbed from the one dimensional one...
The final two dimensional (n*n) flowerbed has stalks, s, one row below flower heads, f, if and only if there is no flower head to show. This is achieved by XORing (^) f with -s where f and s are the 1s and 0s from before and using the result to index into the length 3 string ' &|':
f   s   f^-s   ' &|'[f^-s]
0   0    0     ' '
0   1   -1     '|'  < negative indexing used here
1   0    1     '&'
1   1   -2     '&'  < ...and here.

To get f and s the zip function is used with two copies of the one dimensional flowerbed, one with n trailing spaces (the flower heads) and one with n leading spaces (the stalks). The whole thing is created for each row (to save bytes), and the row required is sliced out using [r*n:r*n+n].

Python 2, 184 179 bytes
from random import*
m,n=input()
s,a=' &'
l=[s]*n*-~n
while s.count(a)<m:x=randrange(n*n-n);l[x]=a;l[x+n]='|&'[l[x+n]==a];s='\n'.join(''.join(l[i*n:][:n])for i in range(n))
print s

Try it online!

Python 2, 129 bytes
from random import*
n,m=input();d=n*n-n
s=''
while d+n:b=0<random()*d<m;m-=b;d-=1;s+=' |&'[-b|(s[~n:-n]=='&')]+'\n'[d%n:]
print s

Try it online!
Generates the output string one character at a time. Randomly chooses whether the current cell is a flower with probability equal to the number m of remaining flowers divided by the number of remaining spaces. Adds a newline every n characters. A blank cell is filled with a stem | if the symbol n from the end is a &.

JavaScript (ES6), 157 bytes

f=(n,m,a=[...(` `.repeat(n)+`
`).repeat(n)],r=Math.random()*-~n*~-n|0)=>m?(a[r]==` `?a[m--,r]=`&`:0,f(n,m,a)):a.map((c,i)=>c==` `&&a[i+~n]==`&`?`|`:c).join``

<input id=n type=number min=2 value=2><input id=m type=number min=1>

Explanation: Creates an array representing the grid of flowers plus newlines. Recursively randomly searches for empty squares in which to place flowers until the desired number of flowers is reached. Finally the stems of the flowers are generated where there is space for them.

For some reason this throws an error when n=2 and m=3.

@Shaggy That's because there's only room for 2 flowers.

Ah, I was reading it the wrong way 'round. Apologies.

PHP, 111 Bytes
for([,$b,$s]=$argv;$i<$s**2;)echo${+$i}="| &"[(rand(1,$s**2-$s-$i)>$b?0:$b--)>0?2:${$i-$s}!="&"],"\n"[++$i%$s];

Online Version
-1 Byte for a physical Newline
a solution 115 Bytes using max
for([,$b,$s]=$argv;$i<$s**2;)echo${+$i}="&| "[rand(1,max($s**2-$s-$i,1))>$b?1+(${$i-$s}!="&"):!$b--],"\n"[++$i%$s];

This way with 137 Bytes shuffles the first part of the string
for([,$b,$s]=$argv,$a=str_shuffle(($p=str_pad)($p("",$b,_),$s**2-$s));$i<$s**2;)echo$a[$i]<_?" |"[$a[$i-$s]==_&$i>=$s]:"&","\n"[++$i%$s];

Charcoal, 27 bytes
Ｎθ↷ＦＮ«Ｊ‽θ‽⊖θＷ⁼ＫＫ&Ｊ‽θ‽⊖θ&¬ＫＫ

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

Input n.
↷

Change the default printing direction to downwards.
ＦＮ«

Input m and loop that many times.
Ｊ‽θ‽⊖θ

Jump to a random location on the grid.
Ｗ⁼ＫＫ&Ｊ‽θ‽⊖θ

If there is already a flower, keep jumping to random locations until a suitable spot is found.
&

Print the flower head.
¬ＫＫ

Print the stalk if there is not already a flower head below.

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


text:
Find a User's SE Reputation
Challenge
Given a SE user's ID, output the sum of their reputation from across all of the Stack Exchange networks the user has signed up to.
Rules
If a user has 101 or less reputation on a site, count it as zero in the sum.
You should not count Area 51 rep or hidden communities!!
URL shorteners are disallowed.
Examples
Subject to change
User 3244989 (Beta Decay)
14141

User 918086 (Dennis)
204892

User 11683 (Jon Skeet)
1029180

Winning
The shortest code in bytes wins.

curl, grep and awk, 106 bytes
curl http://api.stackexchange.com/users/$1/associated|grep -o n\"[^,]*|awk -F: '$2>101{s+=$2}END{print s}'

It's dirty but seems to work well. I don't use awk often so I wouldn't be surprised if there was a way to golf the grep away with it.

Python 2 (with Requests), 149 Bytes
from requests import*
lambda i,r="reputation":sum(u[r]for u in get("http://api.stackexchange.com/users/"+i+"/associated").json()["items"]if u[r]>101)

I requested the API, converted the API to JSON, then summed the reputation via a generator expression.  The generator does remove accounts with less than 101 reputation.
Credit for improving the code: Jonathan Allan.

R with httr, 146 Bytes
library(httr)
a=sapply(content(GET(paste0("http://api.stackexchange.com/users/",readline(),"/associated")))$items,'[[','reputation')
sum(a[a>101])

JavaScript (ES6), 148 143 142 141 bytes
u=>fetch(`//api.stackexchange.com/users/${u}/associated`).then(j=>j.json(s=0)).then(i=>(i.items.map(r=>s+=(r=r.reputation)>101&&r),alert(s)))

Try it

f=

u=>fetch(`//api.stackexchange.com/users/${u}/associated`).then(j=>j.json(s=0)).then(i=>(i.items.map(r=>s+=(r=r.reputation)>101&&r),alert(s)))

i.addEventListener("submit",e=>{e.preventDefault();(v=+i.firstChild.value)&&f(v)})
<form id=i><input type=number><button>Calc.</button></form>

Does this ignore Area 51?

@BetaDecay, I think so. I'm editing a caveat into my answer now to explain.

Oh right, I didn't think it'd be so simple to filter out

@BetaDecay, is that confirmation that that endpoint doesn't include A51 sites?

What do you mean by endpoint? :/

@BetaDecay, the API endpoint I'm using to retrieve a user's data. e.g., does http://api.stackexchange.com/users/918086/associated include A51 sites. From Neil's comnent on his answer, it looks like it doesn't.

Let us continue this discussion in chat.

Ruby 2.4, 136 + 20 = 156 bytes
Requires the -rjson -rnet/http -n flags. Input is from STDIN (no trailing newline). Ruby 2.4 is needed for sum.
p JSON.parse(Net::HTTP.get URI"http://api.stackexchange.com/users/#$_/associated")["items"].map{|i|i["reputation"]}.select{|i|i>101}.sum


text:
Cheapo Enigma machine (Cops)
For robbers' post, Cheapo Enigma machine (Robbers)
A cop's submission will consist of a program/function that accepts a single byte of data and return a single byte of data. Every possible input must produce a unique output. (In the other words, your function must be bijective)
Robbers will attempt to create the inverse function of yours using as short a code as possible. So your objective is to make your function difficult to invert.
You cannot use built-ins that have the sole purpose of hashing or encryption.
Your byte count cannot exceed 64 bytes. 0-byte solutions are not eligible for winning.
Input/Output format
8 bits (0 or 1), or a base-10 integer in range 1-256, 0-255 or -128 to 127. Can use standard I/O or file I/O. Function can also return a value as output. Input and output should belong to the same range (binary, 1-256, 0-255 or -128 to 127).
The robber will also be required to use this range for input and output.
Scoring
Ratio of your byte count to that of the best robber's attempt against you. Lowest score wins.
You are eligible to win (as a cop) only if a robber has attempted to defeat you. (This robber may be you)
Example
C++, uses 0-255 range, 31 bytes
int x;
cin>>x;
cout<<(x+1)%256;

Possible robber submission in C++, 32 bytes
int f(int x)
{return x?x-1:255;}

Using the same language or a similar algorithm isn't a requirement
This gives a score of 31/32 = 0.97 to both the cop and the robber.

What does a cop submission consist of? Language, size and full program/function code?

isn't it a bit broken if the cop can just make an arbitrarily large thing?

This robber may be you What if I post a 64-byte cop answer that maps N to N and a robber answer that does the same thing in one byte?

@Arnauld Yes, cop submission consists of a single program/function.

@Arnauld I already mentioned, the robber's code isn't competitive in that case; only the cop's code is.

@DestructibleLemon That's why there's a limit of 64 bytes.

You may want to specify if / how the cop submission should be updated when robbers answer it. (The usual "cracked" update doesn't apply here, I guess. At least not as a unique and definitive crack.)

Using the same language or a similar algorithm isn't a requirement I missed that at first. Especially the part about the language should be made more prominent.

On second thought, you might want to remove that rule altogether. I can destroy most answers by posting a robber in Jelly.

Can I also try to out-cop a robber submission?

Does the OP mean "injective" instead of "bijective"?

@LeakyNun if every input maps to a different output in the same range, it is bijective within that range.

@Dennis Yes, you are free to. Otherwise someone may win the challenge simply by using a language others are not familiar with, or have no interest in coding in.

@flawr Yes, you can post multiple answers with multiple function mappings. If you haven't changed the mapping, you can edit the original answer.

@Dennis Also certain functions may be missing in certain languages, making it difficult to invert the function.

@LeakyNun If you have a function that from a finite set to another finite set of the same size, then bijective, injective and surjective are all equivalent.

Javascript, 11 8 bytes, Score: 8 / 5
x=>x^x/2

Simple implementation of gray code. Decoding usally needs a whole loop. Let's see who comes up with the smallest or even without a loop !

I guess x^x/4 will be harder because there shouldn't be builtins for it ...

Score: 8/25

Score: 8/5 (Note: I don't think it should be allowed to use another language for the robber submission, but at this point, it is.)

@Dennis I knew there would be an answer like this ;) anyway I still think the idea was good ^^

How is this bijective?

@LeakyNun Uhm not sure what kind of an answer you expect but I'll try: Gray code is an alternative form of representing a number where each consecutive number only changes in 1 bit (hammig distance is always 1). For each number there is exactly one gray encoding and one binary encoding therefore they form a bijection. E.g. 7 is 0111 in binary and 0100 in gray, the next number 8 is 1000 in binary and 1100 in gray. Gray coding is basically the edge coding of binary.

@LeakyNun ^ is bitwise xor, not exponentiation. Anyway it looks magic

C, 64 bytes, Score 64/71 = 0.901
T[256];f(x){srand(x&&f(x-1));for(;T[x=rand()%256]++;);return x;}

Takes input in the range [0 255].
Try it online! — on TIO (using GCC), this produces:
103,198,105,115,081,255,074,236,041,205,186,171,242,251,227,070,
124,194,084,248,027,232,231,141,118,090,046,099,051,159,201,154,
102,050,013,183,049,088,163,037,093,005,023,233,094,212,178,155,
180,017,014,130,116,065,033,061,220,135,112,062,161,225,252,001,
126,151,234,107,150,143,056,092,042,176,059,175,060,024,219,002,
026,254,067,250,170,058,209,230,148,117,216,190,097,137,249,187,
168,153,015,149,177,235,241,179,239,247,000,229,202,011,203,208,
072,071,100,189,031,035,030,028,123,197,020,075,121,036,158,009,
172,016,080,021,111,034,025,125,245,127,164,019,181,078,152,224,
077,052,188,095,119,108,134,043,085,162,004,211,054,226,240,228,
079,073,253,169,008,138,010,213,068,091,243,142,076,215,045,066,
006,196,132,173,222,048,246,032,133,007,244,185,195,217,160,120,
218,106,083,144,087,238,207,096,210,053,101,063,098,128,165,089,
140,012,192,131,047,039,022,147,184,109,182,193,199,237,018,069,
057,157,174,104,122,166,055,110,003,040,139,086,145,114,129,113,
206,167,191,214,146,221,136,038,156,082,200,029,044,204,223,064

Note that on other systems, it may produce different (but still valid) output, since C does not mandate a specific rand implementation. My submission is specifically the version running on TIO (as linked).

I'm quite disappointed that I wasn't able to get a version like my original (f(x){return rand(srand(x*229))/229%256;}) to work on TIO, since I think that's much more elegant. Since that only works on Clang running on OS X, it isn't fair for the competition. This one's still pretty awkward to reverse, so that's enough I guess.

Well..This is amusing!

Solution here, but I had a bit of a hard time with your srand(), so you'll have to decide if it's acceptable in this form.

I fail to see how this program fulfills the Bijection requirement, since output is random not every input has a unique output.

I wrote a long list of why this submission isn't worth a single upvote but in fact it boils down to this: This doesn't provide a specific mapping but the group of all mappings. It then restricts itself to a single mapping by enforcing a specific implementation on a specific platform thereby loopholing the need to deal with other languages.

@Appleshell I found a way to fix the srand value without costing an extra byte. I can only apologise that it changes the output, but at least it's fixed on something specific now and doesn't rely on broken behaviour. Might be a little awkward for your answer since it uses 0 for x=0 and x=107 (because x=106 returns 0), and 1 for all other runs.

@WheatWizard fixed :)

@Christoph I don't think I'll convince you, but on PPGC languages are defined by their implementation, not their spec (which is why TIO provides 3 different C compiler choices), and TIO's implementation is freely available to anybody who wants to run it. That's distinct from my original answer which only worked on OSX (which isn't freely available, so I consider unacceptable; hence why I deleted it). That's not to say there was no issue at all; Appleshell noted that srand without arguments wasn't locking down the output like I thought it was, which I consider a mistake and have fixed.

The problem is not the implementation. The problem is that it lacks what I think are all key ideas of this challenge: Finding a trival algorithm (therefore limited to 64 bytes and language independent) that is nontrival to reverse. Your submission "feels" to loophole on: Language independence, the 64 byte limit by outsourcing to an unknown implementation of a builtin (rand does not depend on the language but the local stdlib) and the hash/encryption rule. It's within PPCG's rules but certainly not what ghosts_in_the_code intended with his rules.

@Christoph Generating random numbers doesn't violate the rule against using a hashing function, but totally agree with everything else you said. Would you recommend I edit the rules to invalidate this? And if so, what edit exactly should I make?

@Dave I updated my solution for this version! :)

@ghosts_in_the_code good RNGs and hash functions are both designed to hardly be reversible. Therefore I think they should be included in that rule (even if the actual implementation might not be designed this way). Anyway I don't recommand changing the rules at this stage.

Score 64/71

Jelly, 2/5
^H

Try it online to see the whole table.

Hm, looks like @Christoph had the same idea 9 hours before me...

JavaScript, 44 bytes 22/3
x=>a.sort()[x]
for(a=[],i=0;i<256;)a[i]=i++;

Uses lexicographic sort (Javascript Default) to rearrange all the numbers from 0-255
Try it online!

22/3 - different language seems acceptable, even if a little odd. I thought I had 5, but 256 got in my way :).

C (gcc), 32 27/30 bytes
Thanks to christoph for golfing 5 bytes.
f(x){x=x?f(x*5+1&255)+1:0;}

Try it online!

Score 32/30. You might want to switch to f(x){x=x?f(x*5+1&255)+1:0;} for a score of 27/30.

JavaScript, 13 bytes 13/12
x=>(x<<9)%257

Input and output are both in the range 1->256
Try it online!

Score: 13/19

Score: 13/12

Octave, 16/6
@(x)mod(x*3,256)

Try it online!

Score: 16/6 (Note: I don't think it should be allowed to use another language for the robber submission, but at this point, it is.)

It would also be interesting to know whether I can try to beat your robber submission by making another cop (again using Jelly or MATL too)

Ruby, 23 bytes
->x{('228'*x).to_i%257}

Range and domain is 0..255. Concatenate 228 to itself x times, then take the result modulo 257 (0 maps to 0). 228 is the first magic number after 9 that works for this range (gives distinct values that don't include 256).

Javascript, 11/8 bytes
x=>x**5%257

Domain/range is 1 through 256.

Hm, is Javascript bad with large number exponents? This works in Ruby: https://repl.it/HXvZ/0

JavaScript only has double-precision floats, so anything with more than ~53 bits cannot be represented exactly. x**3 and x**5 should work.

Well, serves me right for assuming. I'll change languages.

Or do Dennis's suggestion, given the rules favoring terser languages. :) Thank you!

Unfortunately, the rules are a bit broken at the moment, and I would be allowed to invert this with another language. Precisely because of the precision limit, this will be rather verbose to invert using JS.

Score: 11/8

Javascript, 27/29 bytes
x=>x-6?x*95%127+x*98%131:65

Edit: Range/Domain is 1..256. Generated via brute force, more or less.

Sadly it's bijective but not in range [0,256): the value of 130 is never outputted but a value of 256 is (which doesn't fit a 8 bit int).

Score 27 / 29. I like it !

Thanks! The rules allow me to specify a range of [1,256], and it's bijective on that range.

Java, 35 bytes
int a(int v){return (v*v+v)%512/2;}

Domain/Range are 0-255

Score: 35/7

Python 3, 32 bytes 32/23
V=lambda x:((3+x)%16)*16+x//16

Domain/Range is 0-255.
Flips the first four bytes with the last four, and adds a three to the first bytes.

Score 32 / 23

Python 3, 55 bytes
y=lambda x,i=3:x if i==0 else pow(3,y(5*x,i-1),257)-1

Domain/Range is 0-255.

Mathematica, 13 bytes
Mod[#^7,257]&

Uses the range [1..256], although it's equally valid on the range [0..255]. To see the entire table, copy/paste one of the following lines of code into the Wolfram sandbox:
Array[ Mod[#^7,257]&, 256]   (for a list of values in order)
Array[ Rule[#,Mod[#^7,257]]&, 256]   (for a list of input-output rules)

brainfuck, 37/11
,+++++[>+++++++<-]>++[<+++++++++>-]<.

Try it online!
Not very good but range of 0-255

Score: 37/11

@Dennis Nice job! I should not use such a bytey language.

By the way, censoring language names isn't a good idea. Yes, this particular languages has an ordinary and childish name, but everyone knows what the asterisk stands for, and it cannot be found by the search engine in its current form.

@Dennis finally fixed that

authors: Евгений Новиков


text:
Cheapo Enigma machine (Robbers)
For cops' post, Cheapo Enigma machine (Cops)
A robber's submission consists of a program/function that accepts the output of a cop's code and returns the input for all the outputs provided by that cop's code. (In other words, you must write the inverse function)
You cannot use built-ins that have the sole purpose of hashing or encryption.
Input/Output format
8 bits (0 or 1), or a base-10 integer in range 1-256, 0-255 or -128 to 127. Can use standard I/O or file I/O. Function can also return a value as output. Input and output must belong to the same range (as in, binary, 1-256, 0-255 or -128 to 127), which must also be the same range as that used by the cop.
Scoring
Ratio of the cop's byte count to your byte count. Highest score wins.
You can submit a robber attempt against your own cop code for reference. (Of course this code isn't eligible for winning)
Notification
Please edit the corresponding cop's answer to include your new byte count and the corresponding ratio.

At first I was wondering how you were going to make Emigna into a machine. Then I realized you weren't talking about the user.

OK, sorry for bothering you again, but I want to make sure I got it right this time. If the brainfuck answer reads and prints bytes (code points 0 to 255) and my Jelly answer takes an integer between 0 and 255 and returns an integer in the same range, is that acceptable?

@Dennis No, it isn't. Maybe you (or someone else) could suggest an alternate wording that makes this clearer.

@carusocomputing Emigna is a machine, right? He has every single 05AB1E program loaded up in his memory system, yeah?

JavaScript by Christoph, 8/25
f=(y,x=0)=>y?f(y/2,x^y):x

(range 0-255)
Sadly, f=(y,x)=>y?f(y/2,x^y):x works for all values except 0.
Technical note
We use y/2 rather than y>>1 to save a byte. This is abusing the fact that any value of y will eventually be rounded to 0 because of arithmetic underflow.

JavaScript by fəˈnɛtɪk, 13/19
x=>((514>>x%2)-x)/2

(range 1-256)

C, by Dave, 64/95 92 85
b,i,e,t[256];r(x){for(;!b;++i,b=e==x)for(srand(i&&e);t[e=rand()%256]++;);return i-1;}

Try it here!
C, shorter version, 64/89 71
i,e,t[256];r(x){for(srand(1);t[e=rand()%256]++||++i,e!=x;);return i-1;}

This one is more implementation specific, but works on TIO.
Same length as the PHP solution, I wasn't able to get it any shorter than this.
Try it here!

Ok I will take it up with the cops submission then.  Thanks for informing me.

JavaScript, 11/13
x=>a.sort().indexOf(x)
for(a=[],i=0;i<256;)a[i]=i++;

Try it online!

Jelly, 22/3 = 7 1/3
⁹ḶDÞḊi

Try it online!
The cop submission by fəˈnɛtɪk was to return the nth (0-indexed) lexicographically sorted decimal number using the domain [0,255].
I first literally reversed the operation described, ⁹ḶDÞi⁸‘ - takes the lowered range of 256, ⁹Ḷ, and Þ instructs to sort it by a key function of conversion to a decimal list, D; then finds the index of, i, the input, ⁸, and subtracts 1, ‘ (Jelly lists are 1-indexed).
Then I golfed it by dequeuing the sorted list with Ḋ. When an item is not found i returns 0 as required for the removed first element (0), while everything else is found one index earlier, allowing the removal of the decrement, ‘, which in turn gives i implicit input on its right from the left (only) input to the monadic link.

Javascript by Magenta, 32 / 23
x=>x%16*16+(x/16+13)%16

Code basically switches the lower and the upper 4 bits and does a modulo addition on one part.

PHP, Score 64/71
for(srand(0);$a<256;)$b[$c=rand()%256]++||$d[$c]=$a++;echo$d[$argn]|0;

Luckily PHP's rand just forwards to the stdlib like C. So this works as long as we're using the same stdlib. This means it works on TIO but not on e.g. sandbox.onlinephpfunctions.com. The current version of Dave's code just iterates over a pseudorandom sequence and returns the nth unique value so I guess there might be much shorter answers if a golfing languages also uses the stdlib.
Here's an implementation of Dave's code that does not dependent on the stdlib. That might also help.

+1 for finding a way to switch language on this one! Any idea why this doesn't need to srand(1)? Also here's a Try it online!

@Dave srand(x&&f(x-1)) this stops only if x==0 therefore it gets seeded with 0 on the first round. Not sure why the next calls don't change it.

@Dave it seems  srand(0) breaks rand (see here). I guess srand(0) automatically gets promoted to srand(1). I guess if you could use a different seed each time it would get a lot harder to break it.

Interesting that this works. Seems to be specific to the stdlib version used on TIO, the behaviour in C on there is apparently the same, while on my local machine with clang it requires to re-invoke srand with 0 resp. 1 on each iteration, instead of just invoking it once with 0.

@Appleshell seems Christoph's suspicions are correct: glibc has a special check. See here: http://stackoverflow.com/a/8049852/1180785 (since you mention clang, I'm guessing your local is OSX, so no glibc)

Javascript by histocrat, 27 / 29
x=>x-65?x-126?x*127%258:131:6

Sadly two hard codings are needed in order to break it. Note that the orginal function doesn't map any value to 130 but maps a value to 256.

Having 256 in the range is legal according to the rules ("8 bits (0 or 1), or a base-10 integer in range 1-256"). This is still a valid Robber on that range, though!

JavaScript by fəˈnɛtɪk, 13 / 12
x=>x*128%257

Another multiplicative inverse.

Octave, 16/18
@(x)mod(x*171,256)

Try it online!

C (gcc) by Bijan, 32 / 30
g(x){x=x?g(--x)*205+51&255:0;}

Had a fun time golfing it, thanks ! x= allows to skip return with gcc and tcc (you might want to change your answer to include it). g(--x)*205+51&255 is the inverse.

Jelly, 2/5
^H$7¡

Try it online to see the whole table.

Jelly, 8/5
^H$7¡

Try it online to see the whole table.

Jelly, 16/6
×171%⁹

Try it online to see the whole table.

Jelly, 11/8
*205%257

Try it online to see the whole table.
In case robber submissions in a different languages are disallowed in the future, I call dibs on the following solution.
g=(x,y=0)=>x-++y**5%257?g(x,y):y

Jelly, 37/11
O_77×191%⁹Ọ

Uses the same I/O format as the cop. Not sure if that is required.
Try it online to see the whole table.
How it works
For input n, the cop answer computes f(n) := ((((n + 5) % 256 × 2) % 256 + 2) % 256 × 9) % 256. Since % is a linear operator, this is equivalent to f(n) = (((n + 5) × 7 + 2) × 9) % 256. Expanding the right term, we get f(n) = (63n + 333) % 256 = (63n + 77) % 256.
Reversing this is rather straightforward. To undo the addition, we simply have to subtract 77. Also, since 191 × 63 % 256 = 12033 % 256 = 1, it follows that 191 is 63's inverse modulo 256, so multiplying by 191 undoes multiplying by 63. This way, g(n) = (n - 77) × 191 % 256 defines the inverse of f.

Jelly, 35/7
⁹Ṗ+\%⁹i

Try it online to see the whole table.

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


text:
Optimal rotation for broken touchscreen
Background:
Okay, i dropped my android smartphone and damaged the touchscreen
The lower half (yeah, exact half!) is spider-webbed and does not work (potrait-mode)
Fortunately for me, the display itself is working
My phone is already rooted and adb enabled, so i have managed to enable 360 degree display rotation
Using this phone almost appeared to be an excercise in frustration, having to rotate the phone this way and that, in order to touch/tap/swipe the inaccessible screen estate
But I've gotten pretty good at it now
  T O P
 _ _^_ _
|       |
|       |
|_ _ _ _|
| / / / |
|/ / / /|
|_/_/_/_|

 _ _ _ _ _ _
|/ / /|     |  T
| / / |     |\ O
|/ / /|     |/ P
|_/_/_|_ _ _|

Code Golf Challenge:
Given the current screen orientation and the desired (Row,Column) coordinate to touch, find the optimal rotation to access the point - direction and count
Assumptions:

This challenge is only for the App icons in the App Drawer, assume that the screen always shows the full grid of Apps and nothing else
Size of the grid is 6 Rows X 4 Columns in portait mode
Apps fill only one page in the App drawer - total number of apps is 24
Screen orientation can have four possible values - 0,90,180,270
  0 - Normal Potrait
  90 - Landscape achieved by turning the phone counter-clock-wise
  180 - Reverse Potrait achieved by turning the phone counter-clock-wise
  270 - Reverse Landscape achieved by turning the phone counter-clock-wise
Input will always be in the format  (Row,Column,Current Orientation), including parantheses and commas with no spaces
Counting starts from 1
Note that the coordinates are WYSIWYG - meaning, the Row number and column number are with respect to the current orientation
  Ex: (2,5,270)
  Which is Row 2, Column 5 while in Landscape

    _ _ _ _ _ _
 T |     |/ / /|
 O/|     | /?/ |
 P\|     |/ / /|
   |_ _ _|_/_/_|

Rules:

Standard Loopholes apply
Output may contain newlines
If the there are two equally optimal outcomes for a given input, both must be output by the code, sorted by clock-wise outcome first
Output should be in the format (Direction of rotation,Number of 90 degree turns), including parantheses and commas with no spaces
    Ex: (C,2)
        (CC,1)
If the current orientation is the optimal choice for a given input, the code should output 0
Shortest code wins!

Test cases:
#1
Input: (2,3,270)
Output: 0

#2
Input: (3,3,90)
Output: (C,1)

Will add more when i get time!
This is my first code-golf challenge, questions and suggestions welcome
Happy golfing!

Oh Oh, formatting is all messed up, trying to fix now!

Help! Someone fix my ASCII art! Please!

Is there any reason you are specifying an input format for this challenge and requiring string output?

@JonathanAllan Thanks, fixed. Also, not specific reason for the input/output formats other than introducing some variety and a bit of challenge

@JonathanAllan Many apologies, i made a mistake in copy-pasting. Fixed again

Many thanks fox fixing the ASCII art, i do hope it helps in visualizing the device rotation

Coordinates are in the order of (Distance from top, distance from left side, orientation), right?

Are the test cases right? (3,3,90) means the phone has been turned 90 degrees counter clockwise, which puts the broken part on the right, so (3,3) would be visible (if counting top-bottom, left-right).

Maybe this is because the icons are reordered as you turn the phone and hence (3,3) is the 15th icon reading as if Latin script, moving to (4,3) in normal portrait mode and hence on the bottom half? - This is not mentioned anywhere though, and would make that icon inaccessible.


text:
Garbled Phone Numbers
You know how you get a voicemail message and the person's connection wasn't great, and you're trying to figure out how to call them back, but you're not sure if that was a "5" or an "8" they said?
That's this challenge.
The good news is that the caller read off their number twice, but it's garbled in both places.
Your program should take input like this:
5551231234 / 5551231234

Where the first ten digits are the first time the phone number is said in the voice mail and the second set are the second time it's said.  Only...it'll look more like this:
555?ABC1_36? / 55?522_1?234

A digit followed by a question mark means that that's the best-guess for that digit (e.g. "5?" means "probably a 5, compare with repeat").
An underscore indicates a known missing digit, something too fuzzed by static to be deciphered at all.
Letters are just that: letters. Treat them as their respective digits

ABC -> 2, DEF -> 3, GHI -> 4, JKL -> 5, MNO -> 6, PQRS -> 7, TUV -> 8, WXYZ ->9
All sample inputs use uppercase (you can safely omit a ToUpper() call)
If your language works better in lower case, you can freely use lowercase for the input and omit a ToLower() call. Just note that in your answer.

You can additionally assume the following judgement calls:
5? / _     -> 5  //5 is the best guess we have, use it
5? / 5?    -> 5  //uncertain, but matching
5? / 4?    -> ?  //conflict
 5 / 4     -> ?  //conflict
5? / 4     -> 4  //solid information overrides possible value
 5 / 4?    -> 5  //solid information overrides possible value
 _ / _     -> ?  //no information available

Additionally you can assume that all inputs will contain ten-digit phone numbers, not including the question marks. Inputs that aren't ten digits (e.g. 1234567 / 1234567) can either be treated as unsolvable (falsey output) or throw an error.
Input
One line of characters 0-9A-Z _?/, as described above.
Output
If it can be parsed to a single valid ten-digit phone number, output the phone number. Otherwise output some form of error indication (e.g. -1, false, or an empty line).
Shortest wins, as per usual.
Sample inputs:
1234567890 / 1234567890
1234567890? / 1234567890
123456789_ / 1234567890
1234567890? / 123456789_
1234567890 / 1234567890?
1234567890 / 123456789_
123456789_ / 1234567890?
1234567890? / 1234567890?
1234567890? / 1234567891?
123456789_ / 123456789_
555CALLUS1 / 5552255871
404_12?6039 / 4041?1560_9
_GETREVENGE / 16?36?_2838_
1?691460_50 / 16_14609?50
61?08977211 / 612?897725?1
40?0INSTA__ / 8?00_NSTI?LL
3985_534?10 / 39?8?5053_10
7__7294?737 / 7797299?_37
28?897_384?1 / _8?89763861
271168090_ / 27116800?09
6802?148343 / 67?01148343
94_11628?2?6? / 9491162_47?
17?4285_689 / 1__26?52689
6_311?95_38 / 6731194?7?38
380?7DRAGON / 3807378?5?66
4?647_93236 / 5646?6?9__36
365?268898_ / 366267?7?984
GRATEDBATE / IRATEDBATE
5307_079?93 / ____8_____
535_3_0255 / 52?5_3_024?5
55_____088 / 54?2397207?7?
6_48398_95 / _946?398?6_5?
_0_312_3_1 / 81?53123?1?71
____1_____ / 64?255?508?61
8427820607 / 6?424?8?__6?07
50_3707__6 / 52?8375?74?56
615___8255 / 62?526?983?2?1?
__652618__ / 8365261__0
149___933_ / 1_9677?92?31
___7?281562 / 3438?28154?2
5?7?7?___8?3?7?4 / 57_855837_
605_272481 / 605427__81
86?569__731 / 88560?0?7721
1__91654?15 / 17?9?9165715
800NWABODE / 80069ABI?DE
8___9017_0 / 8_2494?12?9_
_024?5?91?470 / 304?17908?7_
42510704_2 / 4_51070492
9338737_89 / 93_873PLUS
327762_401 / 327_MASH01
33093_2058 / 3309_12058
4061_33578 / 40619_3578
559_383197 / 559938_197
94_9746084 / 9459746_84
1_37655238 / 163POLKA_T
_672FRIZZY / 767237499_
8_76318872 / TIP63188_2
51_8404321 / 5178404_21
358_030314 / 358603_314
2597_85802 / 25979_5802
77141_1408 / 7714_91408
330858_457 / 330_586457
4686079_39 / 46_6079239
86457508_6 / 8_45750826
523226626_ / _23BANNANA
_ISSY_ISSY / 44__9548?79?
6?00B_YJILT / 800289KILL?
2?52803___0 / 1526?0390?61?
FI?ND___T?HE / EAS?T?EREGGS?
0_231?95_38 / 0723194?7?38
0?647_39236 / 0646?6?3__36
025?267798_ / 06?6265?9?984
0061_33578 / _0619_3578

I've only insured that every possible edge-case is covered (the first 11 entries), but other than that, it's pretty much random.
Update
Four entries at the bottom added with leading zeros (at Jonathan Allan's suggestion).
Correct output for the sample inputs:

 https://pastebin.com/gbCnRdLV

Based on the output from Jonathan Allan's entry (the formatted output was ideal).

Do we have to take the inputs as a single string, seperated by " / ", or can we just take them as two standard inputs?

@L3viathan I had originally conceived the idea as having to take a single string.

@Draco18s single string doesn't bring anything to the challenge

@fəˈnɛtɪk No one said anything in the sandbox, but I have nothing against using input pairs. It was just the way I originally conceived it.

Would it be fine in case of failure to output a part of the output and a 0 in the next line?

@dzaima I would say no.

Can we take the input without the spaces before and after the /?

@mathjunkie Not unless you take two separate input strings.

Who leaves a voicemail using letters for their phone number?!

@JonathanAllan 0-800-SRVCSPMRS, that's who.

Can we output a string with uncertain digits marked with a ?, such as 543?56?890?

@Arnauld No, the point is to identify those digits. If you are unable to, then the phone number cannot be uniquely identified and the program should output some sort of error or falsey value.

Jelly, 84 bytes
+4 bytes - I think it should probably behave the same in all cases, so I've converted the keypad lookup integers back to digit-characters using +49Ọ.
”?e‘ḣ@µ”_eḤ‘ẋ@
;Ṃµ68DṬ+3RØAṁẇ@€FT+49Ọȯµ€Fṡ2i”?Ḃ$ÐḟÇ€
ḟ⁶ṣ”/Ç€ZLÐṂ€Q€LỊ$ÐfF€Ḣ€ḟ”_µL⁼⁵ȧ

A function which takes the string in the specified format and returns the phone number as a list of character or zero if invalid. As a program this is printed as if it were a string.
The way it works they could repeat the number more times
(e.g. "123456789_ / 123456789_ / 1234567890")
...or even only say it once, and the logic defined will apply.
Try it online!, or see all the sample inputs.
How?
”?e‘ḣ@µ”_eḤ‘ẋ@ - Link 1, helper to vary the length of a 2-slice: list s
”?             - literal '?'
  e            - exists in s                   (1 or 0)
   ‘           - increment                     (2 or 1)
    ḣ@         - head with reversed @rguments  (s or s[:1] - removes 2nd value if not '?')
      µ        - monadic chain separation, call that t
       ”_      - literal '_'
         e     - exists in t                   (1 or 0)
          Ḥ    - double                        (2 or 0)
           ‘   - increment                     (3 or 1)
            ẋ@ - repeat t that many times      (t*3 or t - [`_`]->['_','_','_'])

;Ṃµ68DṬ+3RØAṁẇ@€FT+49Ọȯµ€Fṡ2i”?Ḃ$ÐḟÇ€ - Link 2, reformat a phone number: char list of [0-9][A-Z], p
;                                     - concatenate p with
 Ṃ                                    - minimum of p - (?<_<0<1<...<9<A<...<Z - never "?" however, since it only follows a digit.)
                                      -   - this is simply to make a 2-slice with the last character on the left, as used at the very end of this link.
  µ                                   - monadic chain separation call that q
                       µ€             - monadic chain separation, for €ach v in q do:
   68                                 -   literal 68
     D                                -   cast to a decimal list -  [6,8]
      Ṭ                               -   untruth                -  [0,0,0,0,0,1,0,1]
       +3                             -   add 3                  -  [3,3,3,3,3,4,3,4]
         R                            -   range                  -  [[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3],[1,2,3,4],[1,2,3],[1,2,34]]
          ØA                          -   uppercase alphabet     -  ABCDEFGHIJKLMNOPQRSTUVWXYZ
            ṁ                         -   mould like the range ^ -  [ABC,DEF,GHI,JKL,MNO,PQRS,TUV,WXYZ]
             ẇ@€                      -   sublist v exists in that? for €ach, with reversed @rguments
                F                     -   flatten        (e.g. 'E' -> [0,1,0,0,0,0,0,0]; '4' -> [0,0,0,0,0,0,0,0]
                 T                    -   truthy indexes (e.g. 'E' -> [2]; '4' -> [])
                  +49                 - add 49
                     Ọ                - cast to character
                      ȯ               -   or             (e.g. 'E' -> [3]; '4' -> '4')
                         F           - flatten
                          ṡ2          - all slices of length 2
                                 Ðḟ   - filter discard if:
                                $     -   last two links as a monad:
                            i         -     first index of
                             ”?       -     literal '?'   (first index returns 0 if none exists)
                               Ḃ      -   mod 2 (so this filter discards pairs starting with '?')
                                   Ç€ - call the last link (1) as a monad for €ach slice

ḟ⁶ṣ”/Ç€ZLÐṂ€Q€LỊ$ÐfF€Ḣ€ḟ”_µL⁼⁵ȧ - Main link: string (or char list) s
ḟ                               - filter discard any:
 ⁶                              - literal ' '
  ṣ                             - split on:
   ”/                           - literal '/'
     Ç€                         - call the last link (2) as a monad for €ach
       Z                        - transpose
         ÐṂ€                    - filter, for €ach, keep items with minimal:
        L                       -   length
            Q€                  - de-duplicate €ach
                 Ðf             - filter keep items with:
                $               - last two links as a monad:
              L                 -   length
               Ị                -   insignificant? (=1 effectively here)
                   F€           - flatten €ach
                     Ḣ€         - head €ach
                       ḟ        - filter discard any of:
                        ”_      -   literal '_'
                          µ     - monadic chain separation, call that r
                           L    - length(r)
                             ⁵  - literal 10
                            ⁼   - equal?
                              ȧ - and r (0 if r did not result in a 10-digit list, else r)

Looks like there may be an error, 55_____088 / 54?2397207?7? should resolve to 5523972088: all the missing digits are present and the uncertain digits on the right are available on the left.  All the simplistic cases run though.

Ah, I removed what I thought was a redundant filter, it was not. Fixing...

Been there before--and it wasn't golf! ;)

Ooof that took me a while (I found a different bug while I was testing it), got it back to the same byte count as just adding back the filter when fixing that though so (whew).

@Draco18s - does everything look good to you? It could be good to give the expected output for the test cases in the question, or maybe just separate out the invalid ones.

Yeah, I'll have to compile all the outputs for the input sample list. For the moment I've just been looking at the ones that return 0 and going "does this make sense?" They were all generated by hand (I found a list of 50 random phone numbers and went through and mutated them).  The last sample should parse though, 3268373443

Python 2, 314 307 274 bytes
lambda s:g(*''.join(q<n<"["and`(int(n,36)-4-(n>"R")-(n>"Y"))//3`or n for n in s).split(" / "))
def g(a,b,s=str.startswith):
 if b:c,d,e,f=a[0],a[1:],b[0],b[1:];b=(c==e and[c,q][c=="_"]or"_"in c+e and min(c,e)or[q,c,e][s(f,q)-s(d,q)])+g(d[s(d,q):],f[s(f,q):])
 return b
q="?"

Try it online!

Python 3, 549 530 509 453 449 410 406 394 393 391 bytes
I'm sure this can be improved, but it's a start:
def f(e,z,q="?",u=str.isnumeric):
 if e+z in(e,z):return""
 o,O,t,T,*x=e[0],e[1:2],z[0],z[1:2],e[1:],z[1:]
 if"?"in o+t:return f([e,x[0]][o==q],z)
 if u(o):
  if u(t):return t+f(*x)if O==q!=T else o+f(*x)if o==t or T==q!=O else 1
  return o+f(*x)
 if u(t):return t+f(*x)
def g(s):
 for a,b in zip(map(chr,range(65,91)),"2223334445556667777888999"):s=s.replace(a,b)
 return f(*s.split(" / "))

I'm using str.translate for the letters, and a wrapper function g to make the inputs in the format in which I want them. The actual function f is recursive, and will fail for ambiguous inputs. I still have lots of repititions in there though, so I'm sure there's lots of room for improvement.
Improvements:

saved 19 bytes by combining conditions
saved 21 bytes with ternaries
saved 56 bytes using a dictionary comprehension instead of the manual dictionary, thanks to @TuukkaX
saved 4 bytes by switching to the method suggested by @ovs, with @TuukkaX's improvement
saved 38 bytes with improvements from @ovs (and the last removable whitespace removed)
saved 4 bytes by putting defining str.isnumeric in a keyword argument
saved 12 bytes with combined comparison operators (e.g. T==q!=O)
saved 1 byte by turning not(e or z) into e+z in(e,z).
saved 2 bytes by saving the frequently used (E,Z)

This contains a dictionary comprehension that doesn't contain the top row defaults. I hate the sequences of 3, but those might be replaced with math.

You can use replace instead of translate to save some bytes

@ovs Nice. The alphabet can be changed to map(chr,range(65,91)) though.

@ovs @TuukkAX Thanks! That makes 100 bytes saved overall from the original solution.

@ovs [e,E][o==q] is great. Given that a lot of the work hasn't been done by me, should I mark the question as community wiki?

Have you tested if"?"in o+t:return f([e,E][o==q],z)? I deleted this comment because it gave me an RecursionError. It should do the same though.

@ovs Works for my test cases, but I haven't included all of them.

RE: Making this a community wiki to waive reputation, the consensus would be no, just accept the kind help, and credit it like you have.

I swear every time I come back here this answer gets shorter :D

JavaScript (ES6), 180 190 188 bytes
Edit: +10 +9 bytes to comply with the falsy output rule

Takes the two input strings in currying syntax (a)(b). Returns either false or a string representing the guessed phone number.
a=>b=>!(s=(F=a=>a.match(/(.\??)|_/g).map(([x,y])=>(x<=9?++x:parseInt(x,36)*.32-(x>'Y'))|(x!='_'&!y)*16))(a).map((x,i)=>(x=(d=x^(y=F(b)[i]),x>y)?x:y)&&(d&16|!(d%x))?--x&15:a).join``)[10]&&s

How it works
Step #1 - Parsing the input strings
We first define the F() function which translates a string into an array of integers by applying the following rules:

the underscore is converted to 0
a digit N or an equivalent letter is converted to (N+1) OR 16 (e.g. "2" → 19, "R" → 24)
a digit N or an equivalent letter followed by an interrogation mark is converted to N+1 (e.g. "2?" → 3, "R?" → 8)

Which can be interpreted the other way around as follows:

0 → unknown
[ 1 .. 10 ] → unreliable
[ 17 .. 26 ] → reliable

We apply F() to both a and b. This gives us a pair of integers (x, y) for each digit in the phone number, corresponding to the two possible interpretations.
Step #2 - Guessing the digits
For each pair (x, y), we compute:

d = x XOR y
x = MAX(x, y) → reliable values are always preferred to unreliable ones

If x == 0, it means that both inputs are underscore characters. So, the digit is unknown in this case.
If x != 0, we can safely deduce the digit if one of the following conditions is true:
condition       | interpretation
----------------+------------------------------------------------------
(d AND 16) != 0 | one input is unreliable and the other one is reliable
d == 0          | both inputs are identical
d == x          | one input is an underscore

The last two conditions can be merged with !(d % x). Hence the final formula:
x && (d & 16 || !(d % x))

If true, we convert x back to the guessed digit by computing (x - 1) AND 15.
Test cases
(Only the 50 first ones because the console snippet can't support more output history.)

let f =

a=>b=>!(s=(F=a=>a.match(/(.\??)|_/g).map(([x,y])=>(x<=9?++x:parseInt(x,36)*.32-(x>'Y'))|(x!='_'&!y)*16))(a).map((x,i)=>(x=(d=x^(y=F(b)[i]),x>y)?x:y)&&(d&16|!(d%x))?--x&15:a).join``)[10]&&s

console.log(f('1234567890')('1234567890'))
console.log(f('1234567890?')('1234567890'))
console.log(f('123456789_')('1234567890'))
console.log(f('1234567890?')('123456789_'))
console.log(f('1234567890')('1234567890?'))
console.log(f('1234567890')('123456789_'))
console.log(f('123456789_')('1234567890?'))
console.log(f('1234567890?')('1234567890?'))
console.log(f('1234567890?')('1234567891?'))
console.log(f('123456789_')('123456789_'))
console.log(f('555CALLUS1')('5552255871'))
console.log(f('404_12?6039')('4041?1560_9'))
console.log(f('_GETREVENGE')('16?36?_2838_'))
console.log(f('1?691460_50')('16_14609?50'))
console.log(f('61?08977211')('612?897725?1'))
console.log(f('40?0INSTA__')('8?00_NSTI?LL'))
console.log(f('3985_534?10')('39?8?5053_10'))
console.log(f('7__7294?737')('7797299?_37'))
console.log(f('28?897_384?1')('_8?89763861'))
console.log(f('271168090_')('27116800?09'))
console.log(f('6802?148343')('67?01148343'))
console.log(f('94_11628?2?6?')('9491162_47?'))
console.log(f('17?4285_689')('1__26?52689'))
console.log(f('6_311?95_38')('6731194?7?38'))
console.log(f('380?7DRAGON')('3807378?5?66'))
console.log(f('4?647_93236')('5646?6?9__36'))
console.log(f('365?268898_')('366267?7?984'))
console.log(f('GRATEDBATE')('IRATEDBATE'))
console.log(f('5307_079?93')('____8_____'))
console.log(f('535_3_0255')('52?5_3_024?5'))
console.log(f('55_____088')('54?2397207?7?'))
console.log(f('6_48398_95')('_946?398?6_5?'))
console.log(f('_0_312_3_1')('81?53123?1?71'))
console.log(f('____1_____')('64?255?508?61'))
console.log(f('8427820607')('6?424?8?__6?07'))
console.log(f('50_3707__6')('52?8375?74?56'))
console.log(f('615___8255')('62?526?983?2?1?'))
console.log(f('__652618__')('8365261__0'))
console.log(f('149___933_')('1_9677?92?31'))
console.log(f('___7?281562')('3438?28154?2'))
console.log(f('5?7?7?___8?3?7?4')('57_855837_'))
console.log(f('605_272481')('605427__81'))
console.log(f('86?569__731')('88560?0?7721'))
console.log(f('1__91654?15')('17?9?9165715'))
console.log(f('800NWABODE')('80069ABI?DE'))
console.log(f('8___9017_0')('8_2494?12?9_'))
console.log(f('_024?5?91?470')('304?17908?7_'))
console.log(f('42510704_2')('4_51070492'))
console.log(f('9338737_89')('93_873PLUS'))
console.log(f('327762_401')('327_MASH01'))

1234567890? / 1234567890? should resolve to 1234567890. Right now your code outputs 123456789? which is even less informative than the input. Assume: 5? / 5?    -> 5  //uncertain, but matching

@Draco18s Contrary to what I stated, I included 51 test cases. So the first one was dropped and everything shifted by one row. (Now fixed. Sorry about that.)

Aaah. Still, it should output some kind of falsey or error value for those test-cases. But otherwise looks good.

Perl 5, 211 bytes
...without indentation and \n newlines

@i=map{y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/22233344455566677778889999/;$_}split' / ',shift;
print map{
  $_=join'',map{s,(\d\??|_),,;$1}@i;
  /((\d)\??\2\??|(\d)\??_|_(\d)\??|(\d)\d\?|\d\?(\d))$/;$2//$3//$4//$5//$6//'?'
}1..10

Try it online!

Looks like its returning "the best it can" (83652618?0) rather than some sort of falsey or error value.

Which is what the puzzle wanted if I'm not mistaken. Look at the cases under the heading "You can additionally assume the following judgement calls". Or not?

Sorry, never got a notification of your reply (no at-mention). The section I'd done for the judgement calls uses a ? to indicate that there is no way to resolve the missing information, which should then fall through to the Output section: ...Otherwise output some form of error indication (e.g. -1, false, or an empty line).

Retina, 150 140 136 bytes
 Saved a few bytes thanks to Kritixi Lithos
T`?L`#22233344455566677778889
./.

(?<=(\d)(\w#?){9}).#|.#(?=(\w#?){9}(\d)(?!#))
$1$4
#

_(?=.{9}(.))|(?<=(.).{9})_
$1$2
^(\d*)\1$|.*
$1

Try it Online!
Explanation:
The first line transforms all ? in the input into # and all letters into their numeric equivalents. We then remove the spaces and / from the input. The next two lines take care of "guess vs. certainty" cases (eg. 5? \ 4 would be replaced by 4 \ 4). After removing all #s, lines 8 and 9 deal with "number vs. _" cases (_ \  3 becomes 3 \ 3). Then, if both halves of the string match, we keep the first 10 digits. Otherwise, the phone number is invalid so we remove everything.
Alternative 160-byte solution that works for phone numbers of arbitrary length (and equal size): TIO

You can change the (/|_) to [/_] to save 1 byte. Also I think you can use ; instead of x so that [^x] can become \w

PHP, 251 236 bytes
for(;a&$c=preg_replace(["#[^_?](?!\?)#","#_#"],["$0k","?<"],join("-",$argv))[++$i];)${$k+="-"==$c}.=$c<_&$c>=A?0|(ord($c)-($c>W)-($c>P)-59)/3:$c;for(;$c=${1}[$k+1];)echo($n=${1}[$k])==($m=${2}[$k++])|($b=${2}[$k++])!=$c?$c>$b?$n:$m:"?";

takes input from command line; run with -nr or try it online.
breakdown
# A: transform input
                                    # 2. replace single chars with two-character chunk and make sortable:
                                    #   replace "_" with "?<", append "k" to everything else not followed by "?"
for(;a&$c=preg_replace(["#[^_?](?!\?)#","#_#"],["$0k","?<"],join("-",$argv))[++$i];)    # (unknown "<" < unsure "?" < certain "k")
${$k+="-"==$c}.=                # if "-", next argument
        $c<_&$c>=A              # if letter
            ?0|(ord($c)-($c>W)-($c>P)-59)/3 # then translate to digit
            :$c                             # else don´t
    ;
# B: evaluate
for(;$c=${1}[$k+1];)            # loop through arguments: $c=command 2
    echo
        ($n=${1}[$k])                   # $n=digit 2
        ==                          # if digits are equal
        ($m=${2}[$k++])                 # $m=digit 3
        |
        ($b=${2}[$k++])             # $b=command 3
        !=$c                        # or "commands" are not
            ?$c>$b?$n:$m            # then get the one with the more definitive "command"
            :"?"                    # else conflict/unknown
    ;

golfings

preg_replace first: -8 bytes
join: -2
$$k instead of $t[$k]: -5

PHP, 200+8 bytes
inspired by Arnaulds solution.
for($s=join($argv);$c=ord($s[$i++]);$i+=$x)$t[]=$c>90?63:15&($c<65?$c:($c-($c>80)-($c>87)-59)/3)|16*$x="?"==$s[$i];for(;$p++<10;)echo chr(($e=$t[$p]^$d=$t[$p+10])&48|!(15&$e)?min($t[$p],$d)&15|48:63);

takes input from command line arguments; run with -nr or try it online.
modifications to comply with the error output restriction: (print X for an incomplete number):

remove |48 (-3 bytes)
replace echo chr(...); with $r.=...;echo$r>1e10?X:$r; (+11 bytes)

breakdown
for($s=join($argv);$c=ord($s[$i++]);    # loop through characters of arguments
    $i+=$x)                             # skip "?"
$t[]=
    $c>90                               # if "_"
        ?63                             # then 32+16+15
        :                               # else
            15&(                            # lower 4 bits of
            $c<65                               # if digit
            ?$c                                 # then digit
            :($c-($c>80)-($c>87)-59)/3          # else letter mapped to digit
        )
        |16*$x="?"==$s[$i]                  # if next char is "?", add 16
;
for(;$p++<10;)echo chr( # loop through translated arguments
    (
        $e=$t[$p]^      # 2. $e=difference
        $d=$t[$p+10]    # 1. $d=char from 2nd argument
    )&48                # if certainties differ
    |!(15&$e)           #    or digits do not
    ?min($t[$p],$d)&15|48   # then pick the more definite digit (15|48 -> "?")
    :63             # else "?"
);

golfings

work around preg_replace_callback (-10 bytes)
rely on 10 digit input (-9)
and additional golfing (-8)
removed join delimiter (-7)
moved $x assignment to the end (-2)

Perl 5 -pl, 173 bytes
sub t{$_=pop;y/A-Z/22233344455566677778889999/;/_|\d\??/g}@e=m|\S+|g;@a=t$e[0];$_=join"",map{$_.=shift@a;s/^(.+)\1$/$1/||s/_//||s/..../_/||s/.\?//;$_}t$e[2];s/\?//;$_ x=!/_/

Try it online!


text:
Golf an unbeatable chopsticks bot
From Wikipedia:

Chopsticks is a hand game for two players, in which players extend a number of fingers from each hand and transfer those scores by taking turns to tap one hand against another.

In this challenge "splits" can only be 4->2+2 or 2->1+1.
Challenge
Your challenge is to make a bot (think the AI and framework of a chess program, but not chess) to play Chopsticks.
The game is as follows:

Both players (computer and player) start with 2 hands, and 1 finger raised on each hand. (aka the player and computer hands are both [1,1])
The players alternate turns. To move, the player taps one of his hands against the other person.  Let player 1's hands be [2,3] and player 2's hands be [3,4].  If player 1 taps his first hand against player 2's second (2 vs 4), then player 1's first hand is added to the total of player 2's second hand, modulo five (6 mod 5 = 1).
Another explanation: x is the hand player 1 uses to tap player 2, and y is the hand getting tapped (which belongs to player 2), y += fingers(x); y = y mod 5.

You cannot make a move with a hand that has 0.  However, if one of your hands is empty and the other one has 2 or 4 sticks, you can split that hand to make your hands [1,1] or [2,2] (this counts as a move, so you don't tap that turn)
If your hands are [0,0], you lose. Same with the other player.
Chopsticks is more or less a solved game1, meaning that neither player 1 nor player 2 can win if the other is a perfect player.  Your bot must be a perfect player. (aka it will keep going forever or until it wins, it will never lose)  This also means your program must loop indefinitely, it can't rely on recursion (just as an example).
Input and output can be in any acceptable way.
Examples
IO is the right column, odd rows are first player's moves, even rows are second player's moves. Left column is the fingers of the players at that point.
Your bot will always be the second player.
First Second  I/O

[1,1] [1,1]
              [1,2]
[1,1] [1,2]
              [2,2]
[1,3] [1,2]
              [2,1]
[1,3] [4,2]
              [1,1]
[0,3] [4,2]
              [2,2]
[0,3] [4,0]
              S
[0,3] [2,2]
              [2,2]
[0,3] [2,0]
              [1,2]
[0,0] [2,0]

Result: 0-1

Also, there are many variations of this game. For example, some variants have your hand empty if it's above or equal to 5, i.e. 2 vs 4 will give 0, instead of 1 (which is 2+4 mod 5). The rules listed here are the ones you will use however.
Good luck and happy golfing!

[1]: [citation-needed]. I found on the internet that the second player can always win if splits can be arbitrary but neither players have a winning strategy, but I don't know if I should be trusting random blogs. Games like Connect 4 game have a few papers on them, but I could find none on this game.

Do you know it is possible to play without losing? You can't ask something that may be impossible without this being closed as unclear or too broad.

@FryAmTheEggman on Wikipedia and other websites they mention that the first player can always force a win if the splitting rule includes transferring, but no websites show a way if transferring is banned. I didn't want to include transferring in this challenge because I thought it would be hard to I/O them.

You haven't answered whether what you have asked is known to be possible. As it stands, I have to say this is too broad. If you find out otherwise make sure you draw attention to your change.

I read this through a couple of times but still don't think I understand the rules of the game. Additionally, I'm not sure the "you have to be able to play as the first player or as the second player" clause adds to the challenge, and if you want to keep it, you'll have to explain how it works.

@ais523 does this make it more clear? I've tried to explain the rules better (I've played this game myself many times before). I did remove the clause, but I'll wait for betseg to review that.

The I/O in the example given is that of the human player, no? How does the I/O work?

@KritixiLithos the program takes the other player's move, then outputs its move, etc.

Is a function that takes the current state as arguments a valid answer?

If you have no proof that neither player should ever lose then why not just make the criteria that the bot must "play optimally" instead of being "one that never looses", that way the bot may loose if in a loosing position already.

I whipped up a minimax program to check this. Try it online! The state [1,1,1,1] is not listed, so should be neither a win or a loss.

@ØrjanJohansen Why don't you expand it to an answer?

@user202729 It was designed to be easy to write and run, not to be easy to golf or to give the information needed for solving the full problem. For example, it saves work by never distinguishing left hands from right ones, and doesn't say anything about what to do if you're in a non-winning, non-losing situation.

The sad part is I am a "perfect player" and I'm not sure what I do D:
Let's see how well this goes.

"This also means your program must loop indefinitely, it can't rely on recursion (just as an example)." What does this mean?  Anything that can be done with loops can be done with recursion.  Are answers that use recursion banned or something?  It doesn't appear related to the previous statement.

"Chopsticks is more or less a solved game¹, meaning that neither player 1 nor player 2 can win if the other is a perfect player." That's not what solved means. If a game is solved, that means all game states and outcomes are known; it doesn't imply anything about who can win.

From review queue: Voted to keep open. I think it's clear what the challenge is asking.