text:
Stone Maze Chess solver
Background:
Every war eventually comes to an end, but the end is never absolute. The Stone Maze Chess scenario takes place after a game of chess is finished. The enemy King is dead and the pieces is lost in vacuity almost out of faith, multiplying. The winning side has moved on except for the Hero who is left behind with one mission still to go.
Objective:

Your mission is to guide your hero to put a stone on the enemy Kings grave to prevent the ghost of the King from haunting the land in eternity.

Visualization:
Board size and positions are notated just like a normal chess table, lines from A to H and ranks from 1 to 8. Visualized almost empty table:
    A B C D E F G H

8   . . . H . . . .  8
7   . . . o . . . .  7
6   . . . . . . . .  6
5   . . . . . . . .  5
4   . . . . . . . .  4
3   . . . . . . . .  3
2   . . . . . . . .  2
1   . . . X . . . .  1

    A B C D E F G H

Movement:
You move your Hero(H) one square every move: North(N), South(S), East(E) or West(W). You can push the Stone(o) in front of the Hero(H) if the path is free from board edges, stonewalls and chess pieces. If you move your Hero(H) into the reach of any enemy piece, it will immediately take the first chance to kill the hero, and the game is over. That, for example, means that you cannot move the hero adjacent to an enemy Queen() or Rook(R) unless there is a wall between the Hero(H) and the piece.
The kings grave(X) and any Trap(T) cannot be crossed by the Hero(H) or any piece except for the Knight(K) who can leap over it.
Push & pull:
All of the chess pieces can also be pushed one square just like the Stone(o), leaving a stonewall behind. Pieces, unlike the Stone(o), is also pulled if the Hero moves away from the piece.
Piece movement:
On top of that, if your Hero(H) stands adjacent (orthogonal [not diagonally]) to a chess piece the chess piece can be moved like a chess piece in standard chess. This applies only to Pawns(P), Knights(K) and Bishops(B) because your Hero(H) can't stand adjacent to a Rook(R) or a Queen(Q) without being attacked by the piece, unless there is a stonewall between. Pawns(P) can only move forward (north), but can be pushed or pulled in any of the four directions. Pawns(P) on the 2nd rank can move either 1 or 2 steps forward on the same move if the path is free. The other pieces can also move like they do in chess, but cannot move through any stonewall, except for the knight who can leap over stonewalls, traps(T), the Hero(H), the Stone(o) and other pieces. Bishops(B) and Queens(Q) can diagonally tangent a stonewall, but cannot cross two connected stonewalls, when moved or attacking the Hero(H).
Pawns(P) attack diagonally in the same way, only connected stonewalls prevent the attack. A single loose stonewall can't prevent a Pawn(P) from attacking diagonally.
Edit: This hopefully explains how diagonal movement works, X's represents possible destination positions for the Bishop(B):
    A B C D E F G H     A B C D E F G H

8   .|_|. . . _ . .  8  X . . . . . . .
7   . _ . . . .|. .  7  . X . . . X . .
6   . _|. . . . . .  6  . . X . X . . .
5   . . . B _ . . .  5  . . . B . . . .
4   . .|. . _ . _ .  4  . . X . X . . .
3   .|. . . _ _ _ .  3  . X . . . X . .
2   .|. . . . . . .  2  . . . . . . . .
1   . . . . . . . .  1  . . . . . . . .

    A B C D E F G H     A B C D E F G H

/Edit
Stonewalls:
From the start the board is free from stonewalls. Chess pieces without their King stands still so long that they turn into stone, so when pushed or pulled they will leave a line of stones between the square they come from and the square they are pushed or pulled onto, preventing everything except Knights(K) to pass through it. The stonewalls gradually creates a maze. If all sides of a square is filled with stonewalls, that square is again released from all surrounding stonewalls, the square is reset. The four corner squares is reset when both edges facing the board get stonewalls, edge squares is reset when all three sides has stonewalls. Free squares that is surrounded by other squares has four sides and is reset when all four sides is filled with stonewalls.
Trap:
If a piece is pushed or moved to a trap, it dies and is removed from the table. Pieces cannot cross over a trap, except for Knights(K). If the Hero(H) moves to a trap, it is game over.
Game state (input to your program):
Input is always 8 lines of 16 characters, each 2 bytes (one state and one blankspace) is representing one square on the board.
Valid input characters and their purpose:
. = Empty square
H = Hero start position.
X = The kings grave.
o = The stone.
T = A trap.
P = Pawn.
K = Knight.
B = Bishop.
R = Rook.
Q = Queen.

Example input:
. . . H . . . .
. . . o . . . .
. P . . . P . .
. P . K . P . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . X . . . .

In addition to the Hero(H), the Stone(o) and the Kings grave(X) we here have four Pawns(P) and one Knight(K) on the board setup.
How to solve the example puzzle:
Here is a solution where we push two pieces creating only two single vertical stonewalls on the board. Not exactly a Maze, but will serve as an example.

Push the stone one step south.
Go around with the Hero far east, south to rank 2, west and up on line D adjacent to the knight at D5.
Move the knight to B4.
Move the knight to A6.
Push the pawn at F5 one step east, and then move it one step north (this way we avoid end up adjacent to it and pull it south again).
Move the pawn at F6 one step north.
Move the Hero north and around the stone on east side.
Push the stone south until the kings grave. Successful solution.

The above solution is intentionally a bit unneccessary complex, just to demonstrate how stonewalls appear. Stonewalls can appear horizontally also if pieces is pushed or pulled north or south.
Here is visualizations of some states of the example game solution:
1.  . . . H . . . .
    . . . o . . . .
    . P . . . P . .
    . P . K . P . .
    . . . . . . . .
    . . . . . . . .
    . . . . . . . .
    . . . X . . . .

2.  . . . . . . . .
    . . . . . . . .
    . P . o . P . .
    . P . K . P . .
    . . . H . . . .
    . . . . . . . .
    . . . . . . . .
    . . . X . . . .

