class AutoPlayer : Player { @Attribute var instructions = "" @Attribute var mustFinish = true @Attribute var shouldDie = false override fun begin() { autoInstructions = instructions val tester = PlayDirector.instance.tester if ( mustFinish ) { tester.testsPending ++ actor.color.set( 1.0, 0.0, 0.3, 1.0 ) } if ( shouldDie ) { tester.testsPending ++ } super.begin() } override fun end() { PlayDirector.instance.tester.testsPending -- super.end() } override fun myTurn() { if (autoInstructions != "") { autoPlay() } else { if (mustFinish) { mustFinish = false PlayDirector.instance.tester.testsPending -- } actor.color.set( 1.0,1.0,1.0,0.3 ) replaceAction( null ) } } fun passes() : boolean { return mustFinish || ! shouldDie } }