ex3b.erl

ex3b.erl — Erlang source code, 407 bytes

Continguts del fitxer

-module(ex3b).
-export([start/0, proxy/2,bucle_proxy/1]).

start() ->  spawn(?MODULE, proxy, [8, b8]).

proxy(N,Nom)->%N es la mida total
  B = spawn(ex3b,bucle_proxy,[Nom]),
  register(bot8,bots:nou(N,B)).

bucle_proxy(Nom)->
  receive
    {clicked,Pis} ->
	  {control, node2@TONIF}!{Nom,clicked,Pis},
	  bucle_proxy(Nom);
	
	abort ->
	  {control, node2@TONIF}!{Nom,abort},
	  ok
  end.