Buy Brownie Points
Forumwarz is the first "Massively Single-Player" online RPG completely built around Internet culture.

You are currently looking at Flamebate, our community forums. Players can discuss the game here, strategize, and role play as their characters.

You need to be logged in to post and to see the uncensored versions of these forums.

Log in or Learn about Forumwarz

Role Playing
Switch to Civil Discussion Role-Playing

Viewing a Post

Vorheart

Avatar: Hacker Man w/ Goggles

Level 23 Hacker

“Mafiaboy”

function sensor_node_simulation()

node_number = 1000;

time_frames = 10000;

lambda = 0.12;

rand(‘twister’, sum(100*clock));

x_lim = [-100 100];

y_lim = [-100 100];

r_lim = [0 100];

phi_lim = [0 360];

node_distribution = ‘xy’;

switch node_distribution

case ‘xy’

x = rand(1,node_number).*(x_lim(2)-x_lim(1)) + x_lim(1);

y = rand(1,node_number).*(y_lim(2)-y_lim(1)) + y_lim(1);

case ‘rphi’

r = rand(1,node_number).*(r_lim(2)-r_lim(1)) + r_lim(1);

phi = rand(1,node_number).*(phi_lim(2)-phi_lim(1)) + phi_lim(1);

[x,y] = pol2cart(phi,r);

end

for i = 1:node_number

node_field(i) = struct(‘x’,x(i),’y’,y(i),’state’,’idle’,’contest_wait’,1,’brxss’,-90,’txpower’,0,’rxs’,-70,’event_chance’,0.001,’sleep_chance’,0,’wakeup_chance’,0,’received’,0,’backoff’,0,’packet_data’,[],’prev_backoff_level’,0,’batcap’,10000,’battery’,10000);

end

for i = 1:node_number

linkage = {};

link_num = 0;

for j = 1:node_number

if i ~=j

dist = ((node_field(i).x – node_field(j).x).^2 + (node_field(i).y – node_field(j).y).^2).^0.5;

pathloss = 20.*log10((lambda./4./pi./dist));

if -pathloss < (node_field(i).txpower – node_field(j).rxs)

link_num = link_num + 1;

linkage{link_num}= {j, pathloss};

end

end

end

node_field(i).link_num = link_num;

node_field(i).links = linkage;

end

node_display_r = [0 0;

0.25 0.25;

0.5 0.5;

0.75 0.75;

1 1;

1 1;

1 1;

1 1;

1 1;

0.75 0.75];

node_display_g = [1 1;

1 1;

1 1;

1 1;

1 1;

1 1;

0.75 0.75;

0.5 0.5;

0.25 0.25;

0 0];

node_display_b = zeros(10,2);

node_display = cat(3,node_display_r,node_display_g,node_display_b);

cf = figure(‘Units’,’pixels’,’Position’,[200 50 625 625]);

ca = axes(‘Parent’,cf,’Position’,[0 0 1 1]);

link_map = ones(625);

display_map(node_number,node_field,x_lim,y_lim,node_display,link_map,cf,ca);

drawnow;

scaling_factor = 3;

for time_slot = 1:time_frames

[node_field,link_map] = node_event_check_full(node_field,node_number,x_lim,y_lim,scaling_factor,link_map);

if rem(time_slot,25) == 1

display_map(node_number,node_field,x_lim,y_lim,node_display,link_map,cf,ca);

drawnow;

end

end

Internet Delay Chat
Have fun playing!
To chat with other players, you must Join Forumwarz or Log In now!