Advertisement
Guest User

Untitled

a guest
Oct 20th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.52 KB | None | 0 0
  1. let mov_pos b =
  2.     match b with
  3.     [] -> []
  4.     | (h::t) ->
  5.         let board_size = find_board_size(b) in
  6.         let pos = index(b, 0) in
  7.         let real_pos = pos mod board_size in
  8.         let narr = if real_pos > 0 then get_val(b, pos-1)::narr else narr in
  9.         let narr =  if real_pos < board_size-1 then get_val(b, pos+1)::narr else narr in
  10.         let narr =  if pos > board_size-1 then get_val(b, pos-board_size)::narr else narr in
  11.         if pos < board_size*2 then get_val(b, pos+board_size)::narr else narr
  12. ;;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement