paryz17

AI Ants Task1

Nov 17th, 2019
642
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clear all;
  2.  
  3. N=1000;
  4. R(1)=0;
  5. L(1)=0;
  6. k=20;
  7. d=2;
  8.  
  9. for m=1:(N)
  10.     r=unifrnd(0,1);
  11.     Pr(m)=(((R(m)+k)^d)/(((R(m)+k)^d)+((L(m)+k)^d)));
  12.     Pl(m)=1-Pr(m);
  13.     if Pr(m)>=r
  14.     R(m+1)=R(m)+1;
  15.     L(m+1)=L(m);
  16.     else
  17.     R(m+1)=R(m);
  18.     L(m+1)=L(m)+1;
  19.     end
  20. end
  21. disp('L')
  22. disp(L(N+1))
  23. disp('R')
  24. disp(R(N+1))
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×