28 lines
443 B
OCaml
28 lines
443 B
OCaml
|
|
type dir =
|
||
|
|
| Left
|
||
|
|
| Right
|
||
|
|
| Down
|
||
|
|
| Up
|
||
|
|
|
||
|
|
type background =
|
||
|
|
| Grass
|
||
|
|
| Water
|
||
|
|
| Black
|
||
|
|
|
||
|
|
type t = background array array
|
||
|
|
|
||
|
|
let width = 1000
|
||
|
|
|
||
|
|
let height = 1000
|
||
|
|
|
||
|
|
let player_pos = ref (20, 3)
|
||
|
|
|
||
|
|
let player_dir = ref Down
|
||
|
|
|
||
|
|
let init () =
|
||
|
|
Array.init width (fun _x ->
|
||
|
|
Array.init height (fun _y ->
|
||
|
|
if Random.int 1000 <= 42 then Water else Grass ) )
|
||
|
|
|
||
|
|
let get_tile_kind ~x ~y map = try map.(x).(y) with Invalid_argument _ -> Black
|