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