7.  . . . . . . . .
    . . . . H P . .
    K P . o . . P .
    . P . . . .|. .
    . . . . . . . .
    . . . . . . . .
    . . . . . . . .
    . . . X . . . .

8.  . . . . . . . .
    . . . H P|. . .
    K P . o . . P .
    . P . . . .|. .
    . . . . . . . .
    . . . . . . . .
    . . . . . . . .
    . . . X . . . .

Control notation (output from your program):
Move the Hero(H) using 4 commands:
+N = Move 1 step north
+S = Move 1 step south
+E = Move 1 step east
+W = Move 1 step west

If you move the Hero(H) 1 step east and the Stone(o) or a chess piece is adjacent to the east then your Hero(H) will push the Stone(o) or the piece 1 step east in front of the Hero(H). This is only possible if the square behind in the pushing direction is a free square and no stonewall in the path. Same for all four directions.
If you move 1 step east and there is a piece adjacent behind to the west without a stonewall between, the Hero will pull that piece one step east and create a stonewall behind it. The same in all four directions.
If your Hero(H) stands adjacent to any chess piece you may also move the piece if it is able to move, notation is newline + source position + destination position, examples:
E2E3    = Moves a *Pawn*(P) from square E2 to E3. The *Hero*(H) cannot stand at square E3 before this move.
D8G5    = Moves a *Bishop*(B) from square D8 to G5.

The output should be one solution to the input. There may be several different solutions to the same input, your program only needs to provide one solution
for one input.
In practise:
If feeding your program with this input (the above example):
. . . H . . . .
. . . o . . . .
. P . . . P . .
. P . K . P . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . X . . . .

Then this is one valid output:
+S+N+E+E+E+E+S+S+S+S+S+S+W+W+W+W+N+N+N
D5B4+W+W
B4A6+E+E+E+N+E+S+E
G5G6+W+N
F6F7+W+N+N+W+S+S+S+S+S

Your program should - using a standard computer with normal proccessing power - be able to provide a solution within 30 minutes of calculations.
Test cases:
4 Example inputs your program should be able to solve (among other ones, don't try hardcoding their solutions):
. . . H . . . .
. . . o . . . .
. P . . . P . .
. P . K . P . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . X . . . .

. . . H . . . .
. . . o . . . .
. . . . . . . .
. P . . . P . .
. . P T P . . .
. . . . P . . .
. . . . . . . .
. . . X . . . .

. . . . . . . .
Q . . . . . . .
. . . . . . . .
P P . . K T K .
. . . . . . . .
. . . P . . . .
. o . . . . . .
. H . . P . X .

. . . H . . . .
. . . o . . . .
R . . . . . . .
P P P P P . . .
. . . . . . . .
. . . . . . . .
. . . P P P P P
. . . . . . . X

This is code-golf, shortest solution in bytes of sourcecode wins!

The Hero cannot move an adjacent piece if a stonewalls separates them orthogonally. So Rooks and Queens never moves from their starting positions unless attacking the Hero. I have added a visualized example demonstrating diagonal movement among stonewalls that I hope covers your questions about it.

Yes that covers all my questions, thank you :)

I think this would benefit from sandboxing, because IMO it needs quite a bit of editing, probably in two or three rounds, to be clearly understandable. Some problems: 1. Notation. If the "visualisation" section used the wasted space on the right to list the characters which a board can contain, there would be a single place to refer to (rather than them being spread throughout the question) and they would not need to be repeated every time a man is mentioned. (And, as a side note, the standard notation for a knight is N).

Sequence of concepts. "You can push the Stone(o) ... if the path is free from ... stonewalls". But what's a stonewall? "The kings grave(X) and any Trap(T) cannot be crossed by the Hero(H)". What's a trap? Listing the symbols in advance would help partially with this, because the names of the concepts would already have been introduced. 3. Notation (bis). "All of the chess pieces can also be pushed one square just like the Stone(o), leaving a stonewall behind." How is a hero on top of a stonewall represented?

