added accuracy to display
This commit is contained in:
parent
110c20764b
commit
5483b1e6a4
1
csts.ml
1
csts.ml
|
@ -47,5 +47,6 @@ and minus_ch = ref 8
|
|||
and prod_ch = ref 2 ;;
|
||||
|
||||
let ans = ref 0 ;;
|
||||
let n_ans = ref 0 ;;
|
||||
|
||||
let max_score = ref 1000 ;;
|
BIN
drawing.cmi
BIN
drawing.cmi
Binary file not shown.
BIN
drawing.cmx
BIN
drawing.cmx
Binary file not shown.
BIN
dynamic.cmx
BIN
dynamic.cmx
Binary file not shown.
22
maeth.ml
22
maeth.ml
|
@ -247,6 +247,7 @@ let maeth_main () =
|
|||
cur := Unix.gettimeofday () ;
|
||||
done ;
|
||||
Csts.ans := 0 ;
|
||||
incr Csts.n_ans ;
|
||||
if (!cur -. !Csts.start_0) > !Csts.total_time_f then
|
||||
true
|
||||
else if !found then begin
|
||||
|
@ -276,24 +277,29 @@ let result_screen () =
|
|||
Drawing.draw_string_centered (Csts.__width__/2) (Csts.__height__ - 60) "Press space to return to main" 22 ;
|
||||
|
||||
set_color (rgb 192 192 0) ;
|
||||
Drawing.draw_string (Csts.__width__/6) (Csts.__height__/2 + 70) "Score" 20 ;
|
||||
Drawing.draw_string (Csts.__width__/6) (Csts.__height__/2 + 140) "Score" 20 ;
|
||||
set_color (rgb 255 255 0) ;
|
||||
Drawing.draw_integer_alignedleft (Csts.__width__/6+20*(5+1)*10/7) (Csts.__height__/2 + 70) !Csts.score 20 ;
|
||||
Drawing.draw_integer_alignedleft (Csts.__width__/6+20*(5+1)*10/7) (Csts.__height__/2 + 140) !Csts.score 20 ;
|
||||
|
||||
set_color (rgb 0 192 0) ;
|
||||
Drawing.draw_string (Csts.__width__/6) (Csts.__height__/2) "Max Combo" 20 ;
|
||||
Drawing.draw_string (Csts.__width__/6) (Csts.__height__/2 + 70) "Max Combo" 20 ;
|
||||
set_color (rgb 0 255 0) ;
|
||||
Drawing.draw_integer_alignedleft (Csts.__width__/6+20*(9+1)*10/7) (Csts.__height__/2) !Csts.max_combo 20 ;
|
||||
Drawing.draw_integer_alignedleft (Csts.__width__/6+20*(9+1)*10/7) (Csts.__height__/2 + 70) !Csts.max_combo 20 ;
|
||||
|
||||
set_color (rgb 0 192 32) ;
|
||||
Drawing.draw_string (Csts.__width__/6) (Csts.__height__/2 - 70) "Combo" 20 ;
|
||||
Drawing.draw_string (Csts.__width__/6) (Csts.__height__/2) "Combo" 20 ;
|
||||
set_color (rgb 0 255 32) ;
|
||||
Drawing.draw_integer_alignedleft (Csts.__width__/6+20*(5+1)*10/7) (Csts.__height__/2 - 70) !Csts.combo 20 ;
|
||||
Drawing.draw_integer_alignedleft (Csts.__width__/6+20*(5+1)*10/7) (Csts.__height__/2) !Csts.combo 20 ;
|
||||
|
||||
set_color (rgb 192 0 0) ;
|
||||
Drawing.draw_string (Csts.__width__/6) (Csts.__height__/2 - 140) "Misses" 20 ;
|
||||
Drawing.draw_string (Csts.__width__/6) (Csts.__height__/2 - 70) "Misses" 20 ;
|
||||
set_color (rgb 255 0 0) ;
|
||||
Drawing.draw_integer_alignedleft (Csts.__width__/6+20*(6+1)*10/7) (Csts.__height__/2 - 140) !Csts.misses 20 ;
|
||||
Drawing.draw_integer_alignedleft (Csts.__width__/6+20*(6+1)*10/7) (Csts.__height__/2 - 70) !Csts.misses 20 ;
|
||||
|
||||
set_color (rgb 0 0 192) ;
|
||||
Drawing.draw_string (Csts.__width__/6) (Csts.__height__/2 - 140) "Accuracy" 20 ;
|
||||
set_color (rgb 0 0 192) ;
|
||||
Drawing.draw_integer_alignedleft (Csts.__width__/6+20*(8+1)*10/7) (Csts.__height__/2 - 140) (int_of_float (1000. *. (float_of_int (!Csts.n_ans - !Csts.misses)) /. (float_of_int !Csts.n_ans))) 20 ;
|
||||
|
||||
if !Csts.misses = 0 then begin
|
||||
set_color (rgb 0 255 0) ;
|
||||
|
|
1
main.ml
1
main.ml
|
@ -19,6 +19,7 @@ let rec mainloop () =
|
|||
Csts.time_to_ans_f := float_of_int (!Csts.time_to_ans) ;
|
||||
Csts.total_time_f := float_of_int (!Csts.total_time) ;
|
||||
Csts.start_0 := Unix.gettimeofday () ;
|
||||
Csts.n_ans := 0 ;
|
||||
Csts.max_score :=
|
||||
100
|
||||
* !Csts.difficulty
|
||||
|
|
Loading…
Reference in New Issue