REM Analyse RedMixer Score File - WTN 3/1/09 REM REM This program reads a score file of a RedMixer soup produced by REM the TEST benchmark program and writes to a file the number of members, REM average score, maximum score and warrior name(s), then dumps an ascii REM picture of the soup using increasingly dense ascii characters to REM indicate relative warrior scores using the sequence .-:~+%@$& REM to indicate scores from 15 to 149, scores over 150 marked with #, REM scores under 15 a space. REM Prompts for TEST score filename, just enter to exit. REM After reading prompts for analysis filename, just enter for console. REM If an error occurs prompts to try again. REM Lines in the score file must be in the form of "nnn.nn yy_xx.red" REM where nnn.nn is the score and yy_xx.red is the positional filename, REM limited to a maximum of 46x77 and minimum of 10x10 warriors. REM DIM ws%(46, 77) tryagain: xmax = 0: ymax = 0: scorescale = 150 scorediv = (scorescale / 300) * 30 LINE INPUT "TEST score filename: "; test$ test$ = LTRIM$(RTRIM$(test$)) IF test$ = "" THEN GOTO endprogram n = 0: accscore = 0: maxscore = 0: maxscorename$ = "" ON ERROR GOTO badfile OPEN test$ FOR INPUT AS #1 WHILE NOT EOF(1) LINE INPUT #1, a$ n = n + 1 score = VAL(LEFT$(a$, 6)) name$ = MID$(a$, 9, 9) yloc = VAL(LEFT$(name$, 2)) xloc = VAL(MID$(name$, 4, 2)) IF xloc > xmax THEN xmax = xloc IF yloc > ymax THEN ymax = yloc ws%(yloc, xloc) = INT(score / scorediv) IF score = maxscore THEN maxscorename$ = maxscorename$ + " " + name$ IF score > maxscore THEN maxscore = score: maxscorename$ = name$ accscore = accscore + score WEND CLOSE #1 IF n = 0 THEN PRINT "No scores" ELSE LINE INPUT "Score analysis filename: "; report$ report$ = LTRIM$(RTRIM$(report$)) IF report$ = "" THEN report$ = "CON" OPEN report$ FOR OUTPUT AS #3 avgscore = accscore / n PRINT #3, "Number of members ="; n PRINT #3, "Average score ="; avgscore PRINT #3, "Maximum score ="; maxscore; " by "; maxscorename$ PRINT #3, "Soup score distribution... (.-:~+%@$& = 15-149, # = 150+)" PRINT #3, "."; : FOR i = 1 TO xmax: PRINT #3, "-"; : NEXT i: PRINT #3, "." FOR y = 1 TO ymax PRINT #3, "|"; FOR x = 1 TO xmax s = ws%(y, x) IF s < 1 THEN PRINT #3, " "; IF s = 1 THEN PRINT #3, "."; IF s = 2 THEN PRINT #3, "-"; IF s = 3 THEN PRINT #3, ":"; IF s = 4 THEN PRINT #3, "~"; IF s = 5 THEN PRINT #3, "+"; IF s = 6 THEN PRINT #3, "%"; IF s = 7 THEN PRINT #3, "@"; IF s = 8 THEN PRINT #3, "$"; IF s = 9 THEN PRINT #3, "&"; IF s > 9 THEN PRINT #3, "#"; NEXT x PRINT #3, "|" NEXT y PRINT #3, "`"; : FOR i = 1 TO xmax: PRINT #3, "-"; : NEXT i: PRINT #3, "'" CLOSE #3 END IF GOTO endprogram badfile: RESUME badfile1 badfile1: CLOSE : PRINT "Error. Try again? "; LINE INPUT a$: a$ = LEFT$(LTRIM$(UCASE$(a$)), 1) IF a$ = "Y" THEN GOTO tryagain endprogram: SYSTEM