フィルターのクリア

How to create a equally distributed batting order for little league baseball team

2 ビュー (過去 30 日間)
I am trying to create a batting order for my little league team. I have 10 players. I am trying to create a batting order for the ten games where everyone will bat from 1 to 10 in the order. I have one solution where I just move everyone down one spot from the order in the first game, but I am trying to find a way to do this where the kids are not always following the same kids. Mixing it up where they are following different people.

採用された回答

James Tursa
James Tursa 2021 年 11 月 6 日
編集済み: James Tursa 2021 年 11 月 7 日
Start with a simple pattern that works, and then randperm both the rows and columns. E.g.,
B = zeros(10);
for k=1:10 % start with a simple pattern that works
B(k,:) = mod(k-1:k+8,10) + 1;
end
B = B(randperm(10),randperm(10)); % permute the rows and columns
Sample run:
>> batting_order
>> B
B =
4 6 2 10 7 3 8 5 9 1
3 5 1 9 6 2 7 4 8 10
10 2 8 6 3 9 4 1 5 7
6 8 4 2 9 5 10 7 1 3
5 7 3 1 8 4 9 6 10 2
7 9 5 3 10 6 1 8 2 4
2 4 10 8 5 1 6 3 7 9
1 3 9 7 4 10 5 2 6 8
8 10 6 4 1 7 2 9 3 5
9 1 7 5 2 8 3 10 4 6

その他の回答 (2 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 11 月 5 日
Use randperm() to generate the orders, e.g.:
ORDER = randperm(10,10)
ORDER = 1×10
3 5 2 6 4 1 8 9 10 7
  1 件のコメント
Jason Burke
Jason Burke 2021 年 11 月 5 日
Thanks, but I do not see how I can use randperm 10 times and get a distribution where each number is in spots 1 to 10 only once.

サインインしてコメントする。


Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 11 月 5 日
編集済み: Sulaymon Eshkabilov 2021 年 11 月 5 日
Here is how it can be generated for 10 times within a loop:
for ii=1:10
A(ii,:) =randperm(10, 10);
end
  1 件のコメント
Jason Burke
Jason Burke 2021 年 11 月 5 日
編集済み: Jason Burke 2021 年 11 月 5 日
I understand how to run the function 10 times, but I am looking to find a way that each number 1 to 10 lands in each order only once.
I am looking to not get something like below
1, 3, 5, 7, 9, 2, 4, 6, 8, 10
2, 1, 5, 3, 6, 7, 4, 10, 9, 8
I am trying to find a way so each number (1 to 10) lands in each spot (first to tenth) only once.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeVideo games についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by