# L-16 MCS 507 Wed 27 Sep 2023 : pexpect_interactive_game.py

"""
This script spawns the oracle and lets the user play nteractively.
"""

print('spawning the oracle ...\n')
import pexpect
CHILD = pexpect.spawn('/usr/bin/env python game_oracle_number.py')
# search the stream for the prompt
CHILD.expect(': ')
# print all data in the stream before the prompt
print(CHILD.before.decode(), end='')
# print the data that was matched
print(CHILD.after.decode(), end = ''),
# give control to interactive user
try:
    CHILD.interact()
except:
    print('Child exited, game over.')
print('\nBye, script ends.')
