text:
Is this draw by repetition?
Problem:
In chess, there is a somewhat well known rule about draw by repetition. If the same position is repeated 3 times (or more) then the player intending to make the move which will cause the this repetition can claim a draw.
Sometimes this is an easy task for an arbiter to spot, if the last few moves are just the players moving backwards and forwards. Sometimes it is less trivial, when pieces have moved significantly between repeated positions.
The problem in this challenge is to output a truthy value if the claimed position is draw by repetition (has been seen 3 times or more) and a falsey value if the claimed position is not draw by repetition, given a list of moves in coordinate notation as described below, or any notation of your choosing (but you'll have to convert the test cases).

What is a position?
In a real world scenario, the position would be affected by things such as whether a player can castle or whether en-passant is possible; you should not consider these in your solution to the problem. In this problem a position is defined simply by the configuration of the pieces on the board. So, for the purposes of this problem, two positions are seen to be the same if each square on both boards is occupied by the same type of piece of the same colour. This does not have to be the exact piece for example white's knights could swap squares and if all other pieces fulfill the criteria this would still be the same position.

What does a valid notation look like?
Although I will go on to explain coordinate notation, you are free to take input by a notation system you choose. Provided that:

Each item in the notation describes any or all of: the piece/pieces involved; whether check, checkmate, double check, checkmate or stalemate have been delivered; if en-passant capture has occurred; the initial position; the final position.
You may not have information about repetition in your notation.

So as long as these criteria are met I am happy to accept, as long as you specify in your answer, your notation system. This could be e.g. 0 indexed row,column tuples or whatever makes sense for your program.

Coordinate Notation
Coordinate notation is a notation which describes purely the moves as a system of coordinates.
A move is described as first the initial coordinate from the set {A1-H8} and then the destination coordinate again from the same set. So the King's Gambit would look like (as a collection of strings)
{"E2-E4","E7-E5","F2-F4"}

I believe it's the best notation to use for this problem because it is not littered with extraneous information like whether check has occurred or what the type of piece moving is. As mentioned before the notation can be of your choice, so you could use another notation e.g. algebraic notation or you could adapt this notation (e.g. remove the dashes, or take as a list of tuples)

Rules:

You should not consider whether a position or move is valid, only whether it causes repetition
You can assume that castling and pawn promotion will not occur.
You should take a list of strings as input and output a truthy or falsey value corresponding to whether the third (or more) repetition has occurred on the final move
The game always starts at the standard starting position for chess. The initial position can count towards repetition.
Draw by repetition has not occurred if the position is not repeated by the final move

General rules:

This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code (i.e. TIO).
Also, adding an explanation for your answer is highly recommended.

Test Cases
You should return truthy values for:
{"B1-C3","B8-C6","C3-B1","C6-B8","B1-C3","B8-C6","C3-B1","C6-B8"}
{"B1-C3","B8-C6","C3-B1","C6-B8","B1-C3","B8-C6","C3-B1","C6-B8","B1-C3","B8-C6","C3-B1","C6-B8"}
{"B1-C3","B8-C6","D2-D4","D7-D5","D1-D3","D8-D6","C3-B1","C6-B8","B1-C3","B8-C6","D3-D1","D6-D8","D1-D3","D8-D6"}
{"D2-D4","B8-C6","E2-E4","C6-D4","D1-E2","D4-E6","E2-F3","E6-D4","F3-D1","D4-C6","D1-E2","C6-D4","E1-D1","D4-C6","D1-E1","C6-D4"}
{"B1-C3","B8-C6","C3-B1","C6-B8","B1-C3","B8-C6","C3-B1","C6-B8","B1-C3","B8-C6","C3-B1","C6-B8","B1-C3"}

And falsey values for:
{}
{"E2-E4","E7-E5","F2-F4"}
{"B1-C3","B8-C6","C3-B1","C6-B8","B1-C3","B8-C6","C3-B1","C6-B8","F2-F4","F7-F5"}
{"E2-E4","E7-E5","G1-F3","B8-C6","F1-C4","G8-F6","F3-G5","D7-D5","E4-D5","F6-D5","G5-F7"}
{"D2-D4","B8-C6","E2-E4","C6-D4","D1-E2","D4-C6","E2-D1","C6-D4","D1-E2","D4-C6","E2-D1"}
{"B1-C3","B8-C6","C3-B5","C6-B4","B5-D4","B4-D5","D4-C6","D5-C3","C6-B8","C3-B1","B8-C6","B1-C3","C6-B8","C3-B1"}
{"E2-E4","E7-E5","D1-E2","E8-E7","E1-D1","D8-E8","E2-E1","E7-D8","E1-E2","E8-E7","E2-E1","E7-E8"}

Can we take input as, say, a list of pairs of squares numbered in a row-major order, getting rid of chess entirely? How about a list of pairs of pairs of coordinates?

You won't be able to get rid of chess entirely, since the pieces themselves and capturing pieces are both still important. You can define your coordinate system however you like though. I'll clarify in the question what properties a valid set of inputs will have.

Are you sure the last two test cases are indeed falsey? There could be an error in my implementation of course, in which case I'll look for an error, but I come across a state 3 times in both last two falsey test cases. PS: You might want to explicitly mention that the initial state before beginning the match doesn't count towards the 3 times? EDIT: Ah wait, I think I completely miss-implemented the challenge.. The piece type in the occupied cells are important for a state as well I guess? I now have all cells as a toggle whether a piece is on it or not, instead of which piece is on it.. >.>

Can we assume pawn promotion has not occurred? And what is the input format for the initial position?

@someone yes I meant to put that in about no pawn promotion. Initial position is not inputted, you will have to store it

@KevinCruijssen I'll explicitly add that the initial state DOES count. I think you spotted that the pieces matter, so do the colour of the piece. The second last test case is where black and white's knights swap over. In the last one the queen and king swap around for both players

@ExpiredData Can you explain why the 3rd falsey case is falsey? After the last C6-B8 the initial position has occurred thrice.

Ah, it has to be the final position that appeared at least twice before.

@Adám from the Fide Laws of chess 9.2.1 The game is drawn, upon a correct claim by a player having the move, when the same position for at least the third time (not necessarily by a repetition of moves):
9.2.1.1 is about to appear, if he first writes his move, which cannot be changed, on his scoresheet and declares to the arbiter his intention to make this move, or
9.2.1.2 has just appeared, and the player claiming the draw has the move.
So it's when it's the last move on the scoresheet given to the arbiter...

APL (Dyalog Extended), 55 49 47 45 44 bytesSBCS
-4 thanks to ngn.
Full program. Prompts for reversed list of reversed coordinate pairs:
 e.g. {"B1-C3","B8-C6"} is [[[8,2],[6,3]],[[1,2],[3,3]]]
2≤≢s∩{0,∘⊃@⍺⊃s,←⊂⍵}/⎕,⊂(⊖⍪-)¯4↑⍉6,⍪5,∘⌽⍥⍳s←3

Try it online! (includes the utility function Coords which translates OP's format)
Set up a list of states:
s←3 assign three to s (for states)
Since 3 is not a valid board state, it will not affect our repetition count, and we need the pass-through value of the assignment…
Build a chess board representation:
5… discard that for the result of applying the following derived function between 5 and 3:
 ⍥⍳ extend both arguments to their ɩndices;
  [1,2,3,4,5]…[1,2,3]
 ,∘⌽ the left side concatenated with the reverse of the right side
  [1,2,3,4,5,3,2,1] this represent the officers
⍪ make into table;
 [[1],
  [2],
  [3],
  [4],
  [5],
  [3],
  [2],
  [1]]
6, prepend (to each row) a six, representing pawns;
 [[6,1],
  [6,2],
  [6,3],
  [6,4],
  [6,5],
  [6,3],
  [6,2],
  [6,1]]
⍉ transpose;
 [[6,6,6,6,6,6,6,6],
  [1,2,3,4,5,3,2,1]]
¯4↑ take negative (i.e. the last) four (rows), padding with zeros, representing empty squares;
 [[0,0,0,0,0,0,0,0],
  [0,0,0,0,0,0,0,0],
  [6,6,6,6,6,6,6,6],
  [1,2,3,4,5,3,2,1]]
(…) apply the following tacit function to that:
 - negate (this represents the opposite colour);
  [[ 0, 0, 0, 0, 0, 0, 0, 0],
   [ 0, 0, 0, 0, 0, 0, 0, 0],
   [-6,-6,-6,-6,-6,-6,-6,-6],
   [-1,-2,-3,-4,-5,-3,-2,-1]]
  ⊖⍪ stack the flipped argument on top of that, giving us the full board;
  [[ 1, 2, 3, 4, 5, 3, 2, 1],
   [ 6, 6, 6, 6, 6, 6, 6, 6],
   [ 0, 0, 0, 0, 0, 0, 0, 0],
   [ 0, 0, 0, 0, 0, 0, 0, 0],
   [ 0, 0, 0, 0, 0, 0, 0, 0],
   [ 0, 0, 0, 0, 0, 0, 0, 0],
   [-6,-6,-6,-6,-6,-6,-6,-6],
   [-1,-2,-3,-4,-5,-3,-2,-1]]
Construct a list of moves followed by the initial state:
⊂ enclose that (to treat it as a single unit)
⎕, prompt for the list of moves, and prepend that to the initial state
Reduce* by a function which appends the current state to the list and makes a move:
{…}/ reduce by the following anonymous lambda:
 ⍵ the right argument (the current state)
 ⊂ enclose it to treat it as a unit
 s,← in-place append it to the list of states
 ⊃ disclose it to use that state
 …@⍺ at the elements with the two coordinates that the left argument represents, put:
  0 a zero
  , followed
  ∘ by
  ⊃ the first value
this effectively "moves" the value at the first coordinate to the second coordinate, leaving behind a zero
Check if we have three or more of the final state:
s∩ the intersection of all states with that final one; the subset of states identical to it
≢ tally them up
2≤ check if there are two or more (i.e. three or more including the final state)

* APL is right-associative, so first the function is called with the initial state as right argument and the initial move as left argument, and then its result, the new state, becomes the new right argument with the second move as new left argument, etc. The final result is the

I'm pretty sure this can be shortened significantly by using scan \ instead of reduce /

save 2 bytes with this ugly hack: ⍳3⊣s←⍬ -> ⍳s←3. it works because 3 is not a valid board so it won't affect repetition detection

@ngn Ugh. Thanks. We're approaching Jelly.

(0,⊃)@ -> 0,∘⊃@

@ngn Done. Thanks.

R, 180 177 144 bytes
function(M,`+`=rep,l=c(1:5,3:1,6+8,0+16)){z=rev(Reduce(function(x,y){x[y[2:1]]=x[y]*1:0;x},M,c(l,-rev(l)),,T));sum(sapply(z,identical,el(z)))>2}

Try it online!
-3 bytes thanks to Giuseppe
-29 bytes thanks to Nick Kennedy's use of Reduce and -rev(l)
-4 bytes by reversing z
Takes as input a vector of integers between 1 and 64 denoting the squares. The TIO includes a function to transform into that format. The different pieces are stored as integers between 1 and 6 and between -1 and -6.
Explanation:
function(M,                                # M is the vector of moves
         `+` = rep,
         l = c(1:5, 3:1, 6 + 8, 0 + 16)) { # initial position of white pieces
  z = rev(Reduce(function(x, y) {
    x[y[2:1]] = x[y] * 1:0                 # a piece moves from y[1] to y[2]; y[1] becomes 0
    x
  }, M, c(l, -rev(l)), , T))
  sum(sapply(z, identical, el(z))) > 2    # find number of past positions identical to the last position
}

I’ve put a revised version of yours at [https://bit.ly/2OHPexp]. It’s ok TIO but the link is too long for a comment. The code is inspired by yours, but uses a cumulative Reduce at its core. It’s 148 bytes.

@NickKennedy Thanks! I was actually about to look into using negative integers for the black pieces; I'm glad you did it first. I like what you did with Reduce: I clearly need to learn more about this.

@NickKennedy I got a further 4 bytes off your version by reversing z.

Java 10, 336 330 287 285 282 276 bytes
m->{var V=new java.util.HashMap();int i=64,A[]=new int[i];var t="";for(;i-->0;)t+=A[i]=(i%56<8?i%8*35%41%10%8+2:9>>i/16&1)*(i/32*2-1);V.put(t,1);for(var a:m){for(t="",A[a[1]]=A[a[0]],A[a[0]]=0,i=64;i-->0;)t+=A[i];V.compute(t,(k,v)->v!=null?(int)v+1:1);}return(int)V.get(t)>2;}

-11 bytes thanks to @Arnauld by changing i%56<8?"ABCDECBA".charAt(i%56%7):i%48<16?1:0 to i%56<8?i%8*35%41%10%8+2:9>>i/16&1.
Input as a 2D array of integers where \$a1=0, b1=1, ..., h8=63\$ (i.e. {"E2-E4",... is [[12,28],...).
Try it online.
Explanation:
m->{                   // Method with 3D character array parameter and boolean return-type
  var V=new java.util.HashMap();
                       //  Create a Map to store the occurrences of the board-states
  int i=64,            //  Index integer, starting at 64
      A[]=new int[i];  //  Create the 8 by 8 board
  var t="";            //  Temp-String, starting empty
  for(;i-->0;)         //  Loop `i` in the range (64,0]:
    t+=                //    Append the string `t` with:
      A[i]=            //     Fill the `i`'th cell with:
        i%56<8?        //      If it's either the first or eighth row:
         i%8*35%41%10%8+2
                       //       Fill it with 2,7,3,5,9,3,7,2 based on index `i`
        :9>>i/16&1)    //      Else if it's either the second or seventh row:
                       //       Fill it with 1
                       //      Else (the third, fourth, fifth, or sixth rows):
                       //       Fill it with 0
        *(i/32*2-1);   //      Then multiply it by -1 or 1 depending on whether `i`
                       //      is below 32 or not
  V.put(t,1);          //  Then set string `t` in the map to 1 for the initial state
  for(var a:m){        //  Loop over each of the input's integer-pairs:
    for(t="",          //   Make the String empty again
        A[a[1]]=       //   Set the to-cell of the current integer-pair of the input to:
          A[a[0]],     //    The value in the from-cell of the same integer-pair
        A[a[0]]=0,     //   And then empty this from-cell
        i=65;i-->0;)   //   Inner loop `i` in the range (64,0]:
          t+=A[i];     //    Append the `i`'th value to the String `t`
    V.compute(t,(k,v)->v!=null?(int)v+1:1);}
                       //   Increase the value in the map for String `t` as key by 1
  return(int)V.get(t)  //  Return whether the value in the map for the last String `t`
          >2;}         //  is at least 3

The values of the pieces after filling them with A[i]=(i%56<8?i%8*35%41%10%8+2:9>>i/16&1)*(i/32*2-1) are:
     a  b  c  d  e  f  g  h
  +------------------------
1 | -2 -7 -3 -5 -9 -3 -7 -2
2 | -1 -1 -1 -1 -1 -1 -1 -1
3 |  0  0  0  0  0  0  0  0
4 |  0  0  0  0  0  0  0  0
5 |  0  0  0  0  0  0  0  0
6 |  0  0  0  0  0  0  0  0
7 |  1  1  1  1  1  1  1  1
8 |  2  7  3  5  9  3  7  2

Try it online.

Wrestled for a while with a way to avoid using t, is there no structure you can use to store state which will do something like java.util.Arrays.deepHashCode? If so there's loads of bytes to spare

Also, I wonder if this is technically correct based on the implementation of hashmap, there's probably going to be hash collisions for chess boards given that the possible configurations is huge? I'm not going to give you a counterexample for that though!

@ExpiredData There indeed is a java.util.Arrays.deepHashCode(A), but apparently some of the hashes are still the same somehow (i.e. last test case has -447346111=3 in the map..) if I compare the resulting map of my current answer and the resulting map using deepHashCode(A). Also, it would be 3 bytes longer instead of shorter, since I have to use deepHashCode(A) twice (for the initial state as well).

Are you sure this is correct? When you fill up the board, there is no distinction between a bishop, knight, rook, queen, or king

@EmbodimentofIgnorance Yes there is a distinction. The board is initially: [[8,9,10,11,12,13,14,15],[16,17,18,19,20,21,22,23],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[56,57,58,59,60,61,62,63],[64,65,66,67,68,69,70,71]], so all pieces have an unique value. This board is created with A[i][j]=i%6<2?-~i*8+j:0;.

But the first black rook is different from the second black rook. two positions are seen to be the same if each square on both boards is occupied by the same type of piece of the same colour

@EmbodimentofIgnorance Ah shit, you're right.. Forgot about the obvious duplicated pieces.. Will delete for now and try to fix this tomorrow morning, but you're indeed completely right!

@EmbodimentofIgnorance Should be fixed now.

Not fully tested in Java, but the expression i%8*35%41%10%8+2 should be a possible replacement for "ABCDECBA".charAt(i%8), saving 6 bytes. It generates the pattern [ 2, 7, 3, 5, 9, 3, 7, 2 ].

@Arnauld Very nice! I initially had the idea to use modulos somehow to make a pattern A,B,C,D,E,C,B,A, but gave up pretty quickly and used the "ABCDECBA".charAt approach instead.. ;) PS: You can test it in Java at the TIO at the bottom of my post. :)

JavaScript (Node.js),  121  111 bytes
Expects the moves in [sq0, sq1] format, where each square is in \$[0..63]\$ with \$\text{a8}=0\$, \$\text{b8}=1\$, ..., \$\text{h1}=63\$.
Returns a Boolean value.
a=>[a,...a].map(([x,y])=>r=b[b[b[y]=b[x],x]=0,b]=-~b[b],b=[...'89ABCA981111111'+10n**32n+0x7e5196ee74377])&&r>2

Try it online!
How?
Pieces
The values used to identify the pieces do not really matter as long as there's one unique value per piece type.
We use:

0 for empty squares
1 / 8 / 9 / A / B / C for ♟ / ♜ / ♞ / ♝ / ♛ / ♚
2 / 3 / 4 / 5 / 6 / 7 for ♙ / ♖ / ♘ / ♗ / ♕ / ♔

Board and initial position
The board is stored in the array \$b\$ which is initialized by splitting the concatenation of the following parts:

'89ABCA981111111' → the 8 black major pieces, followed by the first 7 black pawns
10n**32n → the last black pawn on \$\text{h7}\$ (\$1\$) followed by 32 empty squares (\$0\$)
0x7e5196ee74377 → all white pieces (expends to 2222222234567543 in decimal)

which results in:
    a b c d e f g h
  +----------------
8 | 8 9 A B C A 9 8
7 | 1 1 1 1 1 1 1 1
6 | 0 0 0 0 0 0 0 0
5 | 0 0 0 0 0 0 0 0
4 | 0 0 0 0 0 0 0 0
3 | 0 0 0 0 0 0 0 0
2 | 2 2 2 2 2 2 2 2
1 | 3 4 5 6 7 5 4 3

Keeping track of the positions
The variable \$b\$ is also used as an object to keep track of all encountered positions. The key for each position is \$b\$ itself, but this time as an array and implicitly coerced to a string.
This is why we do:
b[b] = -~b[b]

Commented
a =>                    // a[] = input
  [ a,                  // dummy entry to mark the initial position as encountered once
    ...a                // append the actual data
  ].map(([x, y]) =>     // for each pair of squares [x, y] in this array:
    r =                 //   store the last result in r
    b[                  //   update b[b]:
      b[                //     update b[x]:
        b[y] = b[x],    //       set b[y] to b[x]
        x               //       set b[x] ...
      ] = 0,            //     ... to 0
      b                 //     set b[b] ...
    ] = -~b[b],         //   ... to b[b] + 1 (or 1 if b[b] is undefined)
    b = [...(…)]        //   initialize b[] (see above)
  )                     // end of map()
  && r > 2              // return true if the last result is greater than 2

I didn't write a test case for it yet, but does this work if the 2 pieces of the same colour swap over (e.g. repetition where two white knights are swapped)? I'll write a test case when I get a chance.

Yes I mean that, I'll update when I can

@ExpiredData This should now work as expected.

Jelly, 41 37 bytes
Ø0;6x8;“Ġ²F’D¤UN;ƊW;µị@⁹Ṫ¤¦0⁹¦$\ċṪ$>1

Try it online!
A monadic link that takes the input as a list of pairs of 1-indexed row-major moves [from, to] and returns a 1 for draws and 0 for not.
Note the footer code on TIO translates the moves as supplied by the OP to the numeric format, but per the discussion below the question, the numeric format would have been a valid input.
Explanation
Ø0                                    | 0,0
  ;6                                  | concatenate to 6 (pawn)
    x8                                | repeat each 8 times (two blank rows and 1 row of pawns)
      ;“Ġ²F’D¤                        | concatenate to 1,2,3,4,5,3,2,1
              UN;Ɗ                    | concatenate a negated flipped version to this one
                  W;                  | wrap as a list and concatenate the input list to the board
                    µ                 | start a new monadic chain
                              $\      | reduce using the two links below
                     ị@⁹Ṫ¤¦           | replace the item pointed to by the second coordinate by the value of the one at the first
                           0⁹¦        | replace the item at first coordinate with zero
                                ċṪ$   | finally count the items equal to the final one (not including it)
                                   >1 | and check of >1

C# (Visual C# Interactive Compiler), 204 bytes
n=>{var j=new List<char[]>();var d=("ABCDECBATTTTTTTT"+new string('Z',32)+7777777712345321).ToArray();foreach(var(a,b)in n){j.Add(d.ToArray());d[b]=d[a];d[a]='Z';}return j.Count(r=>r.SequenceEqual(d))>1;}

Takes input as a list of tuples of integers, where the first integer is where to move from, and the second is where to move to. 0 represents A1, 1 is A2, and 63 is H8.
Try it online!
n=>{
  var j=new List<char[]>();    //Initialize a list to save states of a board
  var d=("ABCDECBATTTTTTTT" +  //White pieces
  new string('Z',32) +         //Empty spaces
  7777777712345321)            //Black pieces
  .ToArray(); //Initialize the chessboard
  foreach(var(a,b)in n){       //Foreach (source square, destination square) in the input
    j.Add(d.ToArray());        //  Add the current board to the list
    d[b]=d[a];                 //  Set the destination square to the source square's value
    d[a]='Z';                  //  And set the souce square to empty
  }
  return j.Count(         //Return that the amount...
    r=>r.SequenceEqual(d) //  of past positions that are equal to the current position...
  )>1;                    //is at least two
}

Charcoal, 62 bytes
≔↨²³⁴⁵⁶⁴³²χηＦ⁴⁸⊞η÷⁻⁴⁰ι³²Ｆ…η⁸⊞η±ιＦθ«⊞υ⮌η§≔η⊟ι§η§ι⁰§≔η⊟ι⁰»›№υ⮌η¹

Try it online! Link is to verbose version of code. Takes input as an array of pairs of numbers where the squares are numbered A1, B1, ... H8 (0-indexed) so for instance the first test case would be represented as [[[1, 18], [57, 42], [18, 1], [42, 57], [1, 18], [57, 42], [18, 1], [42, 57]]] and outputs a - if the position is a draw by repetition. Conversion program. All in one. Explanation:
≔↨²³⁴⁵⁶⁴³²χη

Split the number 23456432 into individual digits. These represent the white pieces.
Ｆ⁴⁸⊞η÷⁻⁴⁰ι³²

Add in the pawns and the empty rows. The white pawns have value 1 and the black pawns -1.
Ｆ…η⁸⊞η±ι

Append a negated copy of the white pieces, which represent the black pieces.
Ｆθ«

Loop over the moves.
⊞υ⮌η

Save a copy of the board. (Reversing is the golfiest way to copy the board.)
§≔η⊟ι§η§ι⁰

Update the destination with the source piece.
§≔η⊟ι⁰

Remove the source piece.
»›№υ⮌η¹

Determine whether the current position was seen more than once before.

Java (JDK), 246 245 244 bytes
import java.util.*;n->{var j=new ArrayList<char[]>();var d=("ABCDECBATTTTTTTT"+"".repeat(32)+7777777712345321l).toCharArray();for(var k:n){j.add(d.clone());d[k[1]]=d[k[0]];d[k[0]]=1;}return j.stream().filter(x->Arrays.equals(d,x)).count()>1;}

Try it online!
import java.util.*;                   //Import the java.util package

n->{                                  //Function taking in int[][],
                                      //where each int[] is a a pair of numbers
  var j = new ArrayList<char[]>();    //List to save each position of the chessboard
  var d =                             //The chessboard's starting position
    ("ABCDECBATTTTTTTT" +             //  All the white pieces
    "&#1".repeat(32) +                //  Plus the empty squares
    7777777712345321l)                //  And the black pieces
  .toCharArray();                     //Split to array of chars
  for(var k:n){                       //Foreach [sourceSquare, destinationSquare] in input
    j.add(d.clone());                 //  Add the current position to the list
    d[ k[1] ] = d[ k[0] ];            //  Set the destination square's value
                                      //  to the source squares
    d[ k[0] ] = 1;                    //  And clear the source square
}                                     //End foreach
return j.stream()                     //Convert list of states to stream
  .filter(x ->                        //Filter each position by
    Arrays.equals(d,x)                //  if the position equals the final position
  ).count() > 1;                      //And return if there are at least two
                                      //positions that are left
}


text:
Rotate ASCII Art by 45 Degrees
Your task is to take an ASCII art image and output it rotated clockwise by 45 degrees and scaled by a factor of \$\sqrt 2\$. The scaling comes from using a lattice pattern which introduces space between the characters.
To explain it visually, a \$3 \times 3\$ block would be processed like so:
123
456
789

becomes
  1
 4 2
7 5 3
 8 6
  9

Characters will not be transformed, so boxes will look strange after rotation:
+-+
| |
+-+

becomes
  +
 | -
+   +
 - |
  +

To explain the process more explicitly, the output consists of a diamond lattice pattern where the top row corresponds to the top-left character of the input, the next row corresponds with the right and below neighbors, next row is those neighbors, and so forth until all of the characters have been placed on the lattice.
Examples
           FISHKISSFISHKIS
       SFISHKISSFISHKISSFISH            F
    ISHK   ISSFISHKISSFISHKISS         FI
  SHKISS   FISHKISSFISHKISSFISS       FIS
HKISSFISHKISSFISHKISSFISHKISSFISH    KISS
  FISHKISSFISHKISSFISHKISSFISHKISS  FISHK
      SSFISHKISSFISHKISSFISHKISSFISHKISSF
  ISHKISSFISHKISSFISHKISSFISHKISSF  ISHKI
SSFISHKISSFISHKISSFISHKISSFISHKIS    SFIS
  HKISSFISHKISSFISHKISSFISHKISS       FIS
    HKISSFISHKISSFISHKISSFISHK         IS
       SFISHKISSFISHKISSFISH            K
         ISSFISHKISSFISHK

Source
Becomes
     H
      K S
       I H I
      F S K S
 S     I S I H S
  S I   S F S K F
   F S   H I S   I
  H I H   K S     S F
   K S K S I H     H I
    I H I S S K   I K S
   H S K S F S I F S I H
    K S I S I F S I S S K
     I F S F S I S S F S I
      S I S I H S F H I F S
     S S S F S K H I K S I S
      F F H I H I K S I H S F
       I I K S K S I H S K H I
      I S S I H I S S K S I K S
       S H H S K S F S I F S I H
        S K K S I S I F S I S S K
         F I I F S F S I S S F S I
          I S S I S I H S F H I F S
           S S S S F S K H I K S I
            H F F H I H I K S I H S
             K I I K S K S I H S K H
              I S S I H I S S K S I
               S H H S K S F S I F S
                S K K S I S I F S I S
                 F I I F S F S I S S
                  I S S I S I H S F S
                   S S S S F S K H I
                    H F F H I H I K S
                     K I I K S K S I H
                        S S I H I S S
                         H H S K S F S
                            K S I S I
                                 S F S
                                      H F K F F F
                                       K I I I I
                                      I I S S S
                                       S S H S
                                      S H S K
                                       F K F
                                      F I I
                                       I S
                                      I S
                                       S
                                      K

      _,,ddF"""Ybb,,_
    ,d@#@#@#@g,   `"Yb,
  ,d#@#V``V@#@#b      "b,
 d@#@#I    I@#@8        "b
d@#@#@#A..A@#@#P         `b
8#@#@#@#@#@#@8"           8
8@#@#@#@#@#@J             8
8#@#@#@#@#P               8
Y@#@#@#@#P    ,db,       ,P
 Y@#@#@#@)    @DWB      aP
  "Y#@#@#b    `69'    aP"
    "Y@#@#g,,     _,dP"
      `""YBBgggddP""'

Source
Becomes
     d d ,
    8 @ @ d ,
   8 # # # # d _
  8 @ @ @ @ @ @ ,
 Y # # # # # # # ,
  @ @ @ @ @ I V @ d
 Y # # # # #   ` # d
  @ @ @ @ @ A   ` @ F
 " # # # # # .   V # "
  Y @ @ @ @ @ .   @ @ "
   # # # # # # A I # g "
  " @ @ @ @ @ @ @ @ @ , Y
   Y # # # # # # # # #   b
    @ @ @ P P @ @ @ @ b   b
   ` # # )     J 8 # 8     ,
    " @ b         " P     ` ,
     " #                   " _
      Y g                   Y
       B ,     ,             b
        B ,   @ d             ,
         g   ` D b           "
          g   6 W ,           b
           g   9 B             ,
            d   '             "
             d                 b
              P _             `
               " ,             b
                " d           8
                 ' P a       8
                    " P a , 8
                       " P P

                             ...,?77??!~~~~!???77?<~....
                        ..?7`                           `7!..
                    .,=`          ..~7^`   I                  ?1.
       ........  ..^            ?`  ..?7!1 .               ...??7
      .        .7`        .,777.. .I.    . .!          .,7!
      ..     .?         .^      .l   ?i. . .`       .,^
       b    .!        .= .?7???7~.     .>r .      .=
       .,.?4         , .^         1        `     4...
        J   ^         ,            5       `         ?<.
       .%.7;         .`     .,     .;                   .=.
       .+^ .,       .%      MML     F       .,             ?,
        P   ,,      J      .MMN     F        6               4.
        l    d,    ,       .MMM!   .t        ..               ,,
        ,    JMa..`         MMM`   .         .!                .;
         r   .M#            .M#   .%  .      .~                 .,
       dMMMNJ..!                 .P7!  .>    .         .         ,,
       .WMMMMMm  ?^..       ..,?! ..    ..   ,  Z7`        `?^..  ,,
          ?THB3       ?77?!        .Yr  .   .!   ?,              ?^C
            ?,                   .,^.` .%  .^      5.
              7,          .....?7     .^  ,`        ?.
                `<.                 .= .`'           1
                ....dn... ... ...,7..J=!7,           .,
             ..=     G.,7  ..,o..  .?    J.           F
           .J.  .^ ,,,t  ,^        ?^.  .^  `?~.      F
          r %J. $    5r J             ,r.1      .=.  .%
          r .77=?4.    ``,     l ., 1  .. <.       4.,
          .$..    .X..   .n..  ., J. r .`  J.       `'
        .?`  .5        `` .%   .% .' L.'    t
        ,. ..1JL          .,   J .$.?`      .
                1.          .=` ` .J7??7<.. .;
                 JS..    ..^      L        7.:
                   `> ..       J.  4.
                    +   r `t   r ~=..G.
                    =   $  ,.  J
                    2   r   t  .;
              .,7!  r   t`7~..  j..
              j   7~L...$=.?7r   r ;?1.
               8.      .=    j ..,^   ..
              r        G              .
            .,7,        j,           .>=.
         .J??,  `T....... %             ..
      ..^     <.  ~.    ,.             .D
    .?`        1   L     .7.........?Ti..l
   ,`           L  .    .%    .`!       `j,
 .^             .  ..   .`   .^  .?7!?7+. 1
.`              .  .`..`7.  .^  ,`      .i.;
.7<..........~<<3?7!`    4. r  `          G%
                          J.` .!           %
                            JiJ           .`
                              .1.         J
                                 ?1.     .'
                                     7<..%

Source
Becomes
                                                      . .
                                                     .   .
                                                      .   .
                                                     b     .
                                                    .       .
                                                     ,       .
                                                  . J .       .
                                                 . %   ?       .
                                                  + .   4 . .
                                                 P ^ 7     ! ? .
                                                l     ; ^       7 .
                                               ,     .           ` .
                                            d         ,             ^ .
                                           . M r     ,                 ,
                                            W M       ,                 =
                                             M M     d                   ` .
                                              M N   J ,                     .
                                             ? M J . M                       ?
                                              T M . M a           , .         7
                                               H M . # .             = .       ` .
                                              ? B m !   .     . . , .   ^ .       .
                                               , 3       ` , J % `   ^ .   ,       .
                                                                        ?   7       ,
                                               7     ?                   7   7       ?
                                      r .       ,     ^                   ?   7       7
                                 .   r   J .           .                   ?   . ?     7
                                , ? .   % . .   `       .                   ?   . ` .   ?
                                 . ` $ . J   = . <                     .     7 .     .   ?
                                      . 7 .     . .                 . M ,     ~ l .   ~   !
                                   .   . 7   .   .       ?         . M M       .   I . 7   ~
                                    . .   = $ ^   .       7         M M L           . . ^   ~
                                     1 5   ?       d       7       M M N       1       ? `   ~
                                      J     4   ,   n       ?     . M M             ?   7     ~
                                       L     .   , G .       !     M M !       5     i   !     !
                                            .     , . .         .   # `       .       .   1     ?
       . .                             1     X   5 t , .   .     .             ;     .   .   I   ?
      . ` ^ , .                         .     .   r   7     .     ,           F       > .   .     ?
       7     ` ? .                     J       .         .   .     ?       . F         r   .       7
        <       ` .                     S         ` J ,   .   .     ! . . . t             . !       7
         .         ^ .         .         .         `   ^ . .   .       P %               . `         ?
          .           J       j ,       ` .     `   ,     .     ?     . 7               `             <
           .           ? .       7       >       ` .       , .   7 .   . !             `               ~
            .           ? , r 8   !     +           n       o .     , .     .                           .
             .           , 7   .       =   .       . .       . .     ^ Y                                 .
              .             ,     7   2     .     . % .       . ,     . r   .         .                   .
               .         <         ~ r         .   ,             7     `     >         ,                   .
                .         . `       L       r   .         l       . .       .         6       4 .
                 .       1   T       .     $     ^ .     .       . . = . . . .       .         . = .       `
                  .           .       .   r   `     =   . , .   ? ? J   ^ %         . .         .   ,       7
                   ~     L   ~ .       . t     t     ` J %   ,   ^   = .           . !           .   ^ .     !
                    <   .     . .     . $ `   ,             J     .   ! `         . ~                   ,     .
                     < .     L   .   G = = 7   .       ` . . . 1       7 ' , . . ,               ?       7     .
                      3     .     .       . ~ t     J     $ '     ,     ,   ` ^ !                 <       ! .
                       ?   .       . j     ? .     r .   . .   r   r . J                           .         .
                        7 . .       . ,     7 .   J     L J ? L   . . ^ .           Z                         . ?
                         ! `       ,         r   .   ~     7 ` . . . 1               7             .           ? 1
                          ` .       . %     j     ;   = 4   ?   ' `                 ? `             =           ? .
                             .   . .             j     . .   ?       <   `           ,               .           7
                              ` . % 7         .   .     .     7       .   ?
                               7 `   .         . r .     G     <     J     ~         5               ?
                                .     .         ,         .     .     .     .         .     .         ,
                               4       .         ^ ;             .   t               ?
                                .       .           ?               .       .         .               4
                               J   . . . .           1           7 .         =       1                 .
                                . r ^ ^ ` .           .           . ;         .     .                 ,
                                 `       ! .         .             :                 ,         `       ,
                                J           .     . . .                       4     F           ?     .
                                 i . ` , .   .     >                           . . F             ^     ;
                                  J !   ` ?   ?     =                         ` , %               .   .
                                 .         7   T     .                         '                   .   ,
                                  1         !   i . .                                                 ,
                                   .         ?   . D .                                                 ,
                                              7   .                                                 ? ,
                                   ?           + ` l                                                 ^ ,
                                    1           . j                                                   C
                                     .         .   ,
                                                i 1
                                                 .
                                      7         G ;
                                       <         %
                                        .     . %
                                         . . J `
                                          % '

Rules and Notes

Input and output may be in any convenient format and character encoding as long as it supports all printable ASCII characters (U+0020 - U+007E, LF)
You may assume the input contains only printable ASCII characters (defined above)
You must support art up to \$100 \times 100\$ characters.
You may assume the input is right-padded, as to be a perfect rectangular grid of characters.

If it conveniences you, you may also assume the input is padded to be exactly \$100 \times 100\$ characters.

Use the ASCII space to align and space characters.
Characters may be overpadded (or even underpadded) in any direction as long as the result is properly aligned.

Happy Golfing!

Poor Sonic, he just wanted to live D:

you may want to use full-width characters so that after rotating it's still has a quite square shape Display characters on a square grid?, Converting full-width characters to half-width characters (perl, regex, Japanese)

Possible dupe?

@Shaggy I'd say just related, but yeah, that bears a lot of similarities for sure. The only substantial difference is this challenge requires space padding in the output. In other news, you are impressively good at finding dupes.

If that were true, I'd've found that challenge while this one was still in the Sanbox! I stumbled across it completely by accident while searching for a dupe of a challenge idea I had and instantly remembered yours.

Charcoal, 2 bytes
↘Ａ

Try it online! Link is to verbose version of code. Takes input as either a single newline-delimited string literal or as an array of strings. Explanation: Ａ reads the input and ↘ outputs it in the desired diagonal direction. Version which accepts a blank-line terminated list of lines from STDIN:
ＷＳ⊞υι↘υ

Try it online! Link is to verbose version of code.

Wow. The right tool for the job.

Wow! I wish I knew Cahrcoal existed before. Is there any docs or tutorial on Charcoal, by the way?

@NaderGhanbari Only what's in the wiki: https://github.com/somebody1234/Charcoal/wiki

Canvas, 6 bytes
／⤢ ＊＼⤢

Try it here!
/        pad each line with one less space than the previous
 ⤢       transpose the object
   *     place a space between every character
    \    pad each line with one more space than the previous
     ⤢   transpose the object back

Example:
123
456
789
/:
  123
 456
789
⤢:
  7
 48
159
26
3
 *:
    7
  4 8
1 5 9
2 6
3
\:
    7
   4 8
  1 5 9
   2 6
    3
⤢:

  1
 4 2
7 5 3
 8 6
  9

Are your code and explanation not using differing slashes?

@Adám I usually ASCII-fy the explanations for them to align better

Python 3.8 (pre-release), 104 bytes
lambda a:[" "*abs(l+~i)+" ".join(a[i-j][j]for j in range(i+1)if j<l>i-j)for i in range((l:=len(a))*2-1)]

Try it online!
-5 bytes thanks to ovs (Python 3.8 things)

5 bytes shorter in Python 3.8

@ovs wait 3.8 is out? :o inline assignment. i like this. thanks!

J, 56 45 bytes
-11 bytes thanks to FrownyFrog!
-@}:@(i.@-@#,#\@{.)|."_1+/@${."1|.@,@,.&' '/.

Try it online!

here's 45

@FrownyFrog Thank you! Brilliant as always!

05AB1E, 18 12 bytes
RāRú€Sζðýāú»

Port of @dzaima's Canvas answer, so make sure to upvote him!!
Input as a list of lines.
Try it online.
Explanation:
R             # Reverse the (implicit) input-list
 ā            # Push a list in the range [1, length of input-list],
              # without popping the list itself
  R           # Reverse this list to [length, 1]
   ú          # Pad the reversed input-list with that many leading spaces
    €S        # Split each string on spaces
      ζ       # Zip/transpose; swapping rows/columns, with space default as filler
       ðý     # Join each inner character-list by spaces
         ā    # Push a list in the range [1, length of this string-list],
              # without popping the list itself
          ú   # Pad the list of strings with that many leading spaces
           »  # Join the string-list by newlines (and output the result implicitly)

Original 18 17 bytes answer:
€g2.ýIεNFR]JŽE5SΛ

Input as a list of lines.
Try it online.
Explanation:
€g     # Get the length of each line of the (implicit) input
       # (assumes they are all padded with spaces to make them of equal length)
  2.ý  # Intersperse this list with 2 (i.e. [3,3,3] becomes [3,2,3,2,3])
Iε     # Map the strings in the input to:
  NF   #  Loop the 0-based index amount of times:
    R  #   And reverse the current string that many times
 ]J    # After the loop and map: join the strings to a single string
ŽE5S   # Push compressed integer 3575, converted to a list of digits: [3,5,7,5]
Λ      # Use the canvas with these three options (which is output immediately by default)

See this 05AB1E tip of mine (section How to compress large integers?) to understand why ŽE5 is 3575.
Some more info about the 05AB1E Canvas builtin can be found in this tip of mine.
The Canvas builtin takes three parameters:

\$a\$ Length: The size(s) of the line(s). This can be a single integer, or a list of integers
\$b\$ String: The character(s) we want to display. This can be a single character, a string, a list of characters, or a list of strings (in the last three cases it will use all of them one-by-one including wrap-around)
\$c\$ Direction: The direction the character-lines should be drawn in. In general we have the digits [0,7] for the directions, for which we can use one or multiple. There are also some special options that require a certain character (+, ×, 8).

In this challenge I use the following options:
\$c\$: Let's start with the directions. For this I use \$[3,5,7,5]\$ which translates to \$[↘,↙,↖↙]\$. This means the string is printed in the following matter:
     S
      ↘
   ↙↖   ↘
   ↘   ↖  ↘
↙↖   ↘   ↖↙
↘  ↖   ↘
  .  ↖ ↙
    .

\$b\$: Since we print in this direction, this means the list of strings we input has to be modified slightly, which is what we do with the reverse on each 0-based odd-indexed string in the list.
\$a\$: Finally, the lengths of how it is printed. This will be the length of each lines for the directions \$3\$ (\$↘\$) and \$7\$ (\$↖\$). The \$2\$ for the directions \$5\$ (\$↙\$), which means to print one character (with a character overlap of the trailing part of the previous line) in a south-west direction, and then we print the next line (with again one character overlap, hence the use of \$2\$ instead of \$1\$). This overlapping is better explained in the tip I linked earlier.

I wonder what that arrow diagram would do in Ziim.

@Razetime Hehe, probably not much, since Zim programs are usually pretty big. Pretty interesting language.

Wolfram Language (Mathematica), 79 bytes
SparseArray[100+{#2+#,#2-#}&@@#&/@Range@100~Tuples~2->Flatten@#,{301,301}," "]&

Try it online!
The input should be padded as exactly 100x100. The output is an array of 301x301. The result of rotating sonic (with proper formatting):

Jelly, 26 bytes
JU’;ZJ$x@€⁶ðżµUŒDUṙLN‘ƊṚK€

Try it online!

Jelly, 19 bytes
ỴṚµLḶṚŒḄ⁶ẋżŒDṙLK€ƲY

Try it online!

JavaScript (ES6), 102 bytes
f=
s=>(z=[...Array(100)],o=z.map(v=>z.map(_=>" ")),s.map((r,y)=>r.map((c,x)=>o[y+x][s.length+~y+x]=c)),o)

Try it online!
Input and output as list of lists.
Explanation:
Creates a 100x100 grid of spaces. Then loops through the input, setting the appropriate entry in the grid. The index of the character to set is calculated as x' = length of input - 1 + y + x and y' = y + x.
The returned result is a 100x100 list of lists, with the output in the upper left corner.

Ruby, 94 bytes
->l{w=(2..y=l.size+b=l[z=0].size).map{' '*y};l.map{|r|b.times{|x|w[x+z][b+~z+x]=r[x]};z+=1};w}

Try it online!

C# (Visual C# Interactive Compiler), 153 bytes
z=>{var m=new char[100,100];var s=z.Split('\n');var l=s[0].Length;for(int x=0;x<l-1;x++)for(int y=0;y<s.GetLength(0);y++)m[x+y,l+~y+x]=s[y][x];return m;}

Try it online!
Asks for a string and returns a 2D char 100 x 100 array.
I tried using LINQ/Collections, but I eventually give up.

source: Stack Exchange

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

sort: votes


text:
ssTTsSTtRrriinInnnnNNNIiinngg
Challenge
For each character of the string except for the last one, do the following:

Output the current character.
Followed by randomly outputting from the following list a random number of times between 1 - 5 (inclusive):

The current character
The next character of the string
The switchcase version of the character that you are currently on
The switchcase version of the next character of the string.

Test Cases
String --> SSSTSStrTrIiinIIngn
, . , . , . Hello world! --> ,,,  ..    , ,,    ....    , ,   .. .. .   HHH HHEeelLlLllooO   wwOworOOrrrRllDd!!D
Programming Puzzles and Code Golf --> PrPPrRrOooooogggRgGraAraaaMMMmmmimMIiininGGgG  PPPPuZzZZzZzzZzllLLEEeEsEsssS  a aANnNddD C  COCoooOOdeDe   E GGGoOllFFf
Notes

You only need to apply the switchcase version of a character if the character is part of the alphabet (A-Z and a-z).
Your random function does not need to be uniform but it still needs to have a chance of returning any element in the list given.
You are allowed to use any standard I/O format.
You may assume that the length of the input is greater than or equal to two.
You may assume that the input only consists of ASCII characters.
The title is not a test case (it is unintentional if it is a valid test case).
Switchcase means to turn the char to lowercase if it is uppercase and to turn it to uppercase if it is lowercase.

In addition to '... does not need to be uniform', I think you probably want to specify that given some input, all finite legal outputs should in principle be possible to generate (otherwise, my non-uniform random integer in [1,2,3,4,5] is always going to be 2, and I'll just output the original string).

@ChasBrown Yeah, I'll edit the question

What options do we have as source of randomness, can we use the input string?

I find the specification confusing. Can you be more explicit? For example, work out how String produces SSSTSStrTrIiinIIngn

@LuisMendo I'm not OP, but I think: [S]SSTSS [t]rT, [r]I, [i]inII, [n]gn, where the characters between the blocks are the first bullet points ("Output the current character"), and the other characters are 1-5 times randomly one of the four choices for that character. But I agree, some more explicit explanations would be appropriate. Apart from the test case it wasn't particularly clear we have to pick a random choice 1-5 times. Instead of picking a random choice repeated 1-5 times (as the Gaia answer currently does).

@KevinCruijssen Thanks, Your explanation fits the example, and is clear. The OP should  confirm and edit that into the text

It took me several minutes to figure out what you meant by "switchcase version". Google didn't turn up anything. Might help to show an example on the line.

@KevinCruijssen I will change "1 and 5" to "1 - 5"

@LuisMendo What are you confused about? Do you have any suggestion on how to be more explicit?

I think it's clear now. I removed my vote to close

Gaia, 25 bytes
ṇ\+†ṅ\⟨)₌¤:~+4ṛ⟨ṛ₌¤⟩ₓ\⟩¦$

Try it online!
Thanks to Kevin Cruijssen for pointing out 2 bugs!
ṇ\				| delete the last character from the input
  +†				| push the input again and concatenate together, so for instance
				| 'abc' 'bc' becomes ['ab' 'bc' 'c']
    ṅ\				| delete the last element
       ⟨       		⟩¦	| for each of the elements, do:
	)₌			| take the first character and push again
	  ¤			| swap
	   :			| dup
	    ~			| swap case
	     +			| concatenate strings
	      4ṛ		| select a random integer from [1..5]
	        ⟨    ⟩ₓ		| and repeat that many times
		 ṛ₌¤		| select a random character from the string
		      \ 	| clean up stack
			   $	| convert to string
Note that 4ṛ is because ṛ is implemented for an integer z as python's random.randint(1,z+1), which returns an integer N such that 1<=N<=z+1.

Are you sure the run-length encode is correct here? If I understand the challenge correctly: the four options should be chosen 1-5 times randomly, instead of choosing one of the four randomly, repeated 1-5 times. The first example output SSSTSStrTrIiinIIngn ([SSSTSS, trT, rI, iinII, ngn]) seems to reflect this, and currently isn't a possible output in your program (I think).

@KevinCruijssen I interpreted "output from the list a random number of times" to mean run-length decode, but you're right, the test cases do seem to indicate the other interpretation; I think it should be pretty easy to fix

5ṛ can result in 6 for some reason Try it online? PS: Isn't there an integer to ranged list, or ranged for-loop in Gaia?

@KevinCruijssen dang, Business Cat really needs to fix off-by-one errors...I really thought there was a for type construct, but I'm pretty sure it's ₓ which isn't even documented on the wiki page.

APL (dzaima/APL), 23 bytes
Anonymous tacit prefix function.
∊2(⊣,{?4⍴⍨?5}⊇,,-⍤,)/

Try it online!
2(…)/ apply the following infix tacit function between each character pair:
 - the switchcase
 ⍤ of
 , the concatenation of the pair
 ,, prepend the concatenation of the pair to that
 {…}⊇ pick the following elements from that:
  ?5 random number in range 1…5
  4⍴⍨ that many fours
  ? random indices for those
∊ ϵnlist (flatten)

Bash, 121 bytes
-20 bytes thanks to Nahuel
-9 bytes thanks to roblogic
for((i=0;i<${#1};i++)){
s=${1:i:1}
m=${1:i:2}
m=${m,,}${m^^}
for((t=0;t++<RANDOM%6;)){
s+=${m:RANDOM%4:1}
}
printf "$s"
}

Try it online!
Original answer
Bash, 150 bytes
Have done very little golf bashing and trying to improve my bash, so any comments welcome.
for((i=0;i<${#1}-1;i++));do
c=${1:$i:1}
n=${1:$((i+1)):1}
a=($n ${c,} ${c^} ${n,} ${n^})
shuf -e ${a[@]} -n "$(shuf -i 1-5 -n 1)"|xargs printf %s
done

Try it online!
Code is straightforward loop through chars setting current c and next n character, then creating an array of the 4 possibilities, repeating one of them so there's exactly 5.  Next we shuffle that array, and then choose n elements from it, where n itself is random between 1 and 5.

seems it's missing printf %s "$c"

do and done can be replaced with undocumented { and }

with some changes

@NahuelFouilleul tyvm.  nice improvements and nice catch -- i'd somehow missed the requirement always to output the current char.

optimising the for loops to save 9 bytes :)

@roblogic that's clever.  tyvm.

The 121-byte solution is a bit fragile/buggy, here's a more robust (133-byte) version that should handle all printable ASCII, tio.run

Perl 6, 60 bytes
{S:g{.)>(.)}=$/~[~] roll ^5 .roll+1,$/.lc,$/.uc,$0.lc,$0.uc}

Try it online!
The lowercase/uppercase part is kinda annoying.

I don't know Perl, so I'm probably saying something stupid here. But is it somehow possible to concat the $/ and $0 together and use .lc on that string, and then create a copy of that string and use .uc, and concat those two together? Not sure if that's even possible, or shorter than your current $/.lc,$/.uc,$0.lc,$0.uc, but it would mean you'd use $/, $0, .lc, and .uc once each.

Alas, (.lc~.uc for $0~$/).comb is longer. Perl 6 really wants to distinguish strings and lists, so "abc"[0] eq "abc" (it pretends to be a single-item list).

You can do it by slipping and an anonymous function applied to a list: {.lc,|.uc}($/,|$0) for -5 bytes, and just use the list of matches {.lc,|.uc}(@$/) for -8 bytes. https://tio.run/##RYvBCoJAFEX3fcVNJBySkRa1UIygRS2FllEgOkrwdORNEmr661NB0eLC4XBuo5g2tuqwKBDDDqewHKTYelKMsRtM5@kC1kS4riE/sFz5g6TMf8o2G72dG4jRmrRD4Tnmzre6dEQ0@wofEr8dFZHGQzPl839iqOVGRDZhXXJaVe8/krbvSRmkdY69zhUOmooX

@PhilH No that doesn't work. Those solutions only capitalise one of the letters each

Jelly, 12 bytes
;Œsṗ5X¤XṭṖµƝ

Try it online!

Python 2, 107 bytes
f=lambda s:s and s[0]+''.join(sample((s[:2]+s[:2].swapcase())*5,randint(1,5)))+f(s[1:])
from random import*

Try it online!

05AB1E, 18 17 bytes
ü)vyн5LΩFyD.š«Ω]J

Inspired by @Giuseppe's Gaia answer.
-1 byte thanks to @Shaggy.
Try it online 10 times or verify all test cases 10 times.
Explanation:
ü)             # Create all pairs of the (implicit) input
               #  i.e. "Hello" → [["H","e"],["e","l"],["l","l"],["l","o"]]
  v            # Loop over each these pairs `y`:
   yн          #  Push the first character of pair `y`
   5LΩ         #  Get a random integer in the range [1,5]
      F        #  Inner loop that many times:
       y       #   Push pair `y`
        D.š«   #   Duplicate it, swap the cases of the letters, and merge it with `y`
            Ω  #   Then pop and push a random character from this list of four
  ]J           # After both loops: join the entire stack together to a single string
               # (which is output implicitly as result)

I don't know 05AB1E but, instead of INè, could you save anything by pushing the first character of y?

@Shaggy Yes, I indeed can.. Thanks! Maybe I should stop golfing for today, I'm a mess, lol..

You're a mess? ¨vNUy5LΩFy¹X>è«D.š«Ω?

@MagicOctopusUrn Although a pretty original approach, I'm afraid it doesn't do the first bullet point of the challenge ("Output the current character."), since the result can start with t, T, or s for input "String" in your program, while it's supposed to always start with the S.

Charcoal, 27 bytes
ＦＬθ«Ｆ∧ι⊕‽⁵‽⭆✂θ⊖ι⊕ι¹⁺↥λ↧λ§θι

Try it online! Link is to verbose version of code. Explanation:
ＦＬθ«

Loop over all of the indices of the input string.
Ｆ∧ι⊕‽⁵

Except for the first index, loop over a random number from 1 to 5 inclusive...
‽⭆✂θ⊖ι⊕ι¹⁺↥λ↧λ

... extract the previous and next characters from the string, take the upper and lower case versions, and pick a random character of the four.
§θι

Print the character at the current index.

Jelly, 14 bytes
;;;Œs$Xɗ¥5X¤¡Ɲ

Try it online!
Explanation
             Ɲ | For each overlapping pair of letters
;              | Join the first letter to...
         5X¤¡  | Between 1 and 5 repetitions of...
      Xɗ¥      | A randomly selected character from...
 ;;Œs$         | A list of the two letters and the swapped case versions of both

perl 5 (-p), 77 bytes
s/(.)(?=(.))/$x=$1;'$x.=substr"\U$1$2\L$1$2",4*rand,1;'x(1+5*rand)/gee;s/.$//

TIO

You can save 4 bytes by using $& instead of $1, and chop + -l instead of s/.$//

Japt -P, 14 bytes
äÈ+Zu pv ö5ö Ä

Try it
äÈ+Zu pv ö5ö Ä     :Implicit input of string
ä                  :Take each consectutive pair of characters
 È                 :Pass them through the following function as Z
  +                :  Append to the first character of the pair
   Zu              :    Uppercase Z
      p            :    Append
       v           :      Lowercase
         ö         :    Get X random characters, where X is
          5ö       :      Random number in the range [0,5)
             Ä     :      Plus 1
                   :Implicitly join and output

Python 3, 167 bytes
from random import*;c=choice
def f(s):
 i=0;r=""
 for i in range(len(s)-1):
  r+=s[i]
  for j in range(randrange(5)):r+=c([str.upper,str.lower])(c(s[i:i+2]))
 return r

Try it online!

C(GCC) 175 162 150 bytes
-12 bytes from LambdaBeta
-12 bytes from ceilingcat
f(s,S,i,r,a)char*s,*S,*i;{srand(time(0));for(i=S;s[1];++s)for(r=rand(*i++=*s)%5+1;r--;*i++=rand()&1&&a>96&a<123|a>64&a<91?a^32:a)a=s[~rand()&1];*i=0;}

Try it online!

I don't think you need the 0 in the first line.

Also can save a lot of characters by taking the buffer S as a parameter and adding your variables to the argument list: Try it online!

@LambdaBeta turns out you are right about the 0, which made it not worth it to have the #define anymore

140 bytes

PowerShell, 154 105 103 95 87 bytes
-67 bytes thanks to mazzy who can't be stopped
-join(($x=$args)|%{$_;$x[$i,++$i]*5|%{"$_"|% *wer;"$_"|% *per}|random -c(1..5|random)})

Try it online!
Not a fantastic method but it works. Now it's pretty good. Takes input via splatting

Oh, wow, thats a lot of bytes.

@mazzy Dang dog. I need to get into the habit of splatting all the time but didn't know you could hotswap the wildcard members like that.

I'm sorry 87 bytes

C (gcc), 110 109 bytes
i,p;g(char*_){for(i=rand(putchar(*_))%1024;p=_[i%2],putchar(i&2&&p>64&~-p%32<26?p^32:p),i/=4;);_[2]&&g(_+1);}

Try it online!
-1 thanks to ceilingcat
i,p;g(char*_){
    for(i=rand(putchar(*_)) //print current char
         %1024;             // and get 10 random bits
        p=_[i%2],           //1st bit => current/next char
        putchar(i&2&&       //2nd bit => toggle case
            p>64&~-p%32<26  // if char-to-print is alphabetic
            ?p^32:p),
        i/=4;);             //discard two bits
    _[2]&&g(_+1);           //if next isn't last char, repeat with next char
}

The number of characters printed (per input character) is not uniformly random:
1  if      i<   4 (  4/1024 = 1/256)
2  if   4<=i<  16 ( 12/1024 = 3/256)
3  if  16<=i<  64 ( 48/1024 = 3/ 64)
4  if  64<=i< 256 (192/1024 = 3/ 16)
5  if 256<=i<1024 (768/1024 = 3/  4)

Japt -P, 43 16 bytes
äÈ+(Zv +Zu)ö5ö Ä

Shortened by a lot now!
Try it

This seems to return the same result every time.

@Shaggy will fix. Also, ä's description says it gives three arguments, with the last being x+y. But as you can see here, it just returns 1. Is this a bug?

C# (Visual C# Interactive Compiler), 236 213 209 bytes
a=>{int i=0,j;var m=new Random();var s="";var c = a.Select(x=>Char.IsLetter(x)?(char)(x^32):x).ToArray();for(;i<a.Length-1;i++)for(j=m.Next(1,5);j-->0;)s+=new[]{a[i],c[i],a[i+1],c[i+1]}[m.Next(0,3)];return s;}

Try it online!

Does not work with non-alphanumeric characters. char b=a[0] -> var b=a[0], extra space in declaration of d in for-loop

Scala 2.12.8, 214 bytes
Golfed version:
val r=scala.util.Random;println(readLine.toList.sliding(2).flatMap{case a :: b :: Nil=>(a +: (0 to r.nextInt(5)).map{_=>((c: Char)=>if(r.nextBoolean)c.toUpper else c.toLower)(if(r.nextBoolean)a else b)})}.mkString)

Golfed with newlines and indents:
val r=scala.util.Random
println(readLine.toList.sliding(2).flatMap{
  case a :: b :: Nil=>
    (a +: (0 to r.nextInt(5)).map{_=>
      ((c: Char)=>if(r.nextBoolean)c.toUpper else c.toLower)(if(r.nextBoolean)a else b)
    })
}.mkString)

Ungolfed:
import scala.io.StdIn
import scala.util.Random

def gobble(input: String): String = {
  input.toList.sliding(2).flatMap {
    case thisChar :: nextChar :: Nil =>
      val numberOfAdditions = Random.nextInt(5)
      (thisChar +: (0 to numberOfAdditions).map { _ =>
        val char = if(Random.nextBoolean) thisChar else nextChar
        val cc = if(Random.nextBoolean) char.toUpper else char.ToLower
        cc
      })
  }.mkString
}

println(gobble(StdIn.readLine()))

No way to turn a :: b :: Nil into a::b::Nil? Same for a :+, a:+() or a.:+() might work

@Ven a::b::Nil causes a compile error. +: is a method defined on the list, so it might save space by getting rid of the outer parens?

You only have only one elem here so it’s not autotupling anyway

Perl 5 -n, 61 bytes
s/.(?=(.))/print$&,map{(map{lc,uc}$&,$1)[rand 4]}0..rand 5/ge

Try it online!

T-SQL query, 286 bytes
DECLARE @ char(999)='String'

SELECT @=stuff(@,n+2,0,s)FROM(SELECT
top 999*,substring(lower(c)+upper(c),abs(v%4)+1,1)s
FROM(SELECT*,number n,substring(@,number+1,2)c,cast(newid()as varbinary)v
FROM(values(1),(2),(3),(4),(5))F(h),spt_values)D
WHERE'P'=type and n<len(@)-1and h>v%3+2ORDER
BY-n)E
PRINT LEFT(@,len(@)-1)

Try it online unfortunately the online version always show the same result for the same varchar, unlike MS SQL Server Management Studio

C# (Visual C# Interactive Compiler), 156 bytes
n=>{var k=new Random();int i=0;foreach(var j in n.Skip(1).Zip(n,(a,b)=>a+b))for(Write(j[1]),i=0;i++<k.Next(5);)Write(k.Next()%2<1?j.ToUpper():j.ToLower());}

Try it online!

Zsh, 113 107 bytes
With a lot of help from man zshexpn and man zshparam. Try it Online!

-6 by me, tweaking

for ((;i<#1;i++)){m=${1:$i:2};m=$m:l$m:u
for ((;t<RANDOM%5;t++))x+=${m[RANDOM%4]}
echo ${1[i]}$x\\c;t=;x=;}

Ruby, 74 bytes
gsub(/.(?=(.))/){([$&,$1,$&.swapcase,$1.swapcase]*5).sample(rand 1..5)*""}

Attempt This Online!

Stax, 17 bytes
êß~Φ~a[├x◙w↓┬┬►{⌂

Run and debug it at staxlang.xyz!
Unpacked (20 bytes) and explanation:
2BFch]pc:~+5R|':$|'p
2B                      all size-2 subarrays
  F                     for each:
   ch]p                   print its first element
       c                  copy it on the stack
        :~                case-swap the copy
          +               concatenate
           5R|'           random integer 1-5, inclusive
               :$         Cartesian power
                 |'       random choice
                   p      print

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


text:
Expand and Contract
Take a positive integer \$k\$ as input. Start with \$n := 1\$ and repeatedly increase \$n\$ by the largest integer power of ten \$i\$ such that \$i \le n\$ and \$i + n \le k\$.
Repeat until \$n = k\$ and return a list of all intermediate values of \$n\$, including both the initial \$1\$ and the final \$k\$.
During this process, growth will initially be limited by the former inequality, and only afterwards by the latter; the growth will take the form of an initial "expansion" period, during which \$n\$ is increased by ever-larger powers, followed by a "contract" period, during which \$n\$ is increased by ever-smaller powers in order to "zoom in" on the correct number.
Test Cases
1 => [1]
10 => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
321 => [1,  2,  3,  4,  5,  6,  7,  8,  9,
        10, 20, 30, 40, 50, 60, 70, 80, 90,
        100, 200, 300, 310, 320, 321]
1002 => [1,   2,   3,   4,   5,   6,   7,   8,   9,
         10,  20,  30,  40,  50,  60,  70,  80,  90,
         100, 200, 300, 400, 500, 600, 700, 800, 900,
         1000, 1001, 1002]

This is code-golf, so the shortest answer (in bytes) wins.

May we print the numbers instead of returning a list?

@Adám Yes, you may.

Haskell, 72 68 64 63 bytes
f=(1!)
c!t|t==c=[c]|t>c=c:(c+10^(pred.length.show.min c$t-c))!t

Try it online!
Thanks Sriotchilism O'Zaic for -4 bytes!
Usage
f 321
[1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100,200,300,310,320,321]

Explanation
c!t         -- c=current number, t=target number
 |t==c=[c]  -- Target is reached, return last number
 |t>c=c:(c+10^(pred.length.show.min c$t-c))!t
      c:                                        -- Add current number to list
                                min c$t-c       -- The minimum of the current number, and the difference between the current number and the target
                    length.show.                -- The length of this number
               pred.                            -- Minus 1
           10^(                          )      -- Raise 10 to this power
         c+                                     -- Add that to the current number
        (                                 )!t   -- Recursion

Welcome to PPCG! Nice first answer.

I'm still learning Haskell, there's probably room for improvement

I don't know Haskell, but maybe any of these tips might help: tips for golfing in Haskell and tips for golfing in . But I agree, nice answer. +1 from me.

PS: Minor error in your explanation: "The length of the minimum of the current number, and the difference between the current number and the target"

It's actually just the number itself (since smaller numbers have shorter length)

@PaulMutser Ah ok, I thought it was the length of the minimum (minus 1), due to the pred.length. When I ported your answer to 05AB1E I used the length-1 for the minimum number. EDIT: Ah, I see you indeed changed your explanation to that. :)

Welcome to the site! Since (^) is higher precedence than (+) you don't need parentheses around the (^) expression.  Same goes for (!) and (:)

pred.length.show.min c$t-c can be shortened to length(show.min c$t-c)-1. Anonymous functions are acceptable, so you can drop the leading f= as explained in our guide to golfing rules in Haskell.

Instead of guards, you can use only one case and a conditional: c!t=c: if t>c then (c+10^(length(show.min c$t-c)-1))!t else []. This allows to apply this tip to save a few more bytes: Try it online!

JavaScript (ES6), 50 bytes
f=n=>n?[...f(n-(1+/(^10)?(0*$)/.exec(n)[2])),n]:[]

Try it online!
How?
Theory
The following steps are repeated until \$n=0\$:

look for the number \$k\$ of trailing zeros in the decimal representation of \$n\$
decrement \$k\$ if \$n\$ is an exact power of \$10\$
subtract \$x=10^k\$ from \$n\$

Implementation
The value of \$x\$ is directly computed as a string with the following expression:
+---- leading '1'
|
1 + /(^10)?(0*$)/.exec(n)[2]
     \____/\___/
        |    |
        |    +---- trailing zeros (the capturing group that is appended to the leading '1')
        +--------- discard one zero if n starts with '10'

Note: Excluding the leading '10' only affects exact powers of \$10\$ (e.g. \$n=\color{red}{10}\color{green}{00}\$) but does not change the number of captured trailing zeros for values such as \$n=\color{red}{10}23\color{green}{00}\$ (because of the extra non-zero middle digits, '10' is actually not matched at all in such cases).

Ingenious noting you can do the iteration "backwards" keeping track of only one variable! It's a bit confusing that you use k for something completely different than in the challenge description (in fact your n is a mix of OP's n and k and your x is their i.)

Python 2, 61 bytes
f=lambda k,n=1:n<k and[n]+f(k,n+10**~-len(`min(n,k-n)`))or[n]

Try it online!

Perl 6, 48 41 bytes
->\k{1,{$_+10**min($_,k-$_).comb/10}...k}

Try it online!
Explanation:
->\k{                                   }  # Anonymous code block taking k
     1,                             ...k   # Start a sequence from 1 to k
       {                           }       # Where each element is
        $_+          # The previous element plus
           10**      # 10 to the power of
                           .comb     # The length of
               min($_,k-$_)          # The min of the current count and the remainder
                                /10  # Minus one

APL (Dyalog Unicode), 30 bytesSBCS
Anonymous tacit prefix function. Prints numbers on separate lines to stdout.
{⍺=⍵:⍺⋄⍺∇⍵+10*⌊/⌊10⍟⍵,⍺-⎕←⍵}∘1

Try it online!
{…}∘1 anonymous infix lambda with 1 curried as initial \$n\$:
 ⍺=⍵ if \$k\$ and \$n\$ are equal:
  ⍺ return (and implicitly print) \$k\$
 ⋄ else:
  ⎕←⍵ print \$n\$
  ⍺- subtract that from \$k\$
  ⍵, prepend \$n\$
  10⍟ \$\log_{10}\$ of those
  ⌊ floor those
  ⌊/ minimum of those
  10* ten raised to the power of that
  ⍵+ \$n\$ plus that
  ⍺∇ recurse using same \$k\$ and new \$n\$

05AB1E, 15 bytes
1[=ÐIαD_#‚ßg<°+

Port of @PaulMutser's (first) Haskell answer, so make sure to upvote him!!
Try it online or verify all test cases.
Outputs the numbers newline delimited.
If it must be a list, I'd have to add 3 bytes:
X[DˆÐIαD_#‚ßg<°+}¯

Try it online  or verify all test cases.
Explanation:
1             # Push a 1 to the stack
 [            # Start an infinite loop
  =           #  Print the current number with trailing newline (without popping it)
  Ð           #  Triplicate the current number
   Iα         #  Get the absolute difference with the input
     D        #  Duplicate that absolute difference
      _       #  If this difference is 0:
       #      #   Stop the infinite loop
      ‚ß      #  Pair it with the current number, and pop and push the minimum
        g<°   #  Calculate 10 to the power of the length of the minimum minus 1
           +  #  And add it to the current number

Pip, 27 bytes
Wa>Po+:y/t*Y1Ty>o|o+y>ay*:t

Try it online!
In pseudocode:
a = args[0]
o = 1
print o
while a > o {
  y = 1
  till y > o || o + y > a
    y *= 10
  o += y / 10
  print o
}

I'm pretty pleased with the golfing tricks I was able to apply to shorten this algorithm. By initializing, updating, and printing stuff in the loop header, I was able to avoid needing curly braces for the loop body. There's probably a golfier algorithm, though.

Jelly, 19 bytes
1µ«³_$DL’⁵*$+µ<³$Ð¿

Try it online!

Wolfram Language (Mathematica), 51 bytes
Union@NestList[#+10^Floor@Log10@Min[s-#,#]&,1,s=#]&

Try it online!

Batch, 131 bytes
@set/an=i=1
:e
@if %n%==%i%0 set i=%i%0
@echo %n%
:c
@set/an+=i
@if %n% leq %1 goto e
@set/an-=i,i/=10
@if %i% neq 0 goto c

Takes input as a command-line parameter and outputs the list of numbers to STDOUT. Explanation:
@set/an=i=1

Start with n=1 and i=1 representing the power of 10.
:e
@if %n%==%i%0 set i=%i%0

Multiply i by 10 if n has reached the next power of 10.
@echo %n%

Output the current value of n.
:c
@set/an+=i
@if %n% leq %1 goto e

Repeat while i can be added to n without it exceeding the input.
@set/an-=i,i/=10

Restore the previous value of n and divide i by 10.
@if %i% neq 0 goto c

If i is not zero then try adding i to n again.

R, 67 65 bytes
-2 bytes thanks to Giuseppe

k=scan();o=1;i=10^(k:0);while(T<k)o=c(o,T<-T+i[i<=T&i+T<=k][1]);o

Pretty simple. It takes a set of powers of 10 beyond what would be needed in reverse order i.
(I would prefer to use i=10^rev(0:log10(k)) instead of i=10^(k:0) since the latter is computationally ineffecient, but golf is golf!).
Then in a while loop, applies the conditions to i and takes the first (i.e. largest); updates n, and appends to output
Try it online!

Save a byte using T instead of n; it should be 2 but I don't think that TRUE is acceptable output for k=1, so we set o=+T. Try it!

That is horrendous coding, I like it. incidently, I can set o=1, and get that second byte.

Jelly, 12 bytes
1+«ạæḟ⁵«Ɗɗ¥Ƭ

Try it online!

Japt, 18 bytes
ÆT±ApTmTnU)sÊÉÃf§U

Try it
ÆT±ApTmTnU)sÊÉÃf§U     :Implicit input of integer U
Æ                      :Map the range [0,U)
 T±                    :  Increment T (initially 0) by
   A                   :  10
    p                  :  Raised to the power of
     Tm                :    The minimum of T and
       TnU             :      T subtracted from U
          )            :    End minimum
           s           :    Convert to string
            Ê          :    Length
             É         :    Subtract 1
              Ã        :End map
               f       :Filter
                §U     :  Less than or equal to U

C# (Visual C# Interactive Compiler), 123 122 bytes
m=>{var a=new[]{1}.ToList();int s;for(;(s=a.Last())<m;)a.Add(s+(int)Math.Pow(10,(int)Math.Log(s<m-s?s:m-s,10)));return a;}

Try it online!

Prolog (SWI), 142 bytes
L-D-M:-append(L,[D],M).
N-L-C-X-R-I:-I=1,C is X*10,N-L-C-C-R-1;D is C+X,(D<N,L-D-M,N-M-D-X-R-I;D>N,N-L-C-(X/10)-R-0;L-D-R).
N-R:-N-[]-0-1-R-1.

Try it online!
Explanation coming tomorrow or something


text:
Consistent Overhead Byte Stuffing (COBS)
I'm surprised this hasn't been posted before!
The Consistent Overhead Byte Stuffing (COBS) algorithm is used to delimit byte streams.
We choose a frame marker (we'll use 0x00) and wherever 0x00 occurs in the stream it is replaced with the number of bytes until the next 0x00 occurs (we'll call this a milestone). This reduces the range of values from 0..255 to 1..255, enabling 0x00 to unambiguously delimit frames in the stream.
At a milestone, if the next 255B does not contain 0x00 this exceeds the maximum milestone length - the algorithm must 'stall' at 255B and put another milestone. This is the 'consistent overhead'.
The first byte will be the first milestone, the final milestone will be the number of bytes until the frame marker.
Some examples from Wikipedia (best to read the article where they are coloured):
0x00 as frame marker

Unencoded data (hex)    Encoded with COBS (hex)
00                      01 01 00
00 00                   01 01 01 00
11 22 00 33             03 11 22 02 33 00
11 22 33 44             05 11 22 33 44 00
11 00 00 00             02 11 01 01 01 00
01 02 03 ... FD FE      FF 01 02 03 ... FD FE 00
00 01 02 ... FC FD FE   01 FF 01 02 ... FC FD FE 00
01 02 03 ... FD FE FF   FF 01 02 03 ... FD FE 02 FF 00
02 03 04 ... FE FF 00   FF 02 03 04 ... FE FF 01 01 00
03 04 05 ... FF 00 01   FE 03 04 05 ... FF 02 01 00

Challenge: to implement this in the shortest program.

Input is an unencoded byte stream/array, output is an encoded byte stream/array
Use any sort of binary standard input/output
The final frame marker is not necessary
The program can return an oversized array
A stream ending with 254 non-zero bytes does not require the trailing 0x00

Notes

The worst-case return length is numBytes + (numBytes / 254) + 1

Example
We have the byte array
[0] 0x01
[1] 0x02
[2] 0x00
[3] 0x03
[4] 0x04
[5] 0x05
[6] 0x00
[7] 0x06

For each 0x00 we need to state (in a milestone) where the next 0x00 would have been.
[0] 0x03   #Milestone. Refers to the original [2] - "The next 0x00 is in 3B"
[1] 0x01   #Original [0]
[2] 0x02   #Original [1]
[3] 0x04   #Milestone. Refers to the original [6] - "The next 0x00 is in 4B"
[4] 0x03   #
[5] 0x04   #
[6] 0x05   # Originals [3..5]
[7] 0x02   #Milestone. Refers to the end frame marker
[8] 0x06   #Original [7]
[9] 0x00   #Optional. End frame marker.

You probably should include this in the spec: As a special exception, if a packet ends with a group of 254 non-zero bytes, it is not necessary to add the trailing zero byte. This saves one byte in some situations. (quoting Wikipedia)

@LuisMendo Agreed. Now that I've walked through all test cases, I can confirm that this is currently a bit underspecified.

@Arnauld, I've stated the end frame maker is not necessary anyway :)

In the example, the first output byte should be 0x03, not 0x02, unless I'm mistaken...

Thank you, @OlivierGrégoire

@LuisMendo, I have added an example.

Thanks. Removed the VTC vote

@Arnauld regarding special case of ending with 254 non-zero bytes: agree, and this is a separate issue to the final frame marker. It is why the sixth example doesn’t have a trailing 01 but there are two 01s in the ninth one (where there are 254 non-zero bytes followed by a zero).

JavaScript (Node.js), 114 bytes
a=>(g=([v,...a])=>1/v?[v||a.indexOf(0)+1,...g(a)]:[])([0,...a,0].flatMap((v,j)=>1/a[j]&&(i=v&&i+1)>253?[v,i=0]:v))

Try it online!

Java (JDK), 143 bytes
a->{int l=a.length,r[]=new int[l+2],i=0,j=1,x=1,z=0;for(;i<l;){if(a[i]>0)r[j++]=a[i];if(a[i++]<1||++x>254){r[z]=x;z=j++;x=1;}}r[z]=x;return r;}

Try it online!

Elixir, 109 bytes
&Regex.replace~r/(^|(?<=([^\0]{254}))(?!$)|\0)((?2)|[^\0]*?(?=\0|$))/,&1,fn _,_,_,x-><<1+byte_size x>><>x end

Try it online!

Python 2, 125 bytes
def f(a):
 r=[[]]
 for v in a:r+=[[]]*((len(r[-1])>253)+(v<1));r[-1]+=[v]*(v>0)
 return sum([[len(x)+1]+x for x in r],[])+[0]

Try it online!

Jelly, 27 bytes
Oµ=0ks€254Ẏḟ€0L‘;Ɗ€F;Ṫ¬x`ƊỌ

Try it online!
A monadic link that takes an unencoded byte array as input and returns the encoded byte array. As per the rules, the final frame marker is omitted.
Explanation
Oµ                          | Convert to integer and start a new monadic chain
  =0k                       | Split after zeros
     s€254                  | Split each list into length 254 lists
          Ẏ                 | Tighten (reduce list depth by 1)
           ḟ€0              | Filter zeros out from each list
              L‘;Ɗ€         | Prepend the list length plus one to each list
                   F        | Flatten
                    ;Ṫ¬x`Ɗ  | Append an additional 1 if the original list ended with zero
                          Ọ | Convert back to bytes

J, 103 chars
Notice the result from the last test case is different from wiki and other languages. This is due to this pointer to 254-th zero byte at the boundary. Things get a lot easier, if this isn't treated as a special case.
f =: 3 : 0
  k =. I. (y,0)=0
  s =. - 2 (-/) \ k
  (>: y i. 0), s (}:k) } y
 )

 f2 =: 3 : 0
   f each _254 <\ y
 )

Try It Online

You can take it down 1 byte by removing the trailing space at the end of the last line.


text:
Find efficient seating arrangement in a line
We have X Girls and Y Boys in a class. If more girls sit together they will not behave. Similarly if more boys sit together they will not behave.
Write a program/algorithm to get maximum same gender that will be seated if seating is done to efficiently to get them behave.
Example 1: 5 girls and 1 boy
Expected Output: 3
Explanation: G G B G G G
Example 2: 7 girls and 3 boys
Expected Output: 2
Explanation: G G B G B G G B G G

Is this just ceil(max(b,g)/(1+min(b,g)))?

Maybe this should be code-golf?

This definitely doesn't seem complicated enough for [tag:fastest-algorithm] to be all that interesting, but it could be interesting to golf. There might even be the potential for some sort of thematically appropriate semi-golf [tag:code-challenge] scoring scheme, but that would probably be a bad idea.

what's the winning criteria? It would probably be best to do [tag:code-golf]

Python 2, 26 bytes
lambda b,g:-min(b/~g,g/~b)

Try it online!

JavaScript (Node.js), 31 bytes
Port of @TFeld python answer
a=>b=>-Math.min(a/~b,b/~a)+.5|0

Try it online!


text:
Valid term from quadratic sequence?
You are given four numbers. The first three are \$a\$, \$b\$, and \$c\$ respectively, for the sequence:
$$T_n=an^2+bn+c$$
You may take input of these four numbers in any way. The output should be one of two distinct outputs mentioned in your answer, one means that the fourth number is a term in the sequence (the above  equation has at least one solution for \$n\$ which is an integer when \$a\$, \$b\$, \$c\$ and \$T_n\$ are substituted for the given values), the other means the opposite.
This is code golf, so the shortest answer in bytes wins. Your program should work for any input of \$a, b, c, T_n\$ where the numbers are negative or positive (or 0), decimal or integer. To avoid problems but keep some complexity, non-integers will always just end in \$.5\$.  Standard loop-holes disallowed.
Test cases
a   |b   |c   |T_n |Y/N
------------------------
1   |1   |1   |1   |Y     #n=0
2   |3   |5   |2   |N
0.5 |1   |-2  |-0.5|Y     #n=1
0.5 |1   |-2  |15.5|Y     #n=5
0.5 |1   |-2  |3   |N
-3.5|2   |-6  |-934|Y     #n=-16
0   |1   |4   |7   |Y     #n=3
0   |3   |-1  |7   |N
0   |0   |0   |1   |N
0   |0   |6   |6   |Y     #n=<anything>
4   |8   |5   |2   |N

Jelly,  11  10 bytes
_/Ær1Ẹ?%1Ạ

A monadic Link which accepts a list of lists* [[c, b, a], [T_n]] and yields 0 if T_n is a valid solution or 1 if not.
* admittedly taking a little liberty with "You may take input of these four numbers in any way".
Try it online! Or see a test-suite.
How?
_/Ær1Ẹ?%1Ạ - Link: list of lists of integers, [[c, b, a], [T_n]]
 /         - reduce by:
_          -   subtraction                    [c-T_n, b, a]
      ?    - if...
     Ẹ     - ...condition: any?
  Ær       - ...then: roots of polynomial     i.e. roots of a²x+bx+(c-T_n)=0
    1      - ...else: literal 1
       %1  - modulo 1 (vectorises)            i.e. for each: keep any fractional part
           -                                       note: (a+bi)%1 yields nan which is truthy
         Ạ - all?                             i.e. all had fractional parts?
           -                                       note: all([]) yields 1

If we could yield non-distinct results then _/Ær1Ẹ?ḞƑƇ would also work for 10 (it yields 1 when all values are solutions, otherwise a list of the distinct solutions and hence always an empty list when no solutions - this would also meet the standard Truthy vs Falsey definition)

That input is perfectly fine.

JavaScript (ES7), 70 bytes
Returns a Boolean value.
(a,b,c,t)=>(t-=c,(a*=2)?(x=(b*b+2*a*t)**.5-b)%a&&(x+b+b)%a:b?t%b:t)==0

Try it online!
How?
For the sake of clarity, we define \$d = T_n-c\$. (The same variable \$t\$ is re-used to store this result in the JS code.)
Case \$a\neq0\$
The equation really is quadratic:
$$T_n=an^2+bn+c\\
an^2+bn-d=0$$
With \$a'=2a\$, the discriminant is:
$$\Delta=b^2+2a'd$$
and the roots are:
$$n_0=\frac{-b-\sqrt{\Delta}}{a'}\\
n_1=\frac{-b+\sqrt{\Delta}}{a'}$$
The equation admits an integer root if \$\sqrt{\Delta}\$ is an integer and either:
$$\begin{align}&-b-\sqrt{\Delta}\equiv 0\pmod{a'}\\ \text{ or }&-b+\sqrt{\Delta}\equiv 0\pmod{a'}\end{align}$$
Case \$a=0, b\neq0\$
The equation is linear:
$$T_n=bn+c\\
bn=d\\
n=\frac{d}{b}$$
It admits an integer root if \$d\equiv0\pmod b\$.
Case \$a=0, b=0\$
The equation is not depending on \$n\$ anymore:
$$T_n=c\\
d=0$$

05AB1E, 35 bytes
Æ©²Āi²4P³n+tÐdi(‚³-Ä²·Ä%P}ë®³Āi³%]_

Port of @Arnauld's JavaScript answer, so make sure to upvote him!
Takes the input in the format \$[t,c], a, b\$.
Try it online
Explanation:
Æ                         # Reduce the (implicit) input-list by subtraction (`t-c`)
 ©                        # Store this value in the register (without popping)
  ²Āi                     # If the second input `a` is not 0:
     ²4P                  #  Calculate `(t-c)*a*4`
        ³n+               #  Add the third input `b` squared to it: `(t-c)*a*4+b*b`
           t              #  Take the square-root of that
                          #  (NOTE: 05AB1E and JS behave differently for square-roots of
                          #   negative integers; JS produces NaN, whereas 05AB1E leaves the
                          #   integer unchanged, which is why we have the `di...}` here)
            Ð             #  Triplicate this square
             di           #  If the square is non-negative (>= 0):
               (‚         #   Pair it with its negative
                 ³-       #   Subtract the third input `b` from each
                   Ä      #   Take the absolute value of both
                    ²·Ä%  #   Modulo the absolute value of `a` doubled
                          #   (NOTE: 05AB1E and JS behave differently for negative modulos,
                          #    which is why we have the two `Ä` here)
                        P #   Then multiply both by taking the product
              }           #  And close the inner if-statement
    ë                     # Else (`a` is 0):
     ®                    #  Push the `t-c` from the register
      ³Āi                 #  If the third input `b` is not 0:
         ³%               #   Take modulo `b`
    ]                     # Close both if-else statements
     _                    # And check if the result is 0
                          # (which is output implicitly)

Would Å² save some bytes? (Probably not since we later need to compute the square root anyway.)

@Arnauld Unfortunately not for three reasons: 1. Å² with negative values somehow gives the value itself instead of 0.. 2. Å² with decimal values (even with .0) gives 0 instead of 1 whether they're a square or not (this is a bug which I will report to Adnan). 3. Even if both would have worked and -4.0 would result in 0 instead of -4.0 and 4.0 would result in 1 instead of 0, it would still be +2 bytes since we need the square-root and the triplicate would be separated duplicates: tÐdi vs DÅ²itD; or currently DÄïÅ²itD to fix the other two mentioned issues.

Besides, the results of Å² on negative inputs are inconsistent.

@Arnauld Wth.. that's indeed pretty weird. And the legacy version even gives a different, just as weird result.. :S I've reported the bugs, including your test TIO to Adnan in the 05AB1E chat.

Jelly, 15 bytes
_3¦UÆr=Ḟ$;3ị=ɗẸ

Try it online!
Built-in helps here but doesn’t handle a=b=0 so this is handled specially.

Wolfram Language (Mathematica), 38 bytes
Solve[n^2#+n#2+#3==#4,n,Integers]!={}&

Try it online!