Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec matrix81 l =
- let getMatrixValueAt row col m =
- List.nth (List.nth m (row-1)) (col-1) in
- let incrementMatrix row col m =
- let updatedRow = insertAt (1+getMatrixValueAt row col m) (col-1) ( removeAt (col-1) (List.nth m (row-1)) ) in
- insertAt updatedRow (row-1) ( removeAt (row-1) m) in
- match l with
- |[] ->[[0;0;0;0;0;0;0;0;0];
- [0;0;0;0;0;0;0;0;0];
- [0;0;0;0;0;0;0;0;0];
- [0;0;0;0;0;0;0;0;0];
- [0;0;0;0;0;0;0;0;0];
- [0;0;0;0;0;0;0;0;0];
- [0;0;0;0;0;0;0;0;0];
- [0;0;0;0;0;0;0;0;0];
- [0;0;0;0;0;0;0;0;0]]
- |x::xs -> let r = int_of_float (x.difficulty *. 2.0 -.1.0) in
- let c = int_of_float (x.terrain *. 2.0 -.1.0) in
- incrementMatrix r c (matrix81 xs)
- ;;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement