Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Post top tier code

Name: Anonymous 2014-07-22 13:29

Can be yours or not, I just want to see something good.

Name: Anonymous 2014-07-29 11:40

function [tblNode, tblPath, mapx] = initGraph(map, m2, node)

moveset = [1,0; 0,-1; -1,0; 0,1];

n = size(node,1);

p = sum(node(:,3)) / 2;

pcount=1;

tblNode = zeros(n, 6);

tblPath = zeros(p, 3);

mapx = map; %% .- (m2>0);

for(iterN = 1:n)

nodeXY = node(iterN, 1:2);

mapx(nodeXY(1), nodeXY(2)) = 0;

for(iterP = 1:4)

pid = 0;

cyx = nodeXY .+ moveset(iterP, :);

if(mapx(cyx(1), cyx(2)) > 1)

pid = mapx(cyx(1), cyx(2)) - 1;

nids = tblPath(pid, [1,2]);

nid = nids(nids!=iterN)

endif;


if(mapx(cyx(1), cyx(2)) == 1)

pid = pcount;

pcount += 1;

[mapx, dC, nid] = scanGraph(mapx, m2, cyx, pid);

tblPath(pid,:) = [iterN, nid, dC];

tblPath(pid,:)

endif;

tblNode(iterN, iterP) = pid;

endfor;

tblNode(iterN, [5,6]) = node(iterN, [1,2]);

tblNode(iterN,:)

mapx(nodeXY(1), nodeXY(2)) = 1;

endfor;

endfunction;

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List