moved chess engine declaration before where it is used