Beispiel #1
0
func Tracef(format string, a ...interface{}) {
	codingame.Printf("%s", fmt.Sprintf(format, a...))
}
Beispiel #2
0
// static

func RunStaticProgram(input, output string, trace bool, main ProgramMain) {
	codingame.RunAndValidateManualProgram(input, output, trace, codingame.ProgramMain(main))
}

func RunStaticPrograms(input, output []string, trace bool, main ProgramMain) {
	codingame.RunAndValidateManualPrograms(input, output, trace, codingame.ProgramMain(main))
}

// interactive

type levelMissingFunction func(string)

var ErrorUnknownLevel levelMissingFunction = func(level string) {
	codingame.Printf("Error: The \"%s\" level is unkown and can not be excecuted. Please try again...\n", level)
}

var ErrorLevelMissing levelMissingFunction = func(level string) {
	codingame.Printf("Error: The \"%s\" level is not yet supported. Please try again later or implement it yourself @ GitHub...\n", level)
}

func RunInteractiveProgram(programType, input string, trace bool, initialize UserInitializeFunction, update UserUpdateFunction) {
	userInit := codingame.UserInitializeFunction(initialize)
	userUpdate := codingame.UserUpdateFunction(update)

	switch programType {
	default:
		ErrorUnknownLevel(programType)

	case PT_RAGNAROK: