変換テーブル使えばルールの変更に柔軟に対応できる

int map[8] = { 0, 1, 1, 1, 1, 0, 0, 0 };

now[i] = map[prev[i + 1] | prev[i] << 1 | prev[i - 1] << 2];