Objective. "If the Hero(H) moves to a trap, it is game over." So was the mission "to guide your hero" the goal of my program, or is it the goal of a human player and my program is an interactive game? 5. Poorly explained examples. "The above solution is intentionally a bit unneccessary complex, just to demonstrate how stonewalls appear." But having looked at the example, I have no idea how stonewalls appear (or, for that matter, why the solution isn't just "South, South"). If you showed the state after each move it would achieve the purpose.

How can the Hero be on top of a stonewall if the Hero can only be on one of the squares while stonewalls only can be between squares? You have obviously not understanded the concept at all, no offense.

You don't understand the example because you missed the part under the Stonewalls-section where I state that the stonewalls is created between the square a piece is pushed or pulled from and the square the piece is pushed or pulled to. Perhaps I should have explained that part more times, or would that violate your first comment about repetition?

"Game over" in that sentence I used it is a failure, and not a successful solution. Game over is in my world, grown up with C64, is the same as saying: You're out, let your friend play instead!. Or in "Waynes World" it is: We're screwed!

Anyway, I have been here for about three years, and honestly, it was so much more fun back then without the nitpicking. I do not know if that is for the befenfit of codegolf or not, but personally I don't like it .. at all. So I am out of here. See you all never, Bye!

The Game state-section has a list, a single place, of the valid characters. Did you skip that section? As a side note, I am not using standard chess notation in my question, I thought it would be unneccessary verbose to state that. Anyway, since the King is dead the letter K was free, and as Knight starts with the letter K I did find it very perfect to reuse that excellent letter for another purpose.

As for the unclear what I am asking for reason for putting the challenge on hold I can only say: Effort have been made in trying to misunderstand the concept at best.

"why the solution isn't just "South, South""? Moving the Hero two squares South will not push the stone to the X, and therefor it is not a valid solution. I am not sure how verbose I need to describe the concept of the Hero pushing the stone, so that you fully comprehend how it technically intended to work. If you have ever played the game Boulderdash, perhaps that gives you a clue. The knight is in the path, I have described that pushing tech: "You can push the Stone(o) in front of the Hero(H) if the path is free from board edges, stonewalls and chess pieces.". A Knight is a chess piece.

I have taken my sense together and decided that I will attempt to re-write it from scratch. I apologize to you Peter Taylor if my comments yesterday came out wrong and offensive, I will do my best in meeting your suggestions about improving it. It might take some days though.

2, 3. I interpreted "they will leave a line of stones between the square they come from and the square they are pushed or pulled onto" as describing a situation where a piece was pushed/pulled several times, leaving a trail of stonewalls. Suggested wording: "they will leave a stonewall which separates the square they come from and the square they are pushed or pulled onto", preferably accompanied by a diagram showing before and after. 4. Why not just say that moving the hero onto a trap is forbidden? 1. No, I hadn't got that far. I read from top to bottom.

Ah. My ingrained training that K means King is too strong.


text:
Split as number, join as string, repeat
Consider the process of:

Taking a non-negative integer N.
e.g. 27.
Spliting it into integers N - floor(N/2) and floor(N/2) (a 'bigger' and 'smaller' half) and writing them in that order.
e.g.27 becomes 14 13.
Removing the space to join the integers into a new, much larger integer.
e.g. 14 13 becomes 1413.
Repeating steps 2 and 3 some desired number of times.
e.g. 1413 → 707 706 → 707706 → 353853 353853 → 353853353853 → ...

This challenge is about doing exactly this, but not always in base 10.
Challenge
Write a program that takes in three numbers, B, N, and S:

B is an integer from 2 to 10 that is the base of N (binary to decimal).
N is the non-negative integer to apply the splitting-rejoining process to. To make user input easier, it is given as a string in base B, not an integer.
S is a non-negative integer that is the number of times to repeat the splitting-rejoining process.

The output of the program is the string representation of N in base B after S split-join procedures.
When S is 0, no splits are done, so the output is always N.
When N is 0, all splits have the form 0 0 and reduce to 0 again, so the output is always 0.
Examples

B = 10, N = 27, S = 1 → 1413
B = 10, N = 27, S = 2 → 707706
B = 9, N = 27, S = 1 → 1413
B = 9, N = 27, S = 2 → 652651
B = anything, N = anything, S = 0 → N
B = anything, N = 0, S = anything → 0

Table for all B with N = 1 for S = 0 to 7:
B       S=0     S=1     S=2     S=3         S=4             S=5                 S=6                                 S=7
2       1       10      11      101         1110            111111              10000011111                         10000100001000001111
3       1       10      21      1110        202201          101101101100        1201201201212012012011              212100212102121002121212100212102121002120
4       1       10      22      1111        223222          111311111311        2232222232322322222322              11131111131311311111311113111113131131111131
5       1       10      32      1413        432431          213441213440        104220331443104220331442            2433241322130211014044424332413221302110140443
6       1       10      33      1514        535535          245550245545        122553122553122553122552            4125434125434125434125441254341254341254341254
7       1       10      43      2221        11111110        40404044040403      2020202202020220202022020201        10101011010101101010110101011010101101010110101011010100
8       1       10      44      2222        11111111        44444454444444      2222222622222222222226222222        11111113111111111111131111111111111311111111111113111111
9       1       10      54      2726        13581357        62851746285173      3142536758708231425367587081        15212633743485606571782880411521263374348560657178288040
10      1       10      55      2827        14141413        70707077070706      3535353853535335353538535353        17676769267676676767692676771767676926767667676769267676

Table for all B with random N  for S = 0 to 3:
B       S=0     S=1         S=2                 S=3
2       11011   11101101    11101111110110      11101111110111110111111011
3       2210    11021101    20102012010200      1001212100121210012121001211
4       1113    230223      112112112111        2302302302323023023022
5       101     2323        11341134            31430423143042
6       120     4040        20202020            1010101010101010
7       134     5252        24612461            1230456412304564
8       22      1111        445444              222622222622
9       4       22          1111                505505
10      92      4646        23232323            1161616211616161

Details

Take input via stdin or the command line. Output to stdout.
Instead of a program, you may write a function that takes B, N, and S and prints the result normally or returns it (as a string).
B, N, and S may be taken in any order.
All inputs that produce outputs whose decimal values are below 232 should work.
N is represented in the usual way. i.e. most significant digit first and no leading zeros except in zero itself which is written 0. (Outputting 00 instead of 0 is invalid.)
The shortest code in bytes wins.

Iff you enjoy my challenges, consider giving Block Building Bot Flocks! some love :)

I don't know if a leaderboard for answers is really necessary.

@orlp Probably not. I'll remove it and put it back if there are a bunch of answers. I just wanted to show off my and Optimizers Stack Snippet shenanigans.

Pyth, 21 19 bytes
vujksmjldQc2UiGQvwz

Takes input in the format N\nB\nS. Try it online: Demonstration or Test harness
Explanation
                      implicit: z = 1st input (N)
                                Q = 2nd input evaluated (B)
 u              vwz   reduce z (evaluated 3rd input) times by:
             iGQ         convert string from base Q to base 10
            U            create a range [0, 1, ..., ^-1]
          c2             split into 2 lists (lengths are N-[N/2] and [N/2])
     m                   map each list d to:
       ld                   their length
      j  Q                  in base Q
    s                    join both lists
  jk                     join the numbers by ""
v                     convert string to int (getting rid of leading zeros)

Pyth, 29 21 bytes
jku+j-JiGQK/J2QjKQvwz

Really straightforward implementation.
Takes input on stdin in the following format:
N
B
S

This gives the wrong output 00 for N=0.

Mathematica, 101 bytes
Nest[a~Function~(b=FromDigits)[Through@((c=IntegerString)@*Ceiling<>c@*Floor)[a/2],#],#2~b~#,#3]~c~#&

Uses some Through trickery to apply both the ceiling and floor functions. Just ignore the errors.

CJam, 24 bytes
q~:B;{:~Bb_)\]2f/Bfbs}*i

