Skip to content

Instantly share code, notes, and snippets.

@Sephi-Chan
Created July 18, 2012 18:32
Show Gist options
  • Save Sephi-Chan/3137942 to your computer and use it in GitHub Desktop.
Save Sephi-Chan/3137942 to your computer and use it in GitHub Desktop.
-module(sector).
-export([ start/0, loop/1 ]).
-record(ship, { x, y }).
start() ->
io:format("Hello world!~n"),
Ship = #ship{ x = 1, y = 2 },
OtherShip = #ship{ x = 2, y = 2 },
Ships = [ Ship, OtherShip ],
spawn(?MODULE, loop, [ Ships ]).
loop(Ships) ->
io:format("Args ~w ~n", [ Ships ]),
receive
{ PlayerPid, move, { X, Y } } ->
io:format("Move command.~n"),
loop(Ships);
_ ->
io:format("Other.~n"),
loop(Ships)
end.
-module(player).
-export([ start/1, loop/1 ]).
start(Name) ->
spawn(?MODULE, loop, [ Name ]).
loop(Argz) ->
io:format("Loop argz ~w. ~n", [ Argz ]),
receive
_ ->
io:format("Other.~n"),
loop(Argz)
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment