Finalized code for training Euphoria Agent