Test it here. Takes input as "N" S B.
Explanation
q~                       e# Read an eval input.
  :B;                    e# Store the base in B and discard it.
     {               }*  e# Repeat S times.
      :~                 e# Turn the string N into an array of digits.
        Bb               e# Interpret as base B.
          _)\            e# Duplicate and increment. Swap order.
             ]2f/        e# Wrap them in an array and (integer-)divide both by 2.
                 Bfb     e# Convert both to base B.
                    s    e# Flatten into a single string.
                       i e# Convert to an integer to fix the N = 0 case.

"0" 1 9 outputted 00. I tried to golf it: q~:B;{:~Bb,2/z:,Bfbs}*, but also invalid because it outputted empty string instead.

An i at the end would take care of 00. You can get the byte back by replacing 2/:I-I] with )\]2f/.

JavaScript (ES6) 78 79
Recursive function. Run snippet to test (Firefox only)
Edit 1 byte saved thx @DocMax

F=(b,n,s,S=x=>x.toString(b),m=parseInt(n,b))=>m*s?F(b,S(-~m>>1)+S(m>>1),s-1):n

// Ungolfed

U=(b,n,s)=>
{
  var S=x=>x.toString(b) // function to convert in base b
  var m=parseInt(n,b) // string in base b to integer
  if (m==0 || s==0)
    return n
  else
    return F(b,S((m+1)>>1) + S( m>>1 ),s-1)
}

// Test
test=[
  {B: 10, N: '0', S:3, K: '0' }, {B: 10, N: '27', S: 1, K: '1413' }, {B: 10, N: '27', S: 2, K: '707706' }, {B: 9, N: '27', S: 1, K: '1413' }, {B: 9, N: '27', S: 2, K: '652651' }
];

test2=[[2, '11011', '11101101', '11101111110110', '11101111110111110111111011'],[3, '2210', '11021101', '20102012010200', '1001212100121210012121001211'],[4, '1113', '230223', '112112112111', '2302302302323023023022'],[5, '101', '2323', '11341134', '31430423143042' ]  ,[6, '120', '4040', '20202020', '1010101010101010'],[7, '134', '5252', '24612461', '1230456412304564'],[8, '22', '1111', '445444', '222622222622'],[9, '4', '22', '1111', '505505'],[10, '92', '4646', '23232323', '1161616211616161' ]
]
test2.forEach(r=>test.push(
  {B:r[0],N:r[1],S:1,K:r[2]}, {B:r[0],N:r[1],S:2,K:r[3]}, {B:r[0],N:r[1],S:3,K:r[4]}
))

test.forEach(t => (
  r=F(t.B, t.N, t.S),
  B.innerHTML += '
'+(r==t.K?'Ok':'Failed')
      +'	'+t.B +'	'+t.N
      +'	'+t.S +'	'+r +'	'+t.K +'
'
))
th,td { font-size: 12px; padding: 4px; font-family: helvetica }

  TestBNSResultCheck

I truly love how elaborate your proofs of success are. Also, you can save 1 by replacing m&&s with m*s.

@DocMax it's a real and useful unit test. It's too easy to break everything while golfing.

ECMAScript 6, 90 bytes
var f=(B,N,S)=>((n,s)=>S?f(B,s(n+1>>1)+s(n>>1),S-1):s(n))(parseInt(N,B),x=>x.toString(B))

Defining a recursive function using a variable is not really good style, but it is the shortest code I could come up with in ECMAScript 6.
Getting the corner case "00" => "0" right wastes three bytes (s(n) instead of simply N).
To try it out, you can use Babel's REPL: copy/paste the code and print example invocation results like so: console.log(f(9, "27", 2)).

