% ag_server4.erl - (Silver) Adventure Game Server -module(ag_server4). -author('Alan G. Labouseur'). %-------- % Public %-------- -export([gameLoop/0, rpc/2]). rpc(ToPid, Request) -> ToPid ! {self(), Request}, receive {ToPid, Response} -> Response % This waits for a response from ToPid. end. gameLoop() -> receive { FromPid, {0, L} } -> FromPid ! {self(), io:format("You are standing west of a house. Inventory: ~w.~n", [L])}, gameLoop(); { FromPid, {1, L} } -> FromPid ! {self(), io:format("You have come to the base of a large tree. Inventory: ~w.~n", [L])}, gameLoop(); { FromPid, {_, L} } -> FromPid ! {self(), io:format("You are lost in unknown locale. Good going, Indiana. Perhaps one of these items will help:~w.~n", [L])}, gameLoop() end.