mirror of
https://github.com/furyfire/trueskill.git
synced 2025-07-11 06:22:07 +02:00
22 lines
616 B
PHP
22 lines
616 B
PHP
![]() |
<?php namespace Moserware\Skills\Numerics;
|
||
|
|
||
|
class SquareMatrix extends Matrix
|
||
|
{
|
||
|
public function __construct()
|
||
|
{
|
||
|
$allValues = func_get_args();
|
||
|
$rows = (int)sqrt(count($allValues));
|
||
|
$cols = $rows;
|
||
|
|
||
|
$matrixData = array();
|
||
|
$allValuesIndex = 0;
|
||
|
|
||
|
for ($currentRow = 0; $currentRow < $rows; $currentRow++) {
|
||
|
for ($currentColumn = 0; $currentColumn < $cols; $currentColumn++) {
|
||
|
$matrixData[$currentRow][$currentColumn] = $allValues[$allValuesIndex++];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
parent::__construct($rows, $cols, $matrixData);
|
||
|
}
|
||
|
}
|