Common Lisp - 113 characters
(lambda(b n s)(dotimes(i s)(setf n(format ()"~vR~vR"b (- #1=(parse-integer n :radix b)#2=(floor #1# 2))b #2#)))n)

Ungolfed
(lambda(b n s)
  (dotimes(i s)
    (setf n (format () "~vR~vR" b (- #1=(parse-integer n :radix b)
                                     #2=(floor #1# 2))
                                b #2#)))
  n)

The ~vR format directive outputs integer in base v, where v is provided as an arguments to format.
parse-integer accepts a :radix argument for converting from a specified base.
#1= and #1# (respectively assign and use) are reader variables which allow to share common sub-expressions. When expanded, they give the following code:
(lambda (b n s)
  (dotimes (i s)
    (setf n
            (format nil "~vr~vr" b
                    (- (parse-integer n :radix b)
                       (floor (parse-integer n :radix b) 2))
                    b (floor (parse-integer n :radix b) 2))))
  n)

Pip, 27 bytes
Lcb:+J[(bFB:a)%2i]+b//2TBab

Takes base, integer, and number of repetitions as command-line arguments. The algorithm is straightforward, but uses a couple interesting language features:
                             a, b, c initialized from cmdline args, and i = 0 (implicit)
Lc                           Do c times:
        bFB:a                Convert b from base a to decimal and assign back to b
      [(     )%2i]           Construct a list containing b%2 and 0 (using i to avoid
                               scanning difficulties)
                  +b//2      Add floor(b/2) to both elements of list; the list now contains
                               b-b//2 and b//2
                       TBa   Convert elements of list back to base a
     J                       Join list
    +                        Coerce to number (necessary to turn 00 into plain 0)
  b:                         Assign back to b
                          b  Print b at the end

Pip's scalar type, which represents both numbers and strings, is handy here, as are item-wise operations on lists; unfortunately, parentheses and the two-character operators FB, TB, and // negate any advantage.
Alternate solution, without the intermediate assignment but still 27 bytes:
Lcb:+J[bFBa%2i]+bFBa//2TBab

C, 245 bytes
int b,z,n,f,r;c(char*t,n){return n?((z=c(t,n/b)),z+sprintf(t+z,"%d",n%b)):0;}main(){char t[99],*p;gets(t);b=atoi(t);f=n=strtol(p=strchr(t,32)+1,0,b);if(!(r=atoi(strchr(p,32)+1)))f=0;while(r--)n=strtol(t+c(t+c(t,n-n/2),n/2)*0,0,b);puts(f?t:"0");}

This isn't going to win anything, but it was fun to make!

PHP, 115 112 bytes
function($b,$n,$s){while($s--)$n=($c=base_convert)(ceil($n=$c($n,$b,10)/2),10,$b).$c(floor($n),10,$b);return$n;}

Try it online!
Ungolfed:
function split_join_repeat( $b, $n, $s ) {
    // repeat S times
    for( $x=0; $x < $s; $x++ ) {
        // convert N from base B to base 10 for arithmetic
        $n = base_convert( $n, $b, 10 );
        // divide and split in base 10, convert back to base B and join
        $n = base_convert( ceil( $n / 2 ), 10, $b ) .
            base_convert( floor( $n / 2 ), 10, $b );
    }
    return $n;
}

Output
B = 10, N = 27, S = 1   1413
B = 10, N = 27, S = 2   707706
B = 9, N = 27, S = 1    1413
B = 9, N = 27, S = 2    652651

2   1   10  11  101 1110    111111  10000011111 10000100001000001111
3   1   10  21  1110    202201  101101101100    1201201201212012012011  212100212102121002121212100212102121002120
4   1   10  22  1111    223222  111311111311    2232222232322322222322  11131111131311311111311113111113131131111131
5   1   10  32  1413    432431  213441213440    104220331443104220331442    12141204110401030043301214120411040103004330
6   1   10  33  1514    535535  245550245545    122553122553122553122552    131022143412311313533131022143412311313533
7   1   10  43  2221    11111110    40404044040403  2020202202020220202022020201    40556522600645213204055652260064521320
8   1   10  44  2222    11111111    44444454444444  2222222622222222222226222222    76650460747555347665046074755534
9   1   10  54  2726    13581357    62851746285173  3142536758708231425367587081    4861155667688600048611556676886000
10  1   10  55  2827    14141413    70707077070706  3535353853535335353538535353    17676769267677271767676926767727

Japt, 17 bytes
_nW o ó ®ÊsWÃq}gV

Try it online!
Takes input in the order S, N, B with N as a singleton list. Accepting N without a singleton list costs 2 bytes.
Explanation:
_             }g     #Get the Sth item generated by this function...
                V    #...Starting with N as the 0th item:
 nW                  # Evaluate the previous item as a base B number
    o                # Create a list with that length
      ó              # Divide it into two lists as evenly as possible
        ®   Ã        # For each of those lists:
         Ê           #  Get the length
          sW         #  Convert it to base B
             q       # Join the two strings together

Forth (gforth), 105 bytes
: f base ! 0 ?do 0. 2swap >number nip 2drop 2 /mod >r i + r> 0 tuck <# #s 2drop #s #> loop type decimal ;

Try it online!
Explanation
Changes the base to B, then in a loop that runs S times:

Converts string to a number
Splits number in 2 halves (one larger than the other if odd)
Combines the two numbers back into a string

Prints the string when finished and sets the base back to 10 (so we can run multiple times in a row)
Code Explanation
:f                    \ start a new word definition
  base !              \ set the base to B
  0 ?do               \ loop from 0 to S-1 (runs S times)
    0. 2swap          \ places a double-length 0 on the stack behind the string
    >number           \ converts the string to a number in the current base
    nip 2drop         \ get rid of string remainder and second part of double
    2 /mod            \ get the quotient and remainder of dividing by 2
    >r                \ throw the quotient on the return stack
    i                 \ get a copy of the quotient from the return stack
    +                 \ add quotient and remainder
    r>                \ move quotient from return stack to stack
    0 tuck            \ convert both to double-length numbers
    <#                \ start a pictured numeric output
      #s              \ add entire number to output
      2drop           \ drop empty number
      #s              \ add second number to output
    #>                \ convert output to a string and drop number from stack
  loop                \ end loop
  type                \ print output string
  decimal             \ set base back to 10
;                     \ end word definition

source: Stack Exchange

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

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

sort: votes


text:
Compute the Resistance of a 4 Band Color Coded Resistor
Resistors commonly have color coded bands that are used to identify their resistance in Ohms. In this challenge we'll only consider the normal 4-band, tan, axial-lead resistors. We'll express them as:
xyzt

Where x is the first band for the first significant figure, y is the second band for the second significant figure, z the third band for the multiplier, and t is the fourth band for the tolerance.
Each of xyzt represents a letter that abbreviates the color of the band:
K = Black
N = Brown
R = Red
O = Orange
Y = Yellow
G = Green
B = Blue
V = Violet
A = Gray
W = White
g = Gold
s = Silver
_ = None

So, for example, NKOg is some particular resistor.
The resistance can be calculated with the help of this table:

As the table suggests:

x and y can be any letters except g, s, and _.
z can be anything except _.
We'll restrict t to only be g, s, or _.

(Here's a handy resistance calculator that deals with exact same set of resistors we are.)
The resistance is 10 * x + y times the z multiplier, to a tolerance of the t percentage.

For example, to calculate the resistance of NKOg, we see that:

N means Brown for 1.
K means Black for 0.
O means Orange for 103.
g means Gold for ±5%.

So the resistance is (10*1 + 0)*10^3 → 10000 Ω ±5%.

Challenge
Write a program or function that takes in a 4 character string of the form xyzt and prints or returns the resistance in the form [resistance] Ω ±[tolerance]%.

The resistor may be "upside-down", i.e. in the reverse order tzyx. For example, both NKOg and gOKN should produce 10000 Ω ±5%.
The resistance is always in plain ohms, never kilohms, megohms, etc.
Ω may be replaced with ohms, e.g. 10000 ohms ±5%.
± may be replaced with +/-, e.g. 10000 Ω +/-5%.
Having trailing zeros to the right of a decimal point is fine. (e.g. 10000.0 Ω +/-5%)
You can assume input is always valid (x and y never gs_; z never _; t only gs_).
All 10×10×12×3 = 3600 possible resistors (2×3600 possible inputs) need to be supported even if some color band combinations aren't produced in real life.

The shortest code in bytes wins.
Examples

gOKN → 10000 ohms +/-5%
KKR_ → 0 Ω +/-20%
ggKN → 1 ohms ±5%
ggGO → 3.5 Ω ±5%
ssGO → 0.350 Ω ±10%
GOOs → 53000 ohms +/-10%
YAK_ → 48.0 ohms +/-20%
_WAV → 78000000000 Ω ±20%
gBBB → 66000000.000 ohms ±5%
_RYR → 2400.00 ohms ±20%

Iff you enjoy my challenges, consider checking out Block Building Bot Flocks!

CJam, 59 58 56 50 bytes
r_W%e>"sgKNROYGBVAW"f#2f-~A*+A@#*" Ω ±"@[KA5]='%

Try it online in the CJam interpreter.

CJam, 53 51 50 bytes
" Ω ±"l_W%e<)iB%5*F-'%@"gKNROYGBVAW"f#:(2/'e*s~o

Try it online.
(Thanks to @user23013 for a byte)

I started out in Python, but
eval("%d%de%d"%tuple("gKNROYGBVAW".find(x)-1for x in L))

was too expensive...

:(2/'e*s~ saves the [.

@user23013 Ah thanks, I've been trying a bunch of ways of inserting the e where it's necessary, but I never thought of / and *

Python 3, 130 114 bytes
def f(v):
 a,b,c,d=["_sgKNROYGBVAW".index(x)-3for x in v[::(1,-1)[v[0]in'sg_']]]
 return "%s Ω ±%s%%"%((10*a+b)*10**c,2.5*2**-d)

edit: @Sp3000 points out that the ordering can be better detected with min(v,v[::-1]) rather than v[::(1,-1)[v[0]in'sg_']] (saving 10 bytes), not check the index of _ and remove some unnecessary whitespace.
def f(v):a,b,c,d=["sgKNROYGBVAW".find(x)-2for x in min(v,v[::-1])];return"%s Ω ±%s%%"%((10*a+b)*10**c,2.5*2**-d)

Thanks - I realised about concatenating the lines, but I missed the trick of using min() to detect the correct ordering - nice.

Perl, 93 bytes
#!perl -lp
ord>90and$_=reverse;s/./-3+index zsgKNROYGBVAW,$&/ge;$_=s/..\K/e/*$_." Ω ±"./.$/*5*$&."%"

Haskell, 135 132 130 bytes
r y|y<"["=p[k|j<-y,(c,k)<-zip"_ sgKNROYGBVAW"[-4..],c==j]
r y=r.reverse$y
p[a,b,c,d]=show((a*10+b)*10**c)++" Ω ±"++show(-5*d)++"%"

Explanation:
r y|y<"["=            If first letter of argument is a capital
p[..]                 Call p on the list created
[k|                   Make a list of all k
   j<-y               Draw character j from input
       ,(c,k)<-       With (c,k) being a pair from
               zip    A list of pairs of corresponding elements from the lists:
"_ sgKNROYGBVAW"       The space at 2nd position is to match '_' with -4, but 's' with -2
[-4..]                 An infinite list starting at -4
,c==j]                Only use element k if j equals the character c

r y=r.reverse$y       If first call fails, call again with reversed argument.

p[a,b,c,d]=           Assign the first four elements of the argument to a,b,c,d respectively.
show                  Turn (number) into string
10**c                 10 to the power of c
++                    Concatenate strings
-5*d                  This works for the tolerance because '_' makes d=-4

Thanks to nimi, I shaved off another 2 bytes.

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


text:
Minimum of a Polynomial in Python
What is the shortest amount of code that can find the minimum of an inputted polynomial? I realize that you can import packages like Numpy and others, but using only user defined functions, what is the shortest way to do this? For example, if 6x6 + 4x3-12 is entered (ignore parsing issues), what would be the shortest amount of code to find the minimum value?

Does "ignore parsing issues" mean that we can assume the polynomial data is in any convenient form?  E.g. can I accept the example polynomial as a list of coefficients [-12, 0, 0, 4, 0, 0, 6]?

What should be the output for polynomials whose minimum value is negative infinity, such as x^3?

@DLosc yes that is acceptable, and I guess I should exclude those that don't have a finite number. Let's assume they exist in the space of R2, and are rational numbers.

Is a local minimum acceptable ?

@Mig yes, but  ideally the program will find all minima and select the smallest one (not just magnitude, so -100 is lower than -2).

Python - 202 Bytes
D=lambda p:[i*p[i]for i in range(1,len(p))]
A=lambda p,x:p>[]and p[0]+x*A(p[1:],x)
def N(p):f=D(p);s=D(f);x=1.;y=-x;exec'x-=A(f,x)/A(s,x);y-=A(f,y)/A(s,y);'*99;return A(p,x),A(p,y)
print min(N(input()))

11 bytes saved due to @xnor.
Input is taken from stdin, and is expected to be in the following format: [x0, x1, x2, ...]. For example, the sample in the problem description would be entered as [-12, 0, 0, 4, 0, 0, 6].

Functions
D - Calculates the derivative of a polynomial p.
A - Applies a polynomial p to the value x.
N - Uses Newton's Method to calculate local minima/maxima of a polynomial p.
Note: For higher order polynomials, there may be several local minima. In these cases, this function is not guaranteed to find the global minimum.

Sample Usage
$ echo [-12, 0, 0, 4, 0, 0, 6] | python poly-min.py
-12.6666666667

I think you can do the polynomial evaluation shorter recursively: A=lambda p,x:p>[]and p[0]+x*A(p[1:],x).

How do you guarantee that Newton's method converges?

@PeterTaylor if the first derivative isn't zero anywhere, for example x³ + x, it obviously won't. But this also implies that there isn't a local minimum anywhere, either.

I was more interested in the case where there is a local minimum, but Newton's method goes in circles.


text:
Let's build a race car track!
Introduction
My niece wants to make a race car track. She has wooden parts that fit together to form the track. Each part is square shaped and contains a different shape. I'll use the pipe drawing characters to illustrate:

│: the road that goes vertically
─: the road that goes horizontally
┌ ┐ └ ┘: the roads that turn in a direction
┼: A bridge with an underpass

Curiously, there are no t-junction pieces.
Here's an example of a possible race car track:
┌─┐
│ │┌─┐
│ └┼─┘
└──┘

The rules for a valid race car track are as follows:

There can't be any roads that go to nowhere.
It must form a loop (and all the pieces must be part of the same loop).
At the bridges / underpasses, you can't turn (so you have to go straight through them).

Unfortunately, the race car track pieces my niece and I have are limited. But we definitely want to use all of them in the track. Write a program that, given a list of what pieces are in our inventory, outputs a race car track that uses all of those pieces.
Input Description
We'd like the input to come in via STDIN, command line arguments, file reading, or a user input function (such as raw_input or prompt). The input is comma separated positive integers in the form
│,─,┌,┐,└,┘,┼

where each of those represent the amount of that particular piece we have. So for instance the input:
1,1,1,1,1,1,1

would mean that we had one of each piece.
Output Description
Output a race car track using the pipe drawing characters listed above. The race car track should use exactly the number of each piece specified in the input -- no more, and no less. There will be at least one valid race car track for every input.
Example Inputs and Outputs
Input: 3,5,2,2,2,2,1
A possible output:
┌─┐
│ │┌─┐
│ └┼─┘
└──┘

Input: 0,0,1,4,4,1,3
A possible output:
 ┌┐
 └┼┐
  └┼┐
   └┼┐
    └┘

Does it need to give the output? Or does it only theoretically need to give the output?

@Sumurai8 What do you mean by "theoretically" give the output? Do you mean a program that won't terminate for an extremely long time but will eventually give the output?

One would probably be able to create a field of n x n squares filled with the race pieces and empty squares, where you can generate permutations until you find something that is a race track. That would take forever for anything more than a few tiles.

@Sumurai8 Ah okay, I understand now. I would prefer that programs will  give an output before the heat death of the universe for the small value inputs I've shown in the challenge.

Your niece is not patient enough! :P

Ruby 664 671 677 687 701 (678 bytes)
_={│:[1,4],─:[2,8],┌:[4,8],┐:[4,2],└:[1,8],┘:[1,2],┼:[1,4,2,8]}
s=->a,l,b{l==[]&&a==[]?b:(l.product(l).any?{|q,r|q,r=q[0],r[0];(q[0]-r[0])**2+(q[1]-r[1])**2>a.size**2}?!0:(w,f=l.pop
w&&v=!a.size.times{|i|y=_[x=a[i]]
f&&y&[f]==[]||(k=l.select{|p,d|w!=p||y&[d]==[]}
(y-[f]).map{|d|z=[w[0]+(d<2?-1:(d&4)/4),w[1]+(d==2?-1:d>7?1:0)]
g=d<3?d*4:d/4
b[z]?_[b[z]]&[g]!=[]||v=0:k<<[z,g]}
v||r=s[a[0...i]+a[i+1..-1],k,b.merge({w=>x})]
return r if r)}))}
c=eval"[#{gets}]"
r=s[6.downto(0).map{|i|[_.keys[i]]*c[i]}.flatten,[[[0,0],nil]],{}]
h=j=k=l=0
r.map{|w,_|y,x=w
h>x&&h=x
j>y&&j=y
k<x&&k=x
l<y&&l=y}
s=(j..l).map{|_|' '*(k-h+1)}
r.map{|w,p|y,x=w
s[y-j][x-h]=p.to_s}
puts s

This is not the shortest program I could come up with, but I sacrificed some brevity for execution speed.
You can experiment with the program here. Note that ideone has an execution time limit, so for inputs consisting of more than about 12 pieces, the program will probably time out.
There's also a test suite for the program. Note that the last two tests are disabled on ideone, due to the time limit mentioned above. To enable these tests, delete the x_ prefix from their names.
The program finds a solution using Depth-first search; it places pieces one at a time and keeps tracks of loose ends. The search stops when there are no more loose (unconnected) ends and all pieces have been placed.
This is the ungolfed program:
N, W, S, E = 1, 2, 4, 8

# given a direction, find the opposite
def opposite (dir)
  dir < 3 ? dir * 4 : dir / 4
end

# given a set of coordinates and a direction,
# find the neighbor cell in that direction
def goto(from, dir)
  y, x = from

  dx = case dir
  when W then -1
  when E then 1
  else 0
  end

  dy = case dir
  when N then -1
  when S then 1
  else 0
  end

  [y+dy, x+dx]
end

CONNECTIONS = {
  ?│ => [N, S],
  ?─ => [W, E],
  ?┌ => [S, E],
  ?┐ => [S, W],
  ?└ => [N, E],
  ?┘ => [N, W],
  ?┼ => [N, S, W, E],
}

BuildTrack =-> {
  piece_types = CONNECTIONS.keys
  piece_counts = gets.split(?,).map &:to_i

  pieces = 6.downto(0).map{|i|piece_types[i]*piece_counts[i]}.join.chars

  def solve (available_pieces, loose_ends=[[[0,0],nil]], board={})

    return board if loose_ends==[] and available_pieces==[]

    # optimization to avoid pursuing expensive paths
    # which cannot yield a result.
    # This prunes about 90% of the search space
    c = loose_ends.map{ |c, _| c }
    not_enough_pieces = c.product(c).any? { |q, r|
      ((q[0]-r[0])**2+(q[1]-r[1])**2) > available_pieces.size**2
    }
    return if not_enough_pieces

    position, connect_from = loose_ends.pop

    return unless position

    available_pieces.size.times do |i|
      piece = available_pieces[i]

      remaining_pieces = available_pieces[0...i] + available_pieces[i+1..-1]

      piece_not_connected_ok = connect_from && CONNECTIONS[piece] & [connect_from] == []
      next if piece_not_connected_ok

      new_loose_ends = loose_ends.select  { |pos, dir|
        # remove loose ends that may have been
        # fixed, now that we placed this piece
        position != pos || CONNECTIONS[piece] & [dir] == []
      }

      invalid_placement = false

      (CONNECTIONS[piece]-[connect_from]).map do |dir|
        new_pos = goto(position, dir)
        new_dir = opposite(dir)

        if board[new_pos]
          if CONNECTIONS[board[new_pos]] & [new_dir] != []
            # do nothing; already connected
          else
            # going towards an existing piece
            # which has no suitable connection
            invalid_placement = true
          end
        else
          new_loose_ends << [new_pos, new_dir]
        end
      end

      next if invalid_placement

      new_board = board.merge({position => piece})

      result = solve(remaining_pieces, new_loose_ends, new_board)
      return result if result
    end
    nil
  end

  def print_board board
    min_x = min_y = max_x = max_y = 0

    board.each do |position, _|
      y, x = position
      min_x = [min_x, x].min
      min_y = [min_y, y].min
      max_x = [max_x, x].max
      max_y = [max_y, y].max
    end

    str = (min_y..max_y).map{|_|
      ' ' * (max_x - min_x + 1)
    }

    board.each do |position, piece|
      y, x = position
      str[y-min_y][x-min_x] = piece
    end
    puts str
  end

  print_board(solve(pieces))
}


text:
Sourcecode selfie
Objective:
A guru once said a perfect code selfie is best shot diagonally from upper left corner. A code selfie is almost like a Quine - but rotated 45 degree clockwise.
Your mission is to code a program that outputs a code selfie.
Rules:

You can use any programming language.
Your programs should not take any input from file, filename, network or anything else.

Mandatory criterias:
Selfies is about the motive and background, so blankspaces (and other not visible content like linefeeds and such)
does not count as being part of the character count. All visible characters is restricted to be outputted on the correct 45 degree rotated position while all non-visible characters is not restricted to the correct 45 degree rotated position.
Just like a color palette on a normal selfie, mandatory to a code selfie is that it contains atleast 16 of these characters: {a-zA-Z0-9}
Example:
If this example is valid sourcecode:
Output abcd
Output efgh
Output ijkl
Output mnop

The example code should output this:
   O
  O u
 O u t
O u t p
 u t p u
  t p u t
   p u t
    u t   a
     t   e b
        i f c
       m j g d
        n k h
         o l
          p

This is code-golf, shortest sourcecode in bytes wins!

16 of unique [a-zA-Z0-9] ?

How would we score a submission in Whitespace?

Whitespace is not possible, since blankspaces does not count. Yes, 16 of unique [a-zA-Z0-9], not a total least 16 chars.

This challenge is biased against languages which require linebreaks in their code. It's much harder to support multiline for this challenge.

@nderscore Perhaps you are correct about that. Well, we are all here for fun, right? Do the best out of the situation! ;)

This is a great idea! +1

Javascript (ES6), 72 bytes
16 unique alphanumeric character pallete: fjalert0plcgmixn

(f=j=>alert(`(f=${f})(0)`.replace(/./gmi,x=>' '.repeat(j++)+x+'\n')))(0)

m and i flags are added to the regexp to meet minimum palette requirements.

CJam, 30 28 25 bytes
{95c103ic]seeSf.*N*Xmr}_g

This is kind of long due to the 16 character from A-Za-z0-9 limit.
This is a bit non-trivial variant of a standard quine in CJam. Will add explanations soon.
UPDATE - 2 bytes saved thanks to Martin, 3 bytes saved thanks to Dennis
Try it online here

Java, 312
class Z{public static void main(String[]a){String s="class Z{public static void main(String[]a){String s=%c%s%1$c,t;for(int i=0,j;i<326;System.out.println(t+s.format(s,34,s).charAt(i++)))for(j=i,t=%1$c%1$c;j-->0;)t+=' ';}}",t;for(int i=0,j;i<326;System.out.println(t+s.format(s,34,s).charAt(i++)))for(j=i,t="";j-->0;)t+=' ';}}

There are actually 326 bytes, but if I understand the rules correctly, I don't have to count the 14 spaces.
The program is basically a standard Java quine, plus a lot of whitespace.

Python 3, 139 characters - 10 spaces = 129 characters
sjxd='sjxd=%r;[print(" "*i+(sjxd%%sjxd)[i]) for i in range(len(sjxd%%sjxd))]';[print(" "*i+(sjxd%sjxd)[i]) for i in range(len(sjxd%sjxd))]

Since my code was one line, all I had to do was print the program diagonally. My string has the weird name 'sjxd' so that my code could have the 16 unique alphanumeric characters.

CSS, 69 bytes
<style>:before,*{transform:rotate(45deg;display:block;content:'<style>

Put in a blank html page to avoid conflict with other tags.
Palette: stylebfortanm45dgiplck (22 chars)

MATLAB, 40 bytes
Bit difficult with the whole recursion thing - how do you print your own source code when adding the code to a string to be printed increases the size of the source code itself. But, never the less, the following will do it:
123456;disp(diag('123456;disp(diag())'))

The 123456; bit is there to meet the required 16 unique characters. The following are used:
'()123456;adgips

The above code doesn't work on Octave for some reason, but does work in MATLAB. Below is the output:
1
 2
  3
   4
    5
     6
      ;
       d
        i
         s
          p
           (
            d
             i
              a
               g
                (
                 )
                  )

Now if you don't mind the ans= bit that MATLAB enjoys putting, the following would work for 32 bytes:
12345678;diag('12345678;diag()')