$$u_{tt} - u_{xx} = 0$$
The general solution (without boundary condition) is :
$$u(x,y)=f(x+t)+g(x+t)$$
The functions $f$ and $g$ are not necessarily the same.
The condition $u(x,0) = \phi(x)=f(x)+g(x)$ implies
$\quad\begin{cases}
f(x)=\frac12\phi(x)+h(x) \\
g(x)=\frac12\phi(x)-h(x)
\end{cases}$
$$ u(x,t)=\frac12\phi(x+t)+h(x+t)+\frac12\phi(x-t)-h(x-t)$$
$h(x)$ is an arbitrary function to be determined by the condition $u_t(x,0)=0$
$$ u_t(x,t)=\frac12\phi'(x+t)+h'(x+t)-\frac12\phi'(x-t)+h'(x-t)$$
$$ u_t(x,0)=\frac12\phi'(x)+h'(x)-\frac12\phi'(x)+h'(x)$$
$$u_t(x,0)=0=2h'(x) \quad\implies\quad h(x)=C$$
Your solution is confirmed :
$$ u(x,t)=\frac12\phi(x+t)+\frac12\phi(x-t)$$
The function $\phi$ is a given piecewise function :
$$\phi(x) = \begin{cases}
1 & |x| \leq 1 \\
0 & |x| > 1 \\
\end{cases}$$
$$ u(x,t)=\frac12\begin{cases}
1 & x+t \leq 1 \\
1 & -x-t \leq 1 \\
0 & x+t > 1 \\
0 & -x-t > 1 \\
\end{cases}+
\frac12\begin{cases}
1 & x-t \leq 1 \\
1 & -x+t \leq 1 \\
0 & x-t > 1 \\
0 & -x+t > 1 \\
\end{cases}$$
$$ u(x,t)=\frac12\begin{cases}
1 & x \leq 1-t \\
1 & x \geq -1-t \\
0 & x > 1-t \\
0 & x < -1-t \\
\end{cases}+
\frac12\begin{cases}
1 & x \leq 1+t \\
1 & x \geq -1+t \\
0 & x > 1+t \\
0 & x < -1+t \\
\end{cases}$$
We have to consider several regions limited by
$x=1-t \quad;\quad x=1+t \quad;\quad x=-1-t \quad;\quad x=-1+t\quad$
For $\quad \boxed{0<t<1}$ :
Case $\quad x>1+t \:: \quad u=\frac12(0)+\frac12(0)=0$.
Case $\quad 1-t<x\leq 1+t \: : \quad u=\frac12(0)+\frac12(1)=\frac12$.
Case $\quad -1+t<x\leq 1-t \: : \quad u=\frac12(1)+\frac12(1)=1$.
Case $\quad -1-t\leq x< -1+t \: : \quad u=\frac12(1)+\frac12(0)=\frac12$.
Case $\quad x\leq -1-t \: : \quad u=\frac12(0)+\frac12(0)=0$.
$$u(x,t)=\begin{cases}
0 && x>1+t \\
\frac12 && 1-t<x\leq 1+t \\
1 && -1+t<x\leq 1-t\\
\frac12 && -1-t\leq x< -1+t\\
0 && x\leq -1-t
\end{cases}$$
The above formulas are not valid for $t>1$ which is outside the domain of study specified in the wording of the question.
IN ADDITION :
For $\quad \boxed{t>1}$ :
$$u(x,t)=\begin{cases}
0 && x>1+t \\
\frac12 && -1+t<x\leq 1+t \\
0 && 1-t<x\leq -1+t\\
\frac12 && -1-t\leq x< 1-t\\
0 && x\leq -1-t
\end{cases}$$
Best Answer
The general solution to the homogeneous wave function $u_{tt}-c^2u_{xx}=0$ is
$$u(x,t)=f(x-ct)+g(x+ct)$$
Applying the initial condition $u(x,0)=A(x)$ reveals that
$$f(x)+g(x)=A(x) \tag 1$$
Applying the initial condition $u_t(x,0)=B(x)$ reveals that
$$-cf'(x)+cg'(x)=B(x) \tag 2$$
Now, we differentiate $(1)$ to obtain
$$f'(x)+g'(x)=A'(x) \tag 3$$
Solving $(2)$ and $(3)$ simultaneously for $f'$ and $g'$ yields
$$f'(x)=\frac{cA'(x)-B(x)}{2c}$$
$$g'(x)=\frac{cA'(x)+B(x)}{2c}$$
If we impose that $g=0$, then we must have $B(x)=-cA'(x)$. Then,
$$f(x)=A(x)$$
and
$$u(x,t)=A(x-ct)$$
where the initial conditions are $u(x,0)=A(x)$ and $u_t(x,0)=B(x) = -cA'(x)$.
Approaching the problem using D'Alembert's equation, we have
$$u(x,t)=\frac12 (A(x-ct)+A(x+ct))+\frac{1}{2c}\int_{x-ct}^{0}B(u)du+\frac{1}{2c}\int_{0}^{x+ct}B(u)du$$
Then, for a solution with right-going waves only, we must enforce
$$\frac12 A(x+ct)+\frac{1}{2c}\int_{0}^{x+ct}B(u)du=0 \tag 4$$
Differentiating $(4)$ yields
$$\frac{c}{2} A'(x+ct)+\frac12 B(x+ct)=0 \Rightarrow B(x+ct)=-cA'(x+ct)$$
Finally,
$$u(x,t)=\frac12 A(x-ct)-\frac{1}{2}\int_{x-ct}^{0}A'(u)du=A(x-ct)$$
where we tacitly assume that $A(0)=0$.