scoreV1.2 (length is worth more)
This commit is contained in:
parent
6311c15d25
commit
110c20764b
2
csts.ml
2
csts.ml
|
@ -30,7 +30,7 @@ let calc_length = ref 3 ;;
|
|||
let time_to_ans = ref 10 ;;
|
||||
let total_time = ref 60 ;;
|
||||
let n_inf = ref 1 ;;
|
||||
let n_sup = ref 10 ;;
|
||||
let n_sup = ref 100 ;;
|
||||
|
||||
let time_to_ans_f = ref 10.0 ;;
|
||||
let total_time_f = ref 60.0 ;;
|
||||
|
|
BIN
drawing.cmi
BIN
drawing.cmi
Binary file not shown.
BIN
drawing.cmx
BIN
drawing.cmx
Binary file not shown.
10
maeth.ml
10
maeth.ml
|
@ -81,21 +81,21 @@ let int_of_bool = function
|
|||
|
||||
let fm_length (fm : operation) (size : int) =
|
||||
let rec aux = function
|
||||
| Val _ -> size*11/7
|
||||
| Val k -> size*11/7*(1 + Math.ln_b 10 k)
|
||||
| Exp(f, k) -> size*11/7 (* not implemented*)
|
||||
| Sum(f, g)
|
||||
| Diff(f, g)
|
||||
| Prod(f, g) ->
|
||||
size*11/7 + (int_of_bool (require_bracket f) + int_of_bool (require_bracket g))*size/2 + aux f + aux g
|
||||
size*10/7 + (int_of_bool (require_bracket f) + int_of_bool (require_bracket g))*(size/2+12) + aux f + aux g
|
||||
(* sign + brackets + recursive calls *)
|
||||
in aux fm ;;
|
||||
|
||||
let print_calc (f : operation) (x0 : int) (y0 : int) (size : int) =
|
||||
set_line_width 3 ;
|
||||
let fmlen = fm_length f size in
|
||||
let x = ref (x0 - fmlen/2) in
|
||||
let x = ref (x0) in
|
||||
set_color (rgb 192 192 0) ;
|
||||
fill_rect (x0 - fmlen/2 - 6) (y0 - size - 6) (fmlen+12) (2*size + 12) ;
|
||||
fill_rect (x0 -6) (y0 - size - 6) (fmlen+12) (2*size + 12) ;
|
||||
set_color black ;
|
||||
let rec aux = function
|
||||
| Val k ->
|
||||
|
@ -217,7 +217,7 @@ let maeth_main () =
|
|||
clear_graph () ;
|
||||
|
||||
set_color black ;
|
||||
print_calc equ (Csts.__width__/2) (Csts.__height__/2) 15 ;
|
||||
print_calc equ (10) (Csts.__height__/2) 15 ;
|
||||
|
||||
Drawing.draw_string_centered (Csts.__width__/2) (Csts.__height__/3) "Answer" 50 ;
|
||||
Drawing.draw_integer (Csts.__width__/2) (Csts.__height__/3 - 100) !Csts.ans 75 ;
|
||||
|
|
2
main.ml
2
main.ml
|
@ -22,7 +22,7 @@ let rec mainloop () =
|
|||
Csts.max_score :=
|
||||
100
|
||||
* !Csts.difficulty
|
||||
* !Csts.calc_length * int_of_float (Float.sqrt (float_of_int !Csts.calc_length))
|
||||
* (Math.pw !Csts.calc_length 3)
|
||||
* (90 / !Csts.time_to_ans) * int_of_float (Float.sqrt (float_of_int (90 / !Csts.time_to_ans))) ;
|
||||
Maeth.init_odds () ;
|
||||
clear_graph () ;
|
||||
|
|
6
menus.ml
6
menus.ml
|
@ -372,9 +372,9 @@ build_button "Exit" {x = Csts.__width__/2 - 150; y = 50; w = 300; h = 100}
|
|||
|
||||
build_button "Minimum" {x = Csts.__width__/2 - 200; y = 710; w = 400; h = 100} 255 128 32 (Tweak (build_tweak Csts.n_inf 1 1000 1 [] [Csts.n_sup])) ;;
|
||||
build_button "Maximum" {x = Csts.__width__/2 - 200; y = 600; w = 400; h = 100} 128 255 32 (Tweak (build_tweak Csts.n_sup 1 1000 1 [Csts.n_inf] [])) ;;
|
||||
build_button "Length" {x = Csts.__width__/2 - 200; y = 490; w = 400; h = 100} 255 32 32 (Tweak (build_tweak Csts.calc_length 2 20 1 [] [])) ;;
|
||||
build_button "Answer time" {x = Csts.__width__/2 - 200; y = 380; w = 400; h = 100} 32 192 32 (Tweak (build_tweak Csts.time_to_ans 3 30 1 [] [])) ;;
|
||||
build_button "Total time" {x = Csts.__width__/2 - 200; y = 270; w = 400; h = 100} 32 255 32 (Tweak (build_tweak Csts.total_time 15 600 1 [] [])) ;;
|
||||
build_button "Length" {x = Csts.__width__/2 - 200; y = 490; w = 400; h = 100} 255 32 32 (Tweak (build_tweak Csts.calc_length 2 12 1 [] [])) ;;
|
||||
build_button "Answer time" {x = Csts.__width__/2 - 200; y = 380; w = 400; h = 100} 32 192 32 (Tweak (build_tweak Csts.time_to_ans 3 60 1 [] [])) ;;
|
||||
build_button "Total time" {x = Csts.__width__/2 - 200; y = 270; w = 400; h = 100} 32 255 32 (Tweak (build_tweak Csts.total_time 15 3600 1 [] [])) ;;
|
||||
build_button "Difficulty" {x = Csts.__width__/2 - 200; y = 160; w = 400; h = 100} 32 32 255 (Tweak (build_tweak Csts.difficulty 1 10 1 [] [])) ;;
|
||||
build_button "Back" {x = Csts.__width__/2 - 200; y = 50; w = 400; h = 100} 32 32 32 (Warp 0) ;;
|
||||
|
||||
|
|
Loading…
Reference in New Issue