master
iotcat 5 years ago
parent ad0a9750ed
commit 32c947e6a7
  1. 21
      func/getDisProb.asv
  2. 10
      func/getDivByPos.asv
  3. 13
      func/isGoalKept.asv
  4. 4
      func/uniform_5case.asv
  5. 3
      t2.m
  6. 26
      tree.js

@ -1,21 +0,0 @@
% compute distributation
function [score, totalTimes, prs, d_rx, d_bo] = getDisProb(R, N, Radius, Length, Width, isPlot, disMethod, goalkeepMethod)
score = 0;
totalTimes = 0;
for m = 1 : R
for n = 1 : N
[x, y] = disMethod(Radius);
totalTimes = totalTimes + 1;
if isInRect(Length/2, Width/2, x, y) && (nargin<8 || isGoalKept())
score = score + 1;
if isPlot
d_rx = plot(x, y, 'rx');
end
else
if isPlot
d_bo = plot(x, y, 'bo');
end
end
end
prs = score / totalTimes;
end

@ -1,10 +0,0 @@
function res = getDivByPos(Length, Width, x, y)
res = 0;
ux=Length/4;
uy=Width/2;
x = x + Length/2;
y = y + Width/2;
px = ceil(x/ux);
end

@ -1,13 +0,0 @@
function res = isGoalKept(Length, Width, x, y, goalkeepMethod)
div = getDivByPos(Length, Width, x, y);
act = goalkeepMethod();
pattern = [2, 3, 6, 7; ];
res = false;
% case 1
if act == 1 &&
end

@ -1,4 +0,0 @@
function res = uniform_5case()
end

@ -16,7 +16,8 @@ R = input("Repeating Times: ");
drawBackGround(Radius, Width, Length);
% calculate prs
[score, totalTimes, prs, d_rx, d_bo] = getDisProb(R, N, Radius, Length, Width, true, @unifrnd_circle);
[score, totalTimes, prs, d_rx, d_bo] = getDisProb(R, N, Radius, Length,...
Width, true, @unifrnd_circle);
% add legend
legend([d_rx, d_bo], {'scored shot', 'missed shot'});

@ -0,0 +1,26 @@
src
|
|---main code
| |---t2.m
| |---t4.m
| |---t5.m
| |---t7_2.m
| |---t7_4.m
| |---t7_5.m
| |---t8.m
| |---t9.m
| |---t10_8.m
| |---t10_9.m
|
|
|---func
| |---drawBackGround.m
| |---getDisProb.m
| |---getDivByPos.m
| |---isGoalKept.m
| |---isInRect.m
| |---normrnd_circle.m
| |---uniform_5case.m
| |---uniform_5case_plus.m
| |---unifrnd_circle.m
|
Loading…
Cancel
Save