Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* The while loop represents the game. *)
- (* Each iteration represents a turn of the game *)
- (* where you are given inputs (the heights of the mountains) *)
- (* and where you have to print an output (the index of the mountain to fire on) *)
- (* The inputs you are given are automatically updated according to your last actions. *)
- open System
- let maxM = 8
- let mutable index_highest_mountain = 0
- let mutable max_highest_mounter = 0
- (* game loop *)
- while true do
- for i in 0 .. maxM - 1 do
- let mountainH = int(Console.In.ReadLine()) (* represents the height of one mountain. *)
- if max_highest_mounter < mountainH then
- max_highest_mounter <- mountainH
- index_highest_mountain <- i
- printfn "%d" index_highest_mountain // L'indice de la montagne à viser.
- max_highest_mounter <- 0
- index_highest_mountain <- 0
- ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement