Solve Burgers' equation IVP with shock trajectory Burgers Equation

Consider the initial value problem for Burgers' equation
$$ \begin{align}\begin{cases} u_{t} + u u_{x} = 0    \\ u(x,0) = f(x)       \end{cases} \end{align} \tag{1}$$
our initial data is given as
$$ f(x)= \begin{align}\begin{cases} 1   & x <0  \\  -x   & 0 \leq x < 1 \\  -1  & x \geq 1      \end{cases} \end{align} \tag{2}$$ Solve this IVP and identify the shock equation


The characteristics are then given by
$$ \frac{dx}{dt} = u \\ \frac{du}{dt} =0 \tag{3} $$
When we solve them we should get
$$ x(t) = ut +x_{0} \tag{4} $$
$$ u(t) = c_{0} $$
then we get
$$ u = c_{0} = f(x_{0}) \tag{5} $$
$$ x(t)= f(x_{0})t + x_{0} \tag{6} $$
I do not know how to get $x_0$ and how to continue, any helpful advice is welcome, thanks in advance!
 A: There are many similar examples on this site. By substituting $u = f(x_0)$ in OP's last equation $(6)$, the implicit solution $u = f(x-ut)$ is obtained. 
Now, we plot the base characteristic curves in the $x$-$t$ plane:

One observes that the classical solution deduced from the characteristics is only valid (and uniquely defined) on the restricted domain $\lbrace x<0 \rbrace \cup \lbrace x>t \rbrace$ for small positive times, and we have
$$
u(x,t) =
\left\lbrace
\begin{aligned}
&1 && \text{if}\quad x<0 \\
&\tfrac{x}{t-1} && \text{if}\quad t<x<1-t \\
& {-1} && \text{if}\quad x>1-t
\end{aligned}\right.
$$
by solving $u = f(x-ut)$.
The characteristics intersect in the vicinity of $x=0$ at $t=0^+$: a shock wave occurs. According to the Rankine-Hugoniot condition, the shock wave has speed
$$
\gamma'(t) = \frac12 \left(1 + \frac{\gamma(t)}{t-1}\right) .
$$
with the initial condition $\gamma(0)=0$. Therefore, the shock trajectory $\gamma(t) = t-1 + \sqrt{1-t}$ is obtained, and the full solution reads
$$
u(x,t) =
\left\lbrace
\begin{aligned}
&1 && \text{if}\quad x<\gamma(t) \\
&\tfrac{x}{t-1} && \text{if}\quad \gamma(t)<x<1-t \\
& {-1} && \text{if}\quad x>1-t
\end{aligned}\right.
$$
for small times. It remains to check what happens when the shock wave intersects the locus $x=1-t$. This happens at the time $t^* = 3/4$ and the abscissa $\gamma(t^*) = 1/4 = 1-t^*$. The Rankine-Hugoniot condition gives the shock speed $\gamma'(t)=0$, so that the solution reads
$$
u(x,t) =
\left\lbrace
\begin{aligned}
&1 && \text{if}\quad x<1/4 \\
& {-1} && \text{if}\quad x>1/4
\end{aligned}\right.
$$
for $t>t^*$. The shock trajectory has become vertical in $x$-$t$ coordinates, and we have a static shock located at $x=1/4$.
