mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-12-21 20:06:05 +01:00
Merge branch 'develop'
This commit is contained in:
commit
c35180271e
7
.gitattributes
vendored
7
.gitattributes
vendored
@ -1,7 +0,0 @@
|
||||
# *.php diff=php
|
||||
|
||||
#/.gitattributes export-ignore
|
||||
#/.gitignore export-ignore
|
||||
#/.php_cs export-ignore
|
||||
#/.travis.ini export-ignore
|
||||
#/.travis.yml export-ignore
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
/bin/
|
||||
!/bin/.gitkeep
|
||||
/build/
|
||||
/vendor/
|
||||
composer.lock
|
||||
@ -5,7 +7,8 @@ composer.lock
|
||||
/.php_cs.cache
|
||||
/nbproject/
|
||||
/res/protected/
|
||||
/.idea
|
||||
/.idea/*.*
|
||||
!/.idea/codeStyles/*
|
||||
/doc/api/*
|
||||
|
||||
/libpairtwo-*-dist.zip
|
||||
@ -13,3 +16,5 @@ composer.lock
|
||||
/dist/vendor/
|
||||
/dist/composer.json
|
||||
/dist/doc/
|
||||
|
||||
/.phpdoc
|
||||
|
134
.idea/codeStyles/Project.xml
generated
Normal file
134
.idea/codeStyles/Project.xml
generated
Normal file
@ -0,0 +1,134 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<PHPCodeStyleSettings>
|
||||
<option name="ALIGN_KEY_VALUE_PAIRS" value="true" />
|
||||
<option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" />
|
||||
<option name="ALIGN_PHPDOC_COMMENTS" value="true" />
|
||||
<option name="ALIGN_INLINE_COMMENTS" value="true" />
|
||||
<option name="PHPDOC_BLANK_LINE_BEFORE_TAGS" value="true" />
|
||||
<option name="PHPDOC_BLANK_LINES_AROUND_PARAMETERS" value="true" />
|
||||
<option name="PHPDOC_WRAP_LONG_LINES" value="true" />
|
||||
<option name="BLANK_LINES_BETWEEN_IMPORTS" value="1" />
|
||||
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
|
||||
<option name="LOWER_CASE_NULL_CONST" value="true" />
|
||||
<option name="ELSE_IF_STYLE" value="COMBINE" />
|
||||
<option name="VARIABLE_NAMING_STYLE" value="CAMEL_CASE" />
|
||||
<option name="BLANK_LINES_BEFORE_RETURN_STATEMENT" value="1" />
|
||||
<option name="KEEP_RPAREN_AND_LBRACE_ON_ONE_LINE" value="true" />
|
||||
<option name="BLANK_LINES_AROUND_CONSTANTS" value="1" />
|
||||
<option name="BLANK_LINES_AFTER_OPENING_TAG" value="1" />
|
||||
<option name="KEEP_BLANK_LINES_AFTER_LBRACE" value="0" />
|
||||
<option name="SPACE_BETWEEN_TERNARY_QUEST_AND_COLON" value="true" />
|
||||
<option name="FORCE_SHORT_DECLARATION_ARRAY_STYLE" value="true" />
|
||||
<option name="NEW_LINE_AFTER_PHP_OPENING_TAG" value="true" />
|
||||
<option name="PLACE_PARENS_FOR_CONSTRUCTOR" value="1" />
|
||||
</PHPCodeStyleSettings>
|
||||
<codeStyleSettings language="PHP">
|
||||
<option name="RIGHT_MARGIN" value="120" />
|
||||
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
|
||||
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
||||
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
|
||||
<option name="BLANK_LINES_AFTER_PACKAGE" value="1" />
|
||||
<option name="BLANK_LINES_AROUND_FIELD" value="1" />
|
||||
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
|
||||
<option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" />
|
||||
<option name="SPACE_WITHIN_BRACKETS" value="true" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="5" />
|
||||
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
|
||||
<option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="5" />
|
||||
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
|
||||
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
|
||||
<option name="EXTENDS_LIST_WRAP" value="5" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
|
||||
<option name="PARENTHESES_EXPRESSION_LPAREN_WRAP" value="true" />
|
||||
<option name="PARENTHESES_EXPRESSION_RPAREN_WRAP" value="true" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="MODIFIER_LIST_WRAP" value="true" />
|
||||
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
|
||||
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="5" />
|
||||
<option name="FOR_STATEMENT_LPAREN_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_RPAREN_ON_NEXT_LINE" value="true" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="5" />
|
||||
<option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true" />
|
||||
<option name="ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE" value="true" />
|
||||
<option name="ASSIGNMENT_WRAP" value="5" />
|
||||
<option name="IF_BRACE_FORCE" value="3" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="3" />
|
||||
<option name="WHILE_BRACE_FORCE" value="3" />
|
||||
<option name="FOR_BRACE_FORCE" value="3" />
|
||||
<arrangement>
|
||||
<groups>
|
||||
<group>
|
||||
<type>GETTERS_AND_SETTERS</type>
|
||||
<order>KEEP</order>
|
||||
</group>
|
||||
</groups>
|
||||
<rules>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<CONST>true</CONST>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<FIELD>true</FIELD>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<CONSTRUCTOR>true</CONSTRUCTOR>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<METHOD>true</METHOD>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<TRAIT>true</TRAIT>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<INTERFACE>true</INTERFACE>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<CLASS>true</CLASS>
|
||||
</match>
|
||||
<order>BY_NAME</order>
|
||||
</rule>
|
||||
</section>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
17
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
17
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,17 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PhpCSValidationInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="CODING_STANDARD" value="PSR12" />
|
||||
<option name="EXTENSIONS" value="php,js,css,inc" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PhpCompoundNamespaceDepthInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PhpLongTypeFormInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PhpMissingVisibilityInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PhpModifierOrderInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PhpNewClassMissingParameterListInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PhpSeparateElseIfInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PhpTraitsUseListInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PhpVarUsageInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
12
.php_cs
12
.php_cs
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->exclude(['build', 'vendor'])
|
||||
->in(__DIR__);
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setFinder($finder)
|
||||
->setUsingCache(true)
|
||||
->setRules([
|
||||
'@PSR2' => true,
|
||||
]);
|
18
.travis.yml
18
.travis.yml
@ -1,18 +0,0 @@
|
||||
language: php
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- php: 7.2
|
||||
- php: 7.2
|
||||
env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"'
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
|
||||
install:
|
||||
- composer update ${COMPOSER_FLAGS} --no-interaction
|
||||
|
||||
script:
|
||||
- make tests
|
54
Makefile
54
Makefile
@ -6,14 +6,54 @@ VERSION := $(if $(TAG),$(TAG),dev-$(BRANCH))
|
||||
help:
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
tests: ## Executes the test suite
|
||||
vendor/bin/phpunit
|
||||
install-dev: ## Installs the required common devtools
|
||||
@echo "Downloading phpdoc"
|
||||
@wget https://phpdoc.org/phpDocumentor.phar -O bin/phpdoc 2> /dev/null
|
||||
@echo "Downloading phpcs"
|
||||
@wget https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar -O bin/phpcs 2> /dev/null
|
||||
@wget https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar -O bin/phpcbf 2> /dev/null
|
||||
@echo "Adding execution rights on the binaries"
|
||||
@chmod +x bin/phpcs bin/phpcbf bin/phpdoc
|
||||
@echo "Installation of devtools finished"
|
||||
@echo "Please add $(shell echo $(PWD))/bin to your PATH"
|
||||
|
||||
coverage: ## Executes the test suite and creates code coverage reports
|
||||
vendor/bin/phpunit --coverage-html build/coverage
|
||||
docs: ## Generates api-docs
|
||||
phpdoc -d ./src -t ./doc/api
|
||||
|
||||
view-coverage: ## Shows the code coverage report
|
||||
open build/coverage/index.html
|
||||
dist: ## Generates distribution
|
||||
cp dist/composer* res/
|
||||
mv dist/composer-dist.json dist/composer.json
|
||||
sed -i -e "s%//VERSION//%$(VERSION)%g" dist/composer.json
|
||||
cd dist && composer install
|
||||
rm dist/composer.json
|
||||
rm dist/composer.lock
|
||||
mv dist/composer-dist-installed.json dist/composer.json
|
||||
make api
|
||||
mkdir -p dist/doc
|
||||
cp -r doc/api dist/doc
|
||||
cd dist && zip -r ../libpairtwo-$(VERSION)-dist.zip *
|
||||
git reset --hard HEAD
|
||||
mv res/composer* dist/
|
||||
|
||||
clean: clean-dist clean-dev clean-repo ## Cleans all assets
|
||||
|
||||
clean-dev: ## Cleans dev assets
|
||||
rm -rf doc/api
|
||||
rm -rf .idea
|
||||
rm -rf .libpairtwo-distro
|
||||
rm -rf vendor
|
||||
rm -rf composer.lock
|
||||
|
||||
clean-dist: ## Cleans distribution assets
|
||||
rm -rf dist/doc
|
||||
rm -rf dist/vendor
|
||||
rm -rf dist/composer.json
|
||||
rm -rf libpairtwo-*-dist.zip
|
||||
|
||||
clean-repo: ## Cleans the git repository
|
||||
git fsck
|
||||
git prune
|
||||
git gc
|
||||
|
||||
api: ## Generates api-docs
|
||||
phpdoc -d ./src -t ./doc/api
|
||||
@ -54,7 +94,7 @@ clean-repo: ## Cleans the git repository
|
||||
git gc
|
||||
|
||||
cs: ## Fixes coding standard problems
|
||||
vendor/bin/php-cs-fixer fix || true
|
||||
php bin/phpcs || true
|
||||
|
||||
tag: ## Creates a new signed git tag
|
||||
$(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=X.X.X"))
|
||||
|
@ -1,6 +1,6 @@
|
||||
# libpairtwo
|
||||
|
||||
![logo](https://raw.githubusercontent.com/JeroenED/libpairtwo/master/res/logo-lightback-250px.png "Logo libpairtwo")
|
||||
![logo](https://raw.githubusercontent.com/JeroenED/libpairtwo/develop/res/logo-lightback-250px.png "Logo libpairtwo")
|
||||
|
||||
Copyright 2018- (c) Jeroen De Meerleer <schaak@jeroened.be>
|
||||
|
||||
|
0
bin/.gitkeep
Normal file
0
bin/.gitkeep
Normal file
@ -2,7 +2,10 @@
|
||||
"name": "jeroened/libpairtwo",
|
||||
"type": "library",
|
||||
"description": "Export chess tournaments directly on the web",
|
||||
"keywords": ["chess", "pairing"],
|
||||
"keywords": [
|
||||
"chess",
|
||||
"pairing"
|
||||
],
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"authors": [
|
||||
{
|
||||
@ -18,7 +21,6 @@
|
||||
"ext-iconv": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^2.16"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
2
dist/composer-dist.json
vendored
2
dist/composer-dist.json
vendored
@ -5,7 +5,7 @@
|
||||
"url": "../"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"require": {
|
||||
"jeroened/libpairtwo": "//VERSION//"
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
|
59
dist/template.php
vendored
59
dist/template.php
vendored
@ -27,7 +27,10 @@ use JeroenED\Libpairtwo\IOFactory;
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
if (!file_exists($pairingfile)) {
|
||||
trigger_error('Your file is not set or doesn\'t exist! Edit the file: ' . __FILE__ . ' and try again', E_USER_ERROR);
|
||||
trigger_error(
|
||||
'Your file is not set or doesn\'t exist! Edit the file: ' . __FILE__ . ' and try again',
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
$reader = IOFactory::createReader($fileformat);
|
||||
@ -49,8 +52,18 @@ foreach ($reader->Tournament->Rounds as $round) {
|
||||
foreach ($round->GamesByBoard as $game) {
|
||||
echo '<tr>' . PHP_EOL;
|
||||
echo '<td>' . ($game->Board + 1) . '</td>' . PHP_EOL;
|
||||
echo '<td>' . $game->White->Player->Name . '</td>' . PHP_EOL;
|
||||
echo '<td>' . $game->Black->Player->Name . '</td>' . PHP_EOL;
|
||||
echo '<td>' .
|
||||
$game->White->Player->Name .
|
||||
' (' .
|
||||
$game->White->Player->getElo($reader->Tournament->PriorityElo) .
|
||||
')</td>' .
|
||||
PHP_EOL;
|
||||
echo '<td>' .
|
||||
$game->Black->Player->Name .
|
||||
' (' .
|
||||
$game->Black->Player->getElo($reader->Tournament->PriorityElo) .
|
||||
')</td>' .
|
||||
PHP_EOL;
|
||||
echo '<td>' . $game->Result->getValue() . '</td>' . PHP_EOL;
|
||||
echo '</tr>' . PHP_EOL;
|
||||
}
|
||||
@ -73,11 +86,11 @@ foreach ($reader->Tournament->Rounds as $round) {
|
||||
echo '</p>' . PHP_EOL;
|
||||
}
|
||||
|
||||
echo '<h2>Rankings</h2>' . PHP_EOL;
|
||||
echo '<h2>Global Rankings</h2>' . PHP_EOL;
|
||||
echo '<table>' . PHP_EOL;
|
||||
echo '<thead>' . PHP_EOL;
|
||||
echo '<tr><th> </th><th>Name (elo)</th>' . PHP_EOL;
|
||||
foreach ($reader->Tournament->TieBreaks as $tiebreak) {
|
||||
echo '<tr><th> </th><th>Name (elo)</th><th>Category</th>' . PHP_EOL;
|
||||
foreach ($reader->Tournament->Tiebreaks as $tiebreak) {
|
||||
echo '<th>' . $tiebreak->getValue() . '</th>' . PHP_EOL;
|
||||
}
|
||||
echo '</tr>' . PHP_EOL;
|
||||
@ -88,7 +101,8 @@ $rank = 1;
|
||||
foreach ($reader->Tournament->Ranking as $player) {
|
||||
echo '<tr>' . PHP_EOL;
|
||||
echo '<td>' . $rank . '</td>' . PHP_EOL;
|
||||
echo '<td>' . $player->Name . '(' . $player->getElo($reader->Tournament->PriorityElo) . ')</td>' . PHP_EOL;
|
||||
echo '<td>' . $player->Name . ' (' . $player->getElo($reader->Tournament->PriorityElo) . ')</td>' . PHP_EOL;
|
||||
echo '<td>' . $player->Category . '</td>' . PHP_EOL;
|
||||
echo '<td>' . implode('</td><td>', $player->Tiebreaks) . '</td>' . PHP_EOL;
|
||||
echo '</tr>' . PHP_EOL;
|
||||
$rank++;
|
||||
@ -96,6 +110,35 @@ foreach ($reader->Tournament->Ranking as $player) {
|
||||
echo '</tbody>' . PHP_EOL;
|
||||
echo '</table>' . PHP_EOL;
|
||||
?>
|
||||
<script src="js/scripts.js"></script>
|
||||
|
||||
<?php
|
||||
echo '<h2>Rankings per Category</h2>' . PHP_EOL;
|
||||
|
||||
foreach ($reader->Tournament->Categories as $category) {
|
||||
echo '<table>' . PHP_EOL;
|
||||
echo '<caption>' . $category . '</caption>';
|
||||
echo '<thead>' . PHP_EOL;
|
||||
echo '<tr><th> </th><th>Name (elo)</th>' . PHP_EOL;
|
||||
foreach ($reader->Tournament->Tiebreaks as $tiebreak) {
|
||||
echo '<th>' . $tiebreak->getValue() . '</th>' . PHP_EOL;
|
||||
}
|
||||
echo '</tr>' . PHP_EOL;
|
||||
echo '</thead>' . PHP_EOL;
|
||||
echo '<tbody>' . PHP_EOL;
|
||||
|
||||
$rank = 1;
|
||||
foreach ($reader->Tournament->RankingForCategory($category) as $player) {
|
||||
echo '<tr>' . PHP_EOL;
|
||||
echo '<td>' . $rank . '</td>' . PHP_EOL;
|
||||
echo '<td>' . $player->Name . ' (' . $player->getElo($reader->Tournament->PriorityElo) . ')</td>' . PHP_EOL;
|
||||
echo '<td>' . implode('</td><td>', $player->Tiebreaks) . '</td>' . PHP_EOL;
|
||||
echo '</tr>' . PHP_EOL;
|
||||
$rank++;
|
||||
}
|
||||
echo '</tbody>' . PHP_EOL;
|
||||
echo '</table>' . PHP_EOL;
|
||||
}
|
||||
?>
|
||||
<script src="js/scripts.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/7.0/phpunit.xsd"
|
||||
colors="true">
|
||||
<testsuites>
|
||||
<testsuite name="Test Suite">
|
||||
<directory>./tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">./src</directory>
|
||||
<exclude>
|
||||
<directory>./tests</directory>
|
||||
<directory>./vendor</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
BIN
res/categories_test.sws
Normal file
BIN
res/categories_test.sws
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 46 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 46 KiB |
445
res/testsws.html
445
res/testsws.html
@ -1,215 +1,340 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<style type="text/css">
|
||||
body { font-size: 10pt; font-family: verdana;}
|
||||
h1 {background-color: navy;color: #FDE0AA;font-size: 24pt;font-weight:bold;font-family:Arial;text-align:center;}
|
||||
th {background-color: #408080; font-size: 20pt; text-align: center;}
|
||||
.rh {background-color: #408080; font-size: 16pt; text-align: center;}
|
||||
.vh {font-size: 10pt; text-align: center;}
|
||||
.thr {font-size: 10pt; text-align: right}
|
||||
.thl {font-size: 10pt; text-align: left}
|
||||
.thc {font-size: 10pt; text-align: center}
|
||||
.tdr {font-size: 8pt; text-align: right}
|
||||
.tdl {font-size: 8pt; text-align: left}
|
||||
.tdc {font-size: 8pt; text-align: center;}
|
||||
.tdp {font-size: 10pt; font-weight:bold;text-align: center; background-color='yellow'}
|
||||
.tde {font-size: 8pt; font-style:italic;text-align: right; background-color='#ceceff'}
|
||||
table {font-size: 10pt; font-family: Arial}
|
||||
a { text-decoration: none; color: blue;}
|
||||
a:visited { text-decoration: none; color: blue;}
|
||||
a:hover { text-decoration:none ; color: red;}
|
||||
</style>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-size: 10pt;
|
||||
font-family: verdana;
|
||||
}
|
||||
|
||||
<TITLE>Libpairtwo Tournament</TITLE>
|
||||
<META name='DESCRIPTION' content='Classement, Résultats, Appariement, Grille Américaine'>
|
||||
<META name='AUTHOR' content='Georges Marchal'>
|
||||
<META name='KEYWORDS' content='échecs,echecs,chess,jeux,game,belgique,belgium,forum'>
|
||||
<META name='KEYWORDS' content='liège,liege,666,elo,classement,tournoi,interclub'>
|
||||
<META name='KEYWORDS' content='pairtwo, kbsb,frbe,fefb,666'>
|
||||
<META name='ROBOTS' content='INDEX,FOLLOW'>
|
||||
h1 {
|
||||
background-color: navy;
|
||||
color: #FDE0AA;
|
||||
font-size: 24pt;
|
||||
font-weight: bold;
|
||||
font-family: Arial;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #408080;
|
||||
font-size: 20pt;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.rh {
|
||||
background-color: #408080;
|
||||
font-size: 16pt;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.vh {
|
||||
font-size: 10pt;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.thr {
|
||||
font-size: 10pt;
|
||||
text-align: right
|
||||
}
|
||||
|
||||
.thl {
|
||||
font-size: 10pt;
|
||||
text-align: left
|
||||
}
|
||||
|
||||
.thc {
|
||||
font-size: 10pt;
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.tdr {
|
||||
font-size: 8pt;
|
||||
text-align: right
|
||||
}
|
||||
|
||||
.tdl {
|
||||
font-size: 8pt;
|
||||
text-align: left
|
||||
}
|
||||
|
||||
.tdc {
|
||||
font-size: 8pt;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tdp {
|
||||
font-size: 10pt;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
background-color = 'yellow'
|
||||
}
|
||||
|
||||
.tde {
|
||||
font-size: 8pt;
|
||||
font-style: italic;
|
||||
text-align: right;
|
||||
background-color = '#ceceff'
|
||||
}
|
||||
|
||||
table {
|
||||
font-size: 10pt;
|
||||
font-family: Arial
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
text-decoration: none;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<TITLE>Libpairtwo Tournament</TITLE>
|
||||
<META content='Classement, R<>sultats, Appariement, Grille Am<41>ricaine' name='DESCRIPTION'>
|
||||
<META content='Georges Marchal' name='AUTHOR'>
|
||||
<META content='<27>checs,echecs,chess,jeux,game,belgique,belgium,forum' name='KEYWORDS'>
|
||||
<META content='li<6C>ge,liege,666,elo,classement,tournoi,interclub' name='KEYWORDS'>
|
||||
<META content='pairtwo, kbsb,frbe,fefb,666' name='KEYWORDS'>
|
||||
<META content='INDEX,FOLLOW' name='ROBOTS'>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<A name=Top></A>
|
||||
|
||||
<!-- TITRE GENERAL EN BLEU -->
|
||||
<!-- ===================== -->
|
||||
<TABLE width='90%' align='center' bgColor='#000080' border='0'>
|
||||
<TR><TD><H1>Libpairtwo Tournament</H1></TD></TR></TABLE>
|
||||
<TABLE align='center' bgColor='#000080' border='0' width='90%'>
|
||||
<TR>
|
||||
<TD><H1>Libpairtwo Tournament</H1></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<!-- =============== -->
|
||||
<!-- INFO DU TOURNOI -->
|
||||
<!-- =============== --><br>
|
||||
<table align='center' border='1''>
|
||||
<tr><td align='center' valign='middle'><font size='+2'><b>313</b></font></td>
|
||||
<td><TABLE border='1' align='center' style='font-size: 8pt; font-family: verdana;'>
|
||||
<tr><td align='center' bgColor='#000090'><font color='white' size='-1'><b>(©) FRBE 2005</b></font></td>
|
||||
<td align='center' bgColor='#000090'><font color='white' size='-1'><b>PairTwo 6.13 (2015/08/10)</b></font></td></tr>
|
||||
<tr><td><i> Org. : </i></td><td>Libpairtwo Organiser ,Libpairtwo Place ,2019</td></tr>
|
||||
<tr><td><i>Arbit. : </i></td><td>Libpairtwo Organiser</td></tr>
|
||||
<tr><td><i> Tempo : </i></td><td>40c/2h + 1h QPF</td></tr>
|
||||
<tr><td><i>Tie Break</i></td><td>Pts, Mutual Result, Number of Victories, Number of game Black played, Bucholtz Cut 1, SonneBorn-Berger</td></tr>
|
||||
</TABLE>
|
||||
</td>
|
||||
<td align='center' valign='middle'><font size='+2'><b>F.R.B.E.</b></font></td>
|
||||
<table align='center' border='1'
|
||||
'>
|
||||
<tr>
|
||||
<td align='center' valign='middle'><font size='+2'><b>313</b></font></td>
|
||||
<td>
|
||||
<TABLE align='center' border='1' style='font-size: 8pt; font-family: verdana;'>
|
||||
<tr>
|
||||
<td align='center' bgColor='#000090'><font color='white' size='-1'><b>(©) FRBE 2005</b></font></td>
|
||||
<td align='center' bgColor='#000090'><font color='white' size='-1'><b>PairTwo 6.13
|
||||
(2015/08/10)</b></font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><i> Org. : </i></td>
|
||||
<td>Libpairtwo Organiser ,Libpairtwo Place ,2019</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><i>Arbit. : </i></td>
|
||||
<td>Libpairtwo Organiser</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><i> Tempo : </i></td>
|
||||
<td>40c/2h + 1h QPF</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><i>Tie Break</i></td>
|
||||
<td>Pts, Mutual Result, Number of Victories, Number of game Black played, Bucholtz
|
||||
Cut 1, SonneBorn-Berger
|
||||
</td>
|
||||
</tr>
|
||||
</TABLE>
|
||||
</td>
|
||||
<td align='center' valign='middle'><font size='+2'><b>F.R.B.E.</b></font></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- ================== -->
|
||||
<!-- === REFERENCES === -->
|
||||
<!-- ================== -->
|
||||
<br><TABLE align='center' border='3' bgcolor='#ffffdd'>
|
||||
<TR>
|
||||
<TD class='vh'><A HREF='#Round1'>R1</A></TD>
|
||||
<TD class='vh'><A HREF='#Round2'>R2</A></TD>
|
||||
<TD class='vh'><A HREF='#Round3'>R3</A></TD>
|
||||
</TR>
|
||||
<TR><TD class='vh' colspan='3'><A HREF='#Americaine'>American Ranking</A></TD></TR>
|
||||
<br>
|
||||
<TABLE align='center' bgcolor='#ffffdd' border='3'>
|
||||
<TR>
|
||||
<TD class='vh'><A HREF='#Round1'>R1</A></TD>
|
||||
<TD class='vh'><A HREF='#Round2'>R2</A></TD>
|
||||
<TD class='vh'><A HREF='#Round3'>R3</A></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD class='vh' colspan='3'><A HREF='#Americaine'>American Ranking</A></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<br>
|
||||
<DIV ALIGN='CENTER'>
|
||||
<TABLE align='center' bgcolor='#ffffdd' border='1'>
|
||||
<!-- =========================== -->
|
||||
<!-- === DEBUT DU CLASSEMENT === -->
|
||||
<!-- =========================== -->
|
||||
<TR><TH>Ranking after round 3</TH></TR>
|
||||
<TR><TD><PRE>
|
||||
<TABLE align='center' bgcolor='#ffffdd' border='1'>
|
||||
<!-- =========================== -->
|
||||
<!-- === DEBUT DU CLASSEMENT === -->
|
||||
<!-- =========================== -->
|
||||
<TR>
|
||||
<TH>Ranking after round 3</TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><PRE>
|
||||
<b><u>Tit Name Rati F/M Club Cou Pts Res Vic #Bla BC1 S B </u></b>
|
||||
1<b> FM</b> <b>Libpairtwo Player 2 </b> (1802) M Liga Vlaams-Brabant (VSF) BEL <b> 3.0</b>/<i>3 </i> 0.0 0 0 0.0 0.00
|
||||
2<b> *</b> <b>Libpairtwo Player 1 </b> (1801) M Liga Antwerpen (VSF) BEL <b> 1.5</b>/<i>3 </i> 0.0 0 0 0.0 0.00
|
||||
3<b> IM</b> <b>Libpairtwo Player 3 </b> (1803) F Liga West Vlaanderen (VSF) BEL <b> 1.0</b>/<i>2 </i> 0.0 0 0 0.0 0.00
|
||||
4<b> GM</b> <b>Libpairtwo Player 4 </b> (1804) F Liga Oost Vlaanderen (VSF) BEL <b> 0.5</b>/<i>2 </i> 0.0 0 0 0.0 0.00
|
||||
<A href='#Top'>Top of Page</A>
|
||||
</PRE></TD></TR>
|
||||
<TR><TH class='rh'><A NAME='Round1' style='color: black'>Round 1 (01-01-2019)</A></TH></TR>
|
||||
<TR><TD><PRE>
|
||||
</PRE>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TH class='rh'><A NAME='Round1' style='color: black'>Round 1 (01-01-2019)</A></TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><PRE>
|
||||
1 Libpairtwo Player 2 ( 3) <b>1-0 </b>Libpairtwo Player 4 ( 1)
|
||||
2 Libpairtwo Player 3 ( 2) <b>0-1 </b>Libpairtwo Player 1 ( 4)
|
||||
</pre>
|
||||
|
||||
<A HREF="#Top">(Go to Top)</A>
|
||||
</TD>
|
||||
<TR><TH class='rh'><A NAME='Round2' style='color: black'>Round 2 (06-01-2019)</A></TH></TR>
|
||||
<TR><TD><PRE>
|
||||
<A HREF="#Top">(Go to Top)</A>
|
||||
</TD>
|
||||
<TR>
|
||||
<TH class='rh'><A NAME='Round2' style='color: black'>Round 2 (06-01-2019)</A></TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><PRE>
|
||||
1 Libpairtwo Player 1 ( 4) <b>0-1 </b>Libpairtwo Player 2 ( 3)
|
||||
2 Libpairtwo Player 3 ( 2) <font color='red'> Bye</font>
|
||||
Libpairtwo Player 4 ( 1)<font color='red'> Absent </font>
|
||||
</pre>
|
||||
|
||||
<A HREF="#Top">(Go to Top)</A>
|
||||
</TD>
|
||||
<TR><TH class='rh'><A NAME='Round3' style='color: black'>Round 3 (11-01-2019)</A></TH></TR>
|
||||
<TR><TD><PRE>
|
||||
1 Libpairtwo Player 4 ( 1) <b>½-½ </b>Libpairtwo Player 1 ( 4)
|
||||
<A HREF="#Top">(Go to Top)</A>
|
||||
</TD>
|
||||
<TR>
|
||||
<TH class='rh'><A NAME='Round3' style='color: black'>Round 3 (11-01-2019)</A></TH>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD><PRE>
|
||||
1 Libpairtwo Player 4 ( 1) <b><EFBFBD>-<2D> </b>Libpairtwo Player 1 ( 4)
|
||||
2 Libpairtwo Player 2 ( 3) <font color='red'> Bye</font>
|
||||
Libpairtwo Player 3 ( 2)<font color='red'> Absent </font>
|
||||
</pre>
|
||||
|
||||
<A HREF="#Top">(Go to Top)</A>
|
||||
</TD>
|
||||
</table></div>
|
||||
<A HREF="#Top">(Go to Top)</A>
|
||||
</TD>
|
||||
</table>
|
||||
</div>
|
||||
<!-- ================= -->
|
||||
<!-- GRILLE AMERICAINE -->
|
||||
<!-- ================= -->
|
||||
<DIV ALIGN='CENTER'>
|
||||
<TABLE align='center' bgcolor='#ffffdd' border='1'>
|
||||
<TR>
|
||||
<TH colspan='14'>
|
||||
<FONT size='+2'>American Ranking</FONT>
|
||||
<A name=Americaine></A></TH></TR>
|
||||
<TABLE align='center' bgcolor='#ffffdd' border='1'>
|
||||
<TR>
|
||||
<TH colspan='14'>
|
||||
<FONT size='+2'>American Ranking</FONT>
|
||||
<A name=Americaine></A></TH>
|
||||
</TR>
|
||||
|
||||
<TR bgcolor='#cccccc'>
|
||||
<TD class='thr'> </TD>
|
||||
<TD class='thl'><B>Name</B></TD>
|
||||
<TD class='thr'><B>Rating</B></TD>
|
||||
<TD class='thr'><B> Pts</B></TD>
|
||||
<TD class='thr'><B>Perf </B></TD>
|
||||
<TD class='thc'><B>R1</B></TD>
|
||||
<TD class='thc'><B>R2</B></TD>
|
||||
<TD class='thc'><B>R3</B></TD>
|
||||
<TD class='thr'><b><i>Res </i></b></TD>
|
||||
<TD class='thr'><b><i>Vic </i></b></TD>
|
||||
<TD class='thr'><b><i>#Bla</i></b></TD>
|
||||
<TD class='thr'><b><i>BC1 </i></b></TD>
|
||||
<TD class='thr'><b><i>S B </i></b></TD>
|
||||
</tr>
|
||||
<TR bgcolor='#cccccc'>
|
||||
<TD class='thr'> </TD>
|
||||
<TD class='thl'><B>Name</B></TD>
|
||||
<TD class='thr'><B>Rating</B></TD>
|
||||
<TD class='thr'><B> Pts</B></TD>
|
||||
<TD class='thr'><B>Perf </B></TD>
|
||||
<TD class='thc'><B>R1</B></TD>
|
||||
<TD class='thc'><B>R2</B></TD>
|
||||
<TD class='thc'><B>R3</B></TD>
|
||||
<TD class='thr'><b><i>Res </i></b></TD>
|
||||
<TD class='thr'><b><i>Vic </i></b></TD>
|
||||
<TD class='thr'><b><i>#Bla</i></b></TD>
|
||||
<TD class='thr'><b><i>BC1 </i></b></TD>
|
||||
<TD class='thr'><b><i>S B </i></b></TD>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='tdr' bgcolor='#eeeeee'> 1</td>
|
||||
<td class='tdl' bgcolor='#eeeeee'><B>Libpairtwo Player 2 (FM)</B></td>
|
||||
<td class='tdr' bgcolor='#eeeeee'>1802</td>
|
||||
<td class='tdr' bgcolor='#eeeeee'><B>3.0</B></td>
|
||||
<td class='tdr' bgcolor='#eeeeee'><i>2602</i></td>
|
||||
<td class='tdc' bgcolor='#eeeeee'> 4W +</td>
|
||||
<td class='tdc' bgcolor='#eeeeee'> 2B +</td>
|
||||
<td class='tdc' bgcolor='#eeeeee'>bye</td>
|
||||
<td class='tdc' bgcolor='#eeeeee'><i> 0.0</i></td>
|
||||
<td class='tdc' bgcolor='#eeeeee'><i>0</i></td>
|
||||
<td class='tdc' bgcolor='#eeeeee'><i>0</i></td>
|
||||
<td class='tdc' bgcolor='#eeeeee'><i> 0.0</i></td>
|
||||
<td class='tdc' bgcolor='#eeeeee'><i> 0.00</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor='#eeeeee' class='tdr'> 1</td>
|
||||
<td bgcolor='#eeeeee' class='tdl'><B>Libpairtwo Player 2 (FM)</B></td>
|
||||
<td bgcolor='#eeeeee' class='tdr'>1802</td>
|
||||
<td bgcolor='#eeeeee' class='tdr'><B>3.0</B></td>
|
||||
<td bgcolor='#eeeeee' class='tdr'><i>2602</i></td>
|
||||
<td bgcolor='#eeeeee' class='tdc'> 4W +</td>
|
||||
<td bgcolor='#eeeeee' class='tdc'> 2B +</td>
|
||||
<td bgcolor='#eeeeee' class='tdc'>bye</td>
|
||||
<td bgcolor='#eeeeee' class='tdc'><i> 0.0</i></td>
|
||||
<td bgcolor='#eeeeee' class='tdc'><i>0</i></td>
|
||||
<td bgcolor='#eeeeee' class='tdc'><i>0</i></td>
|
||||
<td bgcolor='#eeeeee' class='tdc'><i> 0.0</i></td>
|
||||
<td bgcolor='#eeeeee' class='tdc'><i> 0.00</i></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class='tdr' bgcolor='#cccccc'> 2</td>
|
||||
<td class='tdl' bgcolor='#cccccc'><B>Libpairtwo Player 1 (*)</B></td>
|
||||
<td class='tdr' bgcolor='#cccccc'>1801</td>
|
||||
<td class='tdr' bgcolor='#cccccc'><B>1.5</B></td>
|
||||
<td class='tdr' bgcolor='#cccccc'><i>1810</i></td>
|
||||
<td class='tdc' bgcolor='#cccccc'> 3B +</td>
|
||||
<td class='tdc' bgcolor='#cccccc'> 1W -</td>
|
||||
<td class='tdc' bgcolor='#cccccc'> 4B =</td>
|
||||
<td class='tdc' bgcolor='#cccccc'><i> 0.0</i></td>
|
||||
<td class='tdc' bgcolor='#cccccc'><i>0</i></td>
|
||||
<td class='tdc' bgcolor='#cccccc'><i>0</i></td>
|
||||
<td class='tdc' bgcolor='#cccccc'><i> 0.0</i></td>
|
||||
<td class='tdc' bgcolor='#cccccc'><i> 0.00</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor='#cccccc' class='tdr'> 2</td>
|
||||
<td bgcolor='#cccccc' class='tdl'><B>Libpairtwo Player 1 (*)</B></td>
|
||||
<td bgcolor='#cccccc' class='tdr'>1801</td>
|
||||
<td bgcolor='#cccccc' class='tdr'><B>1.5</B></td>
|
||||
<td bgcolor='#cccccc' class='tdr'><i>1810</i></td>
|
||||
<td bgcolor='#cccccc' class='tdc'> 3B +</td>
|
||||
<td bgcolor='#cccccc' class='tdc'> 1W -</td>
|
||||
<td bgcolor='#cccccc' class='tdc'> 4B =</td>
|
||||
<td bgcolor='#cccccc' class='tdc'><i> 0.0</i></td>
|
||||
<td bgcolor='#cccccc' class='tdc'><i>0</i></td>
|
||||
<td bgcolor='#cccccc' class='tdc'><i>0</i></td>
|
||||
<td bgcolor='#cccccc' class='tdc'><i> 0.0</i></td>
|
||||
<td bgcolor='#cccccc' class='tdc'><i> 0.00</i></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class='tdr' bgcolor='#eeeeee'> 3</td>
|
||||
<td class='tdl' bgcolor='#eeeeee'><B>Libpairtwo Player 3 (IM)</B></td>
|
||||
<td class='tdr' bgcolor='#eeeeee'>1803</td>
|
||||
<td class='tdr' bgcolor='#eeeeee'><B>1.0</B></td>
|
||||
<td class='tdr' bgcolor='#eeeeee'><i>1331</i></td>
|
||||
<td class='tdc' bgcolor='#eeeeee'> 2W -</td>
|
||||
<td class='tdc' bgcolor='#eeeeee'>bye</td>
|
||||
<td class='tdc' bgcolor='#eeeeee'>...</td>
|
||||
<td class='tdc' bgcolor='#eeeeee'><i> 0.0</i></td>
|
||||
<td class='tdc' bgcolor='#eeeeee'><i>0</i></td>
|
||||
<td class='tdc' bgcolor='#eeeeee'><i>0</i></td>
|
||||
<td class='tdc' bgcolor='#eeeeee'><i> 0.0</i></td>
|
||||
<td class='tdc' bgcolor='#eeeeee'><i> 0.00</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor='#eeeeee' class='tdr'> 3</td>
|
||||
<td bgcolor='#eeeeee' class='tdl'><B>Libpairtwo Player 3 (IM)</B></td>
|
||||
<td bgcolor='#eeeeee' class='tdr'>1803</td>
|
||||
<td bgcolor='#eeeeee' class='tdr'><B>1.0</B></td>
|
||||
<td bgcolor='#eeeeee' class='tdr'><i>1331</i></td>
|
||||
<td bgcolor='#eeeeee' class='tdc'> 2W -</td>
|
||||
<td bgcolor='#eeeeee' class='tdc'>bye</td>
|
||||
<td bgcolor='#eeeeee' class='tdc'>...</td>
|
||||
<td bgcolor='#eeeeee' class='tdc'><i> 0.0</i></td>
|
||||
<td bgcolor='#eeeeee' class='tdc'><i>0</i></td>
|
||||
<td bgcolor='#eeeeee' class='tdc'><i>0</i></td>
|
||||
<td bgcolor='#eeeeee' class='tdc'><i> 0.0</i></td>
|
||||
<td bgcolor='#eeeeee' class='tdc'><i> 0.00</i></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class='tdr' bgcolor='#cccccc'> 4</td>
|
||||
<td class='tdl' bgcolor='#cccccc'><B>Libpairtwo Player 4 (GM)</B></td>
|
||||
<td class='tdr' bgcolor='#cccccc'>1804</td>
|
||||
<td class='tdr' bgcolor='#cccccc'><B>0.5</B></td>
|
||||
<td class='tdr' bgcolor='#cccccc'><i>1626</i></td>
|
||||
<td class='tdc' bgcolor='#cccccc'> 1B -</td>
|
||||
<td class='tdc' bgcolor='#cccccc'>...</td>
|
||||
<td class='tdc' bgcolor='#cccccc'> 2W =</td>
|
||||
<td class='tdc' bgcolor='#cccccc'><i> 0.0</i></td>
|
||||
<td class='tdc' bgcolor='#cccccc'><i>0</i></td>
|
||||
<td class='tdc' bgcolor='#cccccc'><i>0</i></td>
|
||||
<td class='tdc' bgcolor='#cccccc'><i> 0.0</i></td>
|
||||
<td class='tdc' bgcolor='#cccccc'><i> 0.00</i></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor='#cccccc' class='tdr'> 4</td>
|
||||
<td bgcolor='#cccccc' class='tdl'><B>Libpairtwo Player 4 (GM)</B></td>
|
||||
<td bgcolor='#cccccc' class='tdr'>1804</td>
|
||||
<td bgcolor='#cccccc' class='tdr'><B>0.5</B></td>
|
||||
<td bgcolor='#cccccc' class='tdr'><i>1626</i></td>
|
||||
<td bgcolor='#cccccc' class='tdc'> 1B -</td>
|
||||
<td bgcolor='#cccccc' class='tdc'>...</td>
|
||||
<td bgcolor='#cccccc' class='tdc'> 2W =</td>
|
||||
<td bgcolor='#cccccc' class='tdc'><i> 0.0</i></td>
|
||||
<td bgcolor='#cccccc' class='tdc'><i>0</i></td>
|
||||
<td bgcolor='#cccccc' class='tdc'><i>0</i></td>
|
||||
<td bgcolor='#cccccc' class='tdc'><i> 0.0</i></td>
|
||||
<td bgcolor='#cccccc' class='tdc'><i> 0.00</i></td>
|
||||
</tr>
|
||||
|
||||
</TABLE></DIV>
|
||||
</TABLE>
|
||||
</DIV>
|
||||
|
||||
<P align='center'><A href='#Top'><FONT size='-1'>Top of Page</FONT></A>
|
||||
</TABLE>
|
||||
<!-- ========= -->
|
||||
<!-- COPYRIGHT -->
|
||||
<!-- ========= -->
|
||||
<p><TABLE border='0'>
|
||||
<TR><TD align='center' bgColor='#000090'>
|
||||
<FONT color='white' size='-1'><b>(©) FRBE 2005</b></font></TD>
|
||||
<TD align='center' bgColor='#000090'>
|
||||
<FONT color='white' size='-1'><b>PairTwo 6.13 (2015/08/10)</b></font></td></tr>
|
||||
</TD></TR></TABLE></p>
|
||||
</body></html>
|
||||
</TABLE>
|
||||
<!-- ========= -->
|
||||
<!-- COPYRIGHT -->
|
||||
<!-- ========= -->
|
||||
<p>
|
||||
<TABLE border='0'>
|
||||
<TR>
|
||||
<TD align='center' bgColor='#000090'>
|
||||
<FONT color='white' size='-1'><b>(©) FRBE 2005</b></font></TD>
|
||||
<TD align='center' bgColor='#000090'>
|
||||
<FONT color='white' size='-1'><b>PairTwo 6.13 (2015/08/10)</b></font></td>
|
||||
</tr>
|
||||
</TD></TR></TABLE>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class Constants
|
||||
*
|
||||
* Static class for constants
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo;
|
||||
@ -20,18 +21,35 @@ use JeroenED\Libpairtwo\Enums\Result;
|
||||
*
|
||||
* Static class for constants
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Constants
|
||||
{
|
||||
const Won = [ Result::Won, Result::WonForfait, Result::WonBye, Result::WonAdjourned ];
|
||||
const Draw = [ Result::Draw, Result::DrawAdjourned ];
|
||||
const Lost = [ Result::Absent, Result::Bye, Result::Lost, Result::Adjourned ];
|
||||
const NotPlayed = [ Result::Bye, Result::WonBye, Result::Absent ];
|
||||
const Played = [ Result::Won, Result::WonForfait, Result::WonBye, Result::WonAdjourned, Result::Draw, Result::DrawAdjourned, Result::Absent, Result::Bye, Result::Lost, Result::Adjourned ];
|
||||
const Black = [ Color::Black ];
|
||||
const White = [ Color::White ];
|
||||
public const BLACK = [Color::BLACK];
|
||||
|
||||
public const DRAW = [Result::DRAW, Result::DRAW_ADJOURNED];
|
||||
|
||||
public const LOST = [Result::ABSENT, Result::BYE, Result::LOST, Result::ADJOURNED];
|
||||
|
||||
public const NOTPLAYED = [Result::BYE, Result::WON_BYE, Result::ABSENT];
|
||||
|
||||
public const PLAYED = [
|
||||
Result::WON,
|
||||
Result::WON_FORFAIT,
|
||||
Result::WON_BYE,
|
||||
Result::WON_ADJOURNED,
|
||||
Result::DRAW,
|
||||
Result::DRAW_ADJOURNED,
|
||||
Result::ABSENT,
|
||||
Result::BYE,
|
||||
Result::LOST,
|
||||
Result::ADJOURNED
|
||||
];
|
||||
|
||||
public const WHITE = [Color::WHITE];
|
||||
|
||||
public const WON = [Result::WON, Result::WON_FORFAIT, Result::WON_BYE, Result::WON_ADJOURNED];
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Enum Color
|
||||
*
|
||||
* List of all compatible colors
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Enums;
|
||||
@ -19,14 +20,16 @@ use MyCLabs\Enum\Enum;
|
||||
*
|
||||
* List of all compatible colors
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Color extends Enum
|
||||
{
|
||||
const Black = 'B';
|
||||
const White = 'W';
|
||||
const None = '*';
|
||||
public const BLACK = 'B';
|
||||
|
||||
public const NONE = '*';
|
||||
|
||||
public const WHITE = 'W';
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Enum Gameresult
|
||||
*
|
||||
* List of all compatible gameresults
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Enums;
|
||||
@ -19,24 +20,36 @@ use MyCLabs\Enum\Enum;
|
||||
*
|
||||
* List of all compatible gameresults
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Gameresult extends Enum
|
||||
{
|
||||
const None = '-';
|
||||
const WhiteWins = '1-0';
|
||||
const Draw = '0.5-0.5';
|
||||
const BlackWins = '0-1';
|
||||
const WhiteWinsForfait = '1-0 FF';
|
||||
const BlackWinsForfait = '0-1 FF';
|
||||
const BothLoseForfait = '0-0 FF';
|
||||
const BothWinAdjourned = '1-1 A';
|
||||
const WhiteWinsBlackDrawsAdjourned = '1-0.5 A';
|
||||
const WhiteDrawsBlackWinsAdjourned = '0.5-1 A';
|
||||
const DrawAdjourned = '0.5-0.5 A';
|
||||
const WhiteLoseBlackDrawsAdjourned = '0-0.5';
|
||||
const WhiteDrawsBlackLoseAdjourned = '0.5-0';
|
||||
public const BLACK_WINS = '0-1';
|
||||
|
||||
public const BLACK_WINS_FORFAIT = '0-1 FF';
|
||||
|
||||
public const BOTH_LOSE_FORFAIT = '0-0 FF';
|
||||
|
||||
public const BOTH_WIN_ADJOURNED = '1-1 A';
|
||||
|
||||
public const DRAW = '0.5-0.5';
|
||||
|
||||
public const DRAW_ADJOURNED = '0.5-0.5 A';
|
||||
|
||||
public const NONE = '-';
|
||||
|
||||
public const WHITE_DRAWS_BLACK_LOSE_ADJOURNED = '0.5-0';
|
||||
|
||||
public const WHITE_DRAWS_BLACK_WINS_ADJOURNED = '0.5-1 A';
|
||||
|
||||
public const WHITE_LOST_BLACK_DRAWS_ADJOURNED = '0-0.5';
|
||||
|
||||
public const WHITE_WINS = '1-0';
|
||||
|
||||
public const WHITE_WINS_BLACK_DRAWS_ADJOURNED = '1-0.5 A';
|
||||
|
||||
public const WHITE_WINS_FORFAIT = '1-0 FF';
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Enum Gender
|
||||
*
|
||||
* List of all compatible genders
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Enums;
|
||||
@ -19,14 +20,16 @@ use MyCLabs\Enum\Enum;
|
||||
*
|
||||
* List of all compatible genders
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Gender extends Enum
|
||||
{
|
||||
const Neutral = 'X'; // Unforturnately, Incompatible with Pairtwo (Dinos)
|
||||
const Male = 'M';
|
||||
const Female = 'F';
|
||||
public const FEMALE = 'F';
|
||||
|
||||
public const MALE = 'M';
|
||||
|
||||
public const NEUTRAL = 'X'; // Unfortunately, Incompatible with Pairtwo (Dinos)
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Enum Result
|
||||
*
|
||||
* List of all compatible results
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Enums;
|
||||
@ -19,22 +20,32 @@ use MyCLabs\Enum\Enum;
|
||||
*
|
||||
* List of all compatible results
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Result extends Enum
|
||||
{
|
||||
const None = '*';
|
||||
const Lost = '0';
|
||||
const Draw = '0.5';
|
||||
const Won = '1';
|
||||
const Absent = '0 FF';
|
||||
const WonForfait = '1 FF';
|
||||
const Adjourned = '0 A';
|
||||
const DrawAdjourned = '0.5 A';
|
||||
const WonAdjourned = '1 A';
|
||||
const Bye = '0 Bye';
|
||||
const WonBye = '1 Bye';
|
||||
public const ABSENT = '0 FF';
|
||||
|
||||
public const ADJOURNED = '0 A';
|
||||
|
||||
public const BYE = '0 Bye';
|
||||
|
||||
public const DRAW = '0.5';
|
||||
|
||||
public const DRAW_ADJOURNED = '0.5 A';
|
||||
|
||||
public const LOST = '0';
|
||||
|
||||
public const NONE = '*';
|
||||
|
||||
public const WON = '1';
|
||||
|
||||
public const WON_ADJOURNED = '1 A';
|
||||
|
||||
public const WON_BYE = '1 Bye';
|
||||
|
||||
public const WON_FORFAIT = '1 FF';
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Enum Tiebreak
|
||||
*
|
||||
* List of all compatible tiebreaks
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Enums;
|
||||
@ -19,34 +20,56 @@ use MyCLabs\Enum\Enum;
|
||||
*
|
||||
* List of all compatible tiebreaks
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Tiebreak extends Enum
|
||||
{
|
||||
const None = "";
|
||||
const Keizer = "Keizer";
|
||||
const Points = "Points";
|
||||
const Buchholz = "Buchholz";
|
||||
const BuchholzMed = "Buchholz Median";
|
||||
const BuchholzCut = "Buchholz Cut";
|
||||
const BuchholzMed2 = "Buchholz Median 2";
|
||||
const BuchholzCut2 = "Buchholz Cut 2";
|
||||
const Sonneborn = "Sonneborn-Berger";
|
||||
const Kashdan = "Kashdan";
|
||||
const SoccerKashdan = "Soccer Kashdan";
|
||||
const Cumulative = "Cumulative";
|
||||
const Between = "Mutual Result";
|
||||
const Koya = "Koya";
|
||||
const Baumbach = "Most wins"; // Ref: https://en.wikipedia.org/wiki/Tie-breaking_in_Swiss-system_tournaments#Most_wins_(Baumbach) Please tell me why?
|
||||
const AveragePerformance = "Average performance";
|
||||
const Performance = "Performance";
|
||||
const Aro = "Average Rating";
|
||||
const AroCut = "Average Rating Cut";
|
||||
const BlackPlayed = "Black played";
|
||||
const BlackWin = "Black Winned";
|
||||
const Testmatch = "Testmatch";
|
||||
const Drawing = "Drawing of lot";
|
||||
public const ARO = "Average Rating";
|
||||
|
||||
public const AROCUT = "Average Rating Cut";
|
||||
|
||||
public const AVERAGE_PERFORMANCE = "Average performance";
|
||||
|
||||
public const BAUMBACH = "Most wins"; // Ref: https://en.wikipedia.org/wiki/Tie-breaking_in_Swiss-system_tournaments#Most_wins_(Baumbach) Please tell me why?
|
||||
|
||||
public const BETWEEN = "Mutual Result";
|
||||
|
||||
public const BLACK_PLAYED = "Black played";
|
||||
|
||||
public const BLACK_WIN = "Black Winned";
|
||||
|
||||
public const BUCHHOLZ = "Buchholz";
|
||||
|
||||
public const BUCHHOLZ_CUT = "Buchholz Cut";
|
||||
|
||||
public const BUCHHOLZ_CUT_2 = "Buchholz Cut 2";
|
||||
|
||||
public const BUCHHOLZ_MED = "Buchholz Median";
|
||||
|
||||
public const BUCHHOLZ_MED_2 = "Buchholz Median 2";
|
||||
|
||||
public const CUMULATIVE = "Cumulative";
|
||||
|
||||
public const DRAWING_OF_LOT = "Drawing of lot";
|
||||
|
||||
public const KASHDAN = "Kashdan";
|
||||
|
||||
public const KEIZER = "Keizer";
|
||||
|
||||
public const KOYA = "Koya";
|
||||
|
||||
public const NONE = "";
|
||||
|
||||
public const PERFORMANCE = "Performance";
|
||||
|
||||
public const POINTS = "Points";
|
||||
|
||||
public const SOCCER_KASHDAN = "Soccer Kashdan";
|
||||
|
||||
public const SONNEBORN = "Sonneborn-Berger";
|
||||
|
||||
public const TESTMATCH = "Testmatch";
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Enum Title
|
||||
*
|
||||
* List of all compatible titles
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Enums;
|
||||
@ -19,24 +20,36 @@ use MyCLabs\Enum\Enum;
|
||||
*
|
||||
* List of all compatible titles
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Title extends Enum
|
||||
{
|
||||
const NONE = '*';
|
||||
const ELO = 'Elo';
|
||||
const NM = 'National Master';
|
||||
const WCM = 'Woman Candidate Master';
|
||||
const WFM = 'Woman Fide Master';
|
||||
const CM = 'Candidate Master';
|
||||
const WIM = 'Woman International Master';
|
||||
const FM = 'Fide Master';
|
||||
const WGM = 'Woman Grand Master';
|
||||
const HM = 'Honorary International Master';
|
||||
const IM = 'International Master';
|
||||
const HG = 'Honorary Grand Master';
|
||||
const GM = 'Grand Master';
|
||||
public const CM = 'Candidate Master';
|
||||
|
||||
public const ELO = 'Elo';
|
||||
|
||||
public const FM = 'Fide Master';
|
||||
|
||||
public const GM = 'Grand Master';
|
||||
|
||||
public const HG = 'Honorary Grand Master';
|
||||
|
||||
public const HM = 'Honorary International Master';
|
||||
|
||||
public const IM = 'International Master';
|
||||
|
||||
public const NM = 'National Master';
|
||||
|
||||
public const NONE = '*';
|
||||
|
||||
public const WCM = 'Woman Candidate Master';
|
||||
|
||||
public const WFM = 'Woman Fide Master';
|
||||
|
||||
public const WGM = 'Woman Grand Master';
|
||||
|
||||
public const WIM = 'Woman International Master';
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Enum TournamentSystem
|
||||
*
|
||||
* List of all compatible tournament systems
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Enums;
|
||||
@ -19,15 +20,18 @@ use MyCLabs\Enum\Enum;
|
||||
*
|
||||
* List of all compatible tournament systems
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class TournamentSystem extends Enum
|
||||
{
|
||||
const Swiss = 'Swiss';
|
||||
const Closed = 'Closed';
|
||||
const American = 'American';
|
||||
const Keizer = 'Keizer';
|
||||
public const AMERICAN = 'American';
|
||||
|
||||
public const CLOSED = 'Closed';
|
||||
|
||||
public const KEIZER = 'Keizer';
|
||||
|
||||
public const SWISS = 'Swiss';
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Exception IncompatibleReaderException
|
||||
*
|
||||
* Exception to be raised when a reader is used that is incompatible
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Exceptions;
|
||||
@ -17,10 +18,10 @@ namespace JeroenED\Libpairtwo\Exceptions;
|
||||
*
|
||||
* Exception to be raised when a reader is used that is incompatible
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class IncompatibleReaderException extends LibpairtwoException
|
||||
{
|
||||
|
@ -1,27 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Exception LibpairtwoException
|
||||
*
|
||||
* General exception when something goes wrong with libpairtwo
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Exception LibpairtwoException
|
||||
*
|
||||
* General exception when something goes wrong with libpairtwo
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class LibpairtwoException extends \Exception
|
||||
class LibpairtwoException extends Exception
|
||||
{
|
||||
}
|
||||
|
75
src/Game.php
75
src/Game.php
@ -1,54 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class Games
|
||||
*
|
||||
* Class for a game of the tournament
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo;
|
||||
|
||||
use JeroenED\Libpairtwo\Enums\Gameresult;
|
||||
use JeroenED\Libpairtwo\Pairing;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* Class Games
|
||||
*
|
||||
* Class for a game of the tournament
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Game
|
||||
{
|
||||
/**
|
||||
* The pairing for this games as seen from white's side
|
||||
*
|
||||
* @var Pairing | null
|
||||
*/
|
||||
public $White;
|
||||
|
||||
/**
|
||||
* The pairing for this games as seen from blacks's side
|
||||
* The pairing for this games as seen from black's side
|
||||
*
|
||||
* @var Pairing | null
|
||||
*/
|
||||
public $Black;
|
||||
|
||||
/**
|
||||
* The calculated game result
|
||||
*
|
||||
* @var GameResult | null
|
||||
*/
|
||||
private $CalculatedResult;
|
||||
|
||||
/**
|
||||
* The board where this game is held
|
||||
*
|
||||
@ -56,10 +41,26 @@ class Game
|
||||
*/
|
||||
public $Board;
|
||||
|
||||
/**
|
||||
* The calculated game result
|
||||
*
|
||||
* @var GameResult | null
|
||||
*/
|
||||
private $CalculatedResult;
|
||||
|
||||
/**
|
||||
* The pairing for this games as seen from white's side
|
||||
*
|
||||
* @var Pairing | null
|
||||
*/
|
||||
public $White;
|
||||
|
||||
/**
|
||||
* Returns fields that were not directly assigned.
|
||||
* Class Game contains the special field Result containing the result of the game
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return Gameresult
|
||||
*/
|
||||
public function __get(string $key)
|
||||
@ -67,6 +68,7 @@ class Game
|
||||
if ($key == 'Result') {
|
||||
return $this->calculateResult();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -88,20 +90,20 @@ class Game
|
||||
$whitesplit = explode(" ", $whiteResult);
|
||||
$blacksplit = explode(" ", $blackResult);
|
||||
|
||||
$special='';
|
||||
if (isset($whitesplit[1]) && $whitesplit[1] != 'Bye') {
|
||||
$special = ' ' . $whitesplit[1];
|
||||
$special = '';
|
||||
if (isset($whitesplit[ 1 ]) && $whitesplit[ 1 ] != 'Bye') {
|
||||
$special = ' ' . $whitesplit[ 1 ];
|
||||
}
|
||||
if (isset($blacksplit[1]) && $blacksplit[1] != 'Bye') {
|
||||
$special = ' ' . $blacksplit[1];
|
||||
if (isset($blacksplit[ 1 ]) && $blacksplit[ 1 ] != 'Bye') {
|
||||
$special = ' ' . $blacksplit[ 1 ];
|
||||
}
|
||||
if ($whitesplit[0] == '*') {
|
||||
$whitesplit[0] = '';
|
||||
if ($whitesplit[ 0 ] == '*') {
|
||||
$whitesplit[ 0 ] = '';
|
||||
}
|
||||
if ($blacksplit[0] == '*') {
|
||||
$blacksplit[0] = '';
|
||||
if ($blacksplit[ 0 ] == '*') {
|
||||
$blacksplit[ 0 ] = '';
|
||||
}
|
||||
$result = new Gameresult($whitesplit[0] . '-' . $blacksplit[0] . $special);
|
||||
$result = new Gameresult($whitesplit[ 0 ] . '-' . $blacksplit[ 0 ] . $special);
|
||||
$this->CalculatedResult = $result;
|
||||
|
||||
return $result;
|
||||
@ -111,6 +113,7 @@ class Game
|
||||
* Checks if 2 games are equal
|
||||
*
|
||||
* @param Game $game
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function equals(Game $game): bool
|
||||
@ -118,6 +121,6 @@ class Game
|
||||
return (
|
||||
$this->White->Player === $game->White->Player &&
|
||||
$this->Black->Player === $game->Black->Player &&
|
||||
$this->Result == $game->Result);
|
||||
$this->Result->getKey() == $game->Result->getKey());
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class IOFactory
|
||||
*
|
||||
* Class for creating readers for pairing files
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo;
|
||||
|
||||
use JeroenED\LibPairtwo\Exceptions\LibpairtwoException;
|
||||
use JeroenED\Libpairtwo\Interfaces\ReaderInterface;
|
||||
use JeroenED\Libpairtwo\Readers\Pairtwo6;
|
||||
|
||||
/**
|
||||
* Class IOFactory
|
||||
*
|
||||
* Class for creating readers for pairing files
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
abstract class IOFactory
|
||||
{
|
||||
@ -34,31 +34,30 @@ abstract class IOFactory
|
||||
* @var array
|
||||
*/
|
||||
private static $Readers = [
|
||||
'Swar-4' => Readers\Swar4::class,
|
||||
'Swar-4' => Readers\Swar4::class,
|
||||
'Pairtwo-6' => Readers\Pairtwo6::class,
|
||||
'Pairtwo-5' => Readers\Pairtwo6::class // File structure identical
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Creates a reader for $type
|
||||
*
|
||||
* Compatible types are Swar-4, Pairtwo-5, Pairtwo-6
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return ReaderInterface
|
||||
* @throws LibpairtwoException
|
||||
*/
|
||||
public static function createReader(string $type): ReaderInterface
|
||||
{
|
||||
if (!isset(self::$Readers[$type])) {
|
||||
if (!isset(self::$Readers[ $type ])) {
|
||||
throw new LibpairtwoException("Cannot read type $type");
|
||||
}
|
||||
|
||||
// create reader class
|
||||
$readerClass = self::$Readers[$type];
|
||||
$reader = new $readerClass;
|
||||
$readerClass = self::$Readers[ $type ];
|
||||
|
||||
return $reader;
|
||||
return new $readerClass();
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Interface ReaderInterface
|
||||
*
|
||||
* Sets the methods a reader needs to implement
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Interfaces;
|
||||
|
||||
use JeroenED\Libpairtwo\Tournament;
|
||||
|
||||
/**
|
||||
* Interface ReaderInterface
|
||||
*
|
||||
* Sets the methods a reader needs to implement
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
interface ReaderInterface
|
||||
{
|
||||
/**
|
||||
* Reads out $filename
|
||||
*
|
||||
* @param $filename
|
||||
* @return ReaderInterface
|
||||
* @param $filename
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function read(string $filename): void;
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class Pairing
|
||||
*
|
||||
* Class for a pairing of the tournament
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo;
|
||||
@ -20,26 +21,19 @@ use JeroenED\Libpairtwo\Enums\Result;
|
||||
*
|
||||
* Class for a pairing of the tournament
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Pairing
|
||||
{
|
||||
/**
|
||||
* The player of the pairing. Please note this means the pairing was seen from the point of view of this player
|
||||
* The number of the board where the game was held
|
||||
*
|
||||
* @var Player | null
|
||||
* @var int
|
||||
*/
|
||||
public $Player;
|
||||
|
||||
/**
|
||||
* The opponent of player
|
||||
*
|
||||
* @var Player | null
|
||||
*/
|
||||
public $Opponent;
|
||||
public $Board;
|
||||
|
||||
/**
|
||||
* The color of the player.
|
||||
@ -49,8 +43,23 @@ class Pairing
|
||||
*/
|
||||
public $Color;
|
||||
|
||||
/**
|
||||
* The opponent of player
|
||||
*
|
||||
* @var Player | null
|
||||
*/
|
||||
public $Opponent;
|
||||
|
||||
/**
|
||||
* The player of the pairing. Please note this means the pairing was seen from the point of view of this player
|
||||
*
|
||||
* @var Player | null
|
||||
*/
|
||||
public $Player;
|
||||
|
||||
/**
|
||||
* The result of the Game. Possible values contain Won, Lost, Draw, Forfait, Bye, etc.
|
||||
*
|
||||
* @var Result
|
||||
*/
|
||||
public $Result;
|
||||
@ -61,11 +70,4 @@ class Pairing
|
||||
* @var int
|
||||
*/
|
||||
public $Round;
|
||||
|
||||
/**
|
||||
* The number of the board where the game was held
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $Board;
|
||||
}
|
||||
|
461
src/Player.php
461
src/Player.php
@ -1,53 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class Player
|
||||
*
|
||||
* Class for a player of the tournament
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo;
|
||||
|
||||
use DateTime;
|
||||
use JeroenED\Libpairtwo\Enums\Gender;
|
||||
use JeroenED\Libpairtwo\Enums\Title;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* Class Player
|
||||
*
|
||||
* Class for a player of the tournament
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Player
|
||||
{
|
||||
/**
|
||||
* Name of the player
|
||||
* Binary data that was read out of the pairing file
|
||||
*
|
||||
* @var bool|DateTime|int|string[]
|
||||
*/
|
||||
|
||||
private $BinaryData;
|
||||
|
||||
/**
|
||||
* The category the player belongs to
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $Name;
|
||||
|
||||
/**
|
||||
* The player ids for the player. Possible keys are, but not limited to nation and fide
|
||||
*
|
||||
* @var int[]
|
||||
*/
|
||||
public $Ids;
|
||||
|
||||
/**
|
||||
* The Elos for the player. Possible keys are, but not limited to nation and fide
|
||||
*
|
||||
* @var int[]
|
||||
*/
|
||||
public $Elos;
|
||||
public $Category;
|
||||
|
||||
/**
|
||||
* Birthday of the player
|
||||
@ -57,33 +52,11 @@ class Player
|
||||
public $DateOfBirth;
|
||||
|
||||
/**
|
||||
* Tiebreak points of the player. These values are calculated when Tournament->Ranking is called
|
||||
* The Elos for the player. Possible keys are, but not limited to nation and fide
|
||||
*
|
||||
* @var float[]
|
||||
* @var int[]
|
||||
*/
|
||||
public $Tiebreaks = [];
|
||||
|
||||
/**
|
||||
* The nation the player belongs to. Be noted this does not actually mean this is his main nationality. A player can be signed USCF but may be Italian
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $Nation;
|
||||
|
||||
// TODO: Implement categories
|
||||
/**
|
||||
* The category the player belongs to
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $Category;
|
||||
|
||||
/**
|
||||
* The title of the player. Possible values can be GM, IM, IA, etc.
|
||||
*
|
||||
* @var Title
|
||||
*/
|
||||
public $Title;
|
||||
public $Elos;
|
||||
|
||||
/**
|
||||
* The gender of the player. Possible values contain Male, Female and Neutral
|
||||
@ -92,6 +65,30 @@ class Player
|
||||
*/
|
||||
public $Gender;
|
||||
|
||||
/**
|
||||
* The player ids for the player. Possible keys are, but not limited to nation and fide
|
||||
*
|
||||
* @var int[]
|
||||
*/
|
||||
public $Ids;
|
||||
|
||||
// TODO: Implement categories
|
||||
|
||||
/**
|
||||
* Name of the player
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $Name;
|
||||
|
||||
/**
|
||||
* The nation the player belongs to. Be noted this does not actually mean this is his main nationality. A player
|
||||
* can be signed USCF but may be Italian
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $Nation;
|
||||
|
||||
/**
|
||||
* The pairings of the player
|
||||
*
|
||||
@ -100,12 +97,112 @@ class Player
|
||||
public $Pairings = [];
|
||||
|
||||
/**
|
||||
* Binary data that was read out of the pairing file
|
||||
* Tiebreak points of the player. These values are calculated when Tournament->Ranking is called
|
||||
*
|
||||
* @var bool|DateTime|int|string[]
|
||||
* @var float[]
|
||||
*/
|
||||
public $Tiebreaks = [];
|
||||
|
||||
private $BinaryData;
|
||||
/**
|
||||
* The title of the player. Possible values can be GM, IM, IA, etc.
|
||||
*
|
||||
* @var Title
|
||||
*/
|
||||
public $Title;
|
||||
|
||||
/**
|
||||
* Returns the performance rating of the player
|
||||
*
|
||||
* WARNING: Calculation currently incorrect. Uses the rule of 400 as temporary solution
|
||||
*
|
||||
* @param $type
|
||||
* @param $unratedElo
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function Performance(string $type, int $unratedElo): float
|
||||
{
|
||||
$total = 0;
|
||||
$opponents = 0;
|
||||
foreach ($this->Pairings as $pairing) {
|
||||
if (array_search($pairing->Result, Constants::NOTPLAYED) === false) {
|
||||
$opponentElo = $pairing->Opponent->getElo($type);
|
||||
$opponentElo = $opponentElo != 0 ? $opponentElo : $unratedElo;
|
||||
if (array_search($pairing->Result, Constants::WON) !== false) {
|
||||
$total += $opponentElo + 400;
|
||||
} elseif (array_search($pairing->Result, Constants::LOST) !== false) {
|
||||
$total += $opponentElo - 400;
|
||||
} elseif (array_search($pairing->Result, Constants::DRAW) !== false) {
|
||||
$total += $opponentElo;
|
||||
}
|
||||
$opponents++;
|
||||
}
|
||||
}
|
||||
|
||||
return round($total / $opponents);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of Player objects where name matches $search
|
||||
*
|
||||
* @param string $search
|
||||
* @param Tournament $tournament
|
||||
*
|
||||
* @return Player[]
|
||||
*/
|
||||
public static function PlayersByName(string $search, Tournament $tournament): array
|
||||
{
|
||||
/**
|
||||
* @var Player[]
|
||||
*/
|
||||
$players = $tournament->Players;
|
||||
|
||||
/**
|
||||
* @var Player[]
|
||||
*/
|
||||
$return = [];
|
||||
|
||||
foreach ($players as $player) {
|
||||
if (fnmatch($search, $player->Name)) {
|
||||
$return[] = $player;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic method to read out several fields. If field was not found it is being searched in the binary data fields
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool|DateTime|int|string|null
|
||||
*/
|
||||
public function __get(string $key)
|
||||
{
|
||||
if ($key == 'PlayedGames') {
|
||||
return $this->playedGames();
|
||||
} elseif ($key == 'NoOfWins') {
|
||||
return $this->noOfWins();
|
||||
} elseif ($key == 'Opponents') {
|
||||
return $this->opponents();
|
||||
} elseif (isset($this->BinaryData[ $key ])) {
|
||||
return $this->BinaryData[ $key ];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets binary data that is read out the pairing file but is not needed immediately
|
||||
*
|
||||
* @param string $key
|
||||
* @param bool|int|DateTime|string $value
|
||||
*/
|
||||
public function __set(string $key, $value): void
|
||||
{
|
||||
$this->BinaryData[ $key ] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a pairing to the tournament
|
||||
@ -119,97 +216,6 @@ class Player
|
||||
$this->Pairings = $newArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of Player objects where name matches $search
|
||||
*
|
||||
* @param string $search
|
||||
* @param Tournament $tournament
|
||||
* @return Player[]
|
||||
*/
|
||||
public static function PlayersByName(string $search, Tournament $tournament): array
|
||||
{
|
||||
/** @var Player[] */
|
||||
$players = $tournament->Players;
|
||||
|
||||
/** @var Player[] */
|
||||
$return = [];
|
||||
|
||||
foreach ($players as $player) {
|
||||
if (fnmatch($search, $player->Name)) {
|
||||
$return[] = $player;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the elo of elotype for the player
|
||||
* @param string $type
|
||||
* @return int
|
||||
*/
|
||||
public function getElo(string $type): int
|
||||
{
|
||||
return $this->Elos[$type];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the elo of elotype for the player
|
||||
*
|
||||
* @param string $type
|
||||
* @param int $value
|
||||
*/
|
||||
public function setElo(string $type, int $value): void
|
||||
{
|
||||
$currentElos = $this->Elos;
|
||||
$currentElos[$type] = $value;
|
||||
$this->Elos = $currentElos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the identifier of type for the player
|
||||
*
|
||||
* Common possible values are Fide or National
|
||||
*
|
||||
* @param string $type
|
||||
* @return string
|
||||
*/
|
||||
public function getId(string $type): string
|
||||
{
|
||||
return $this->Ids[$type];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the identifier of type for the player
|
||||
*
|
||||
* Common possible values are Fide or National
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $value
|
||||
*/
|
||||
public function setId(string $type, string $value): void
|
||||
{
|
||||
$currentIds = $this->Ids;
|
||||
$currentIds[$type] = $value;
|
||||
$this->Ids = $currentIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of won matches for the player
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function noOfWins(): int
|
||||
{
|
||||
$wins = 0;
|
||||
foreach ($this->Pairings as $pairing) {
|
||||
if (array_search($pairing->Result, Constants::Won) !== false) {
|
||||
$wins++;
|
||||
}
|
||||
}
|
||||
return $wins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the points of the player after round $round
|
||||
*
|
||||
@ -218,39 +224,25 @@ class Player
|
||||
* 0 points are awarded for loss
|
||||
*
|
||||
* @param int $round
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function calculatePoints(int $round = -1): float
|
||||
{
|
||||
$points = 0;
|
||||
foreach ($this->Pairings as $key=>$pairing) {
|
||||
foreach ($this->Pairings as $key => $pairing) {
|
||||
if ($key < $round || $round == -1) {
|
||||
if (array_search($pairing->Result, Constants::Won) !== false) {
|
||||
if (array_search($pairing->Result, Constants::WON) !== false) {
|
||||
$points = $points + 1;
|
||||
} elseif (array_search($pairing->Result, Constants::Draw) !== false) {
|
||||
} elseif (array_search($pairing->Result, Constants::DRAW) !== false) {
|
||||
$points = $points + 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $points;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the points of a virtual player as described in the Fide Handbook C.02 chapter 13.15.2.
|
||||
*
|
||||
* Return the same score for all rounds until $byeround and added with a half point for each subsequent round
|
||||
*
|
||||
* @param int $byeround
|
||||
* @return float
|
||||
*/
|
||||
public function calculatePointsForVirtualPlayer(int $byeround): float
|
||||
{
|
||||
$points = $this->calculatePoints($byeround);
|
||||
foreach (array_slice($this->Pairings, $byeround +1) as $key=>$pairing) {
|
||||
$points += 0.5;
|
||||
}
|
||||
return $points;
|
||||
}
|
||||
/**
|
||||
* Returns the points of the player that should be used for tiebreaking systems.
|
||||
*
|
||||
@ -264,74 +256,75 @@ class Player
|
||||
{
|
||||
$points = 0;
|
||||
foreach ($this->Pairings as $pairing) {
|
||||
if (array_search($pairing->Result, Constants::NotPlayed) !== false) {
|
||||
if (array_search($pairing->Result, Constants::NOTPLAYED) !== false) {
|
||||
$points = $points + 0.5;
|
||||
} elseif (array_search($pairing->Result, Constants::Won) !== false) {
|
||||
} elseif (array_search($pairing->Result, Constants::WON) !== false) {
|
||||
$points = $points + 1;
|
||||
} elseif (array_search($pairing->Result, Constants::Draw) !== false) {
|
||||
} elseif (array_search($pairing->Result, Constants::DRAW) !== false) {
|
||||
$points = $points + 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
return $points;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the performance rating of the player
|
||||
* Returns the points of a virtual player as described in the Fide Handbook C.02 chapter 13.15.2.
|
||||
*
|
||||
* WARNING: Calculation currently incorrect. Uses the rule of 400 as temporary solution
|
||||
* Return the same score for all rounds until $byeround and added with a half point for each subsequent round
|
||||
*
|
||||
* @param $type
|
||||
* @param $unratedElo
|
||||
* @return int
|
||||
* @param int $byeround
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function Performance(string $type, int $unratedElo): float
|
||||
public function calculatePointsForVirtualPlayer(int $byeround): float
|
||||
{
|
||||
$total = 0;
|
||||
$opponents = 0;
|
||||
foreach ($this->Pairings as $pairing) {
|
||||
if (array_search($pairing->Result, Constants::NotPlayed) === false) {
|
||||
$opponentElo = $pairing->Opponent->getElo($type);
|
||||
$opponentElo = $opponentElo != 0 ? $opponentElo : $unratedElo;
|
||||
if (array_search($pairing->Result, Constants::Won) !== false) {
|
||||
$total += $opponentElo + 400;
|
||||
} elseif (array_search($pairing->Result, Constants::Lost) !== false) {
|
||||
$total += $opponentElo - 400;
|
||||
} elseif (array_search($pairing->Result, Constants::Draw) !== false) {
|
||||
$total += $opponentElo;
|
||||
}
|
||||
$opponents++;
|
||||
}
|
||||
$points = $this->calculatePoints($byeround);
|
||||
foreach (array_slice($this->Pairings, $byeround + 1) as $key => $pairing) {
|
||||
$points += 0.5;
|
||||
}
|
||||
return round($total / $opponents);
|
||||
|
||||
return $points;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of played games of the player
|
||||
* Returns the elo of elotype for the player
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function playedGames(): int
|
||||
public function getElo(string $type): int
|
||||
{
|
||||
$total = 0;
|
||||
foreach ($this->Pairings as $pairing) {
|
||||
if (array_search($pairing->Result, Constants::Played) !== false) {
|
||||
$total++;
|
||||
}
|
||||
}
|
||||
return $total;
|
||||
return $this->Elos[ $type ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the identifier of type for the player
|
||||
*
|
||||
* Common possible values are Fide or National
|
||||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId(string $type): string
|
||||
{
|
||||
return $this->Ids[ $type ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if player has played against all players of the array
|
||||
*
|
||||
* @param Player[] $players
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPlayedAllPlayersOfArray(array $players): bool
|
||||
{
|
||||
$ownkey = array_search($this, $players);
|
||||
if ($ownkey !== false) {
|
||||
unset($players[$ownkey]);
|
||||
unset($players[ $ownkey ]);
|
||||
}
|
||||
$total = 0;
|
||||
foreach ($players as $player) {
|
||||
@ -343,6 +336,23 @@ class Player
|
||||
return $total == count($players);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of won matches for the player
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function noOfWins(): int
|
||||
{
|
||||
$wins = 0;
|
||||
foreach ($this->Pairings as $pairing) {
|
||||
if (array_search($pairing->Result, Constants::WON) !== false) {
|
||||
$wins++;
|
||||
}
|
||||
}
|
||||
|
||||
return $wins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all opponents of $this
|
||||
*
|
||||
@ -350,43 +360,58 @@ class Player
|
||||
*/
|
||||
private function opponents()
|
||||
{
|
||||
$return = array();
|
||||
$return = [];
|
||||
foreach ($this->Pairings as $pairing) {
|
||||
if (!empty($pairing->Opponent)) {
|
||||
$return[] = $pairing->Opponent;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic method to read out several fields. If field was not found it is being searched in the binary data fields
|
||||
* Returns the number of played games of the player
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool|DateTime|int|string|null
|
||||
* @return int
|
||||
*/
|
||||
public function __get(string $key)
|
||||
private function playedGames(): int
|
||||
{
|
||||
if ($key == 'PlayedGames') {
|
||||
return $this->playedGames();
|
||||
} elseif ($key == 'NoOfWins') {
|
||||
return $this->noOfWins();
|
||||
} elseif ($key == 'Opponents') {
|
||||
return $this->opponents();
|
||||
} elseif (isset($this->BinaryData[$key])) {
|
||||
return $this->BinaryData[$key];
|
||||
$total = 0;
|
||||
foreach ($this->Pairings as $pairing) {
|
||||
if (array_search($pairing->Result, Constants::PLAYED) !== false) {
|
||||
$total++;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets binary data that is read out the pairing file but is not needed immediately
|
||||
* Sets the elo of elotype for the player
|
||||
*
|
||||
* @param string $key
|
||||
* @param bool|int|DateTime|string $value
|
||||
* @param string $type
|
||||
* @param int $value
|
||||
*/
|
||||
public function __set(string $key, $value): void
|
||||
public function setElo(string $type, int $value): void
|
||||
{
|
||||
$this->BinaryData[$key] = $value;
|
||||
$currentElos = $this->Elos;
|
||||
$currentElos[ $type ] = $value;
|
||||
$this->Elos = $currentElos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the identifier of type for the player
|
||||
*
|
||||
* Common possible values are Fide or National
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $value
|
||||
*/
|
||||
public function setId(string $type, string $value): void
|
||||
{
|
||||
$currentIds = $this->Ids;
|
||||
$currentIds[ $type ] = $value;
|
||||
$this->Ids = $currentIds;
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Reader Pairtwo6
|
||||
*
|
||||
* Reads out Pairtwo-6 and Pairtwo-5 files
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
|
||||
namespace JeroenED\Libpairtwo\Readers;
|
||||
|
||||
use DateTime;
|
||||
use InvalidArgumentException;
|
||||
use JeroenED\Libpairtwo\Enums\Color;
|
||||
use JeroenED\Libpairtwo\Enums\Gender;
|
||||
use JeroenED\Libpairtwo\Enums\Result;
|
||||
@ -25,25 +27,35 @@ use JeroenED\Libpairtwo\Pairing;
|
||||
use JeroenED\Libpairtwo\Player;
|
||||
use JeroenED\Libpairtwo\Round;
|
||||
use JeroenED\Libpairtwo\Tournament;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* Reader Pairtwo6
|
||||
*
|
||||
* Reads out Pairtwo-6 files
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Pairtwo6 implements ReaderInterface
|
||||
{
|
||||
const PT_DAYFACTOR = 32;
|
||||
const PT_MONTHFACTOR = 16;
|
||||
const PT_YEARFACTOR = 512;
|
||||
const PT_PASTOFFSET = 117;
|
||||
const CompatibleVersions = ['6.', '5.'];
|
||||
public const COMPATIBLE_VERSIONS = ['6.', '5.'];
|
||||
|
||||
public const PT_DAYFACTOR = 32;
|
||||
|
||||
public const PT_MONTHFACTOR = 16;
|
||||
|
||||
public const PT_PASTOFFSET = 117;
|
||||
|
||||
public const PT_YEARFACTOR = 512;
|
||||
|
||||
/**
|
||||
* Binary data that was read out of the pairing file
|
||||
*
|
||||
* @var bool|DateTime|int|string[]
|
||||
*/
|
||||
private $BinaryData;
|
||||
|
||||
/**
|
||||
* Version of Pairtwo this file was created with
|
||||
@ -59,41 +71,91 @@ class Pairtwo6 implements ReaderInterface
|
||||
*/
|
||||
public $Tournament;
|
||||
|
||||
/**
|
||||
* Binary data that was read out of the pairing file
|
||||
* @var bool|DateTime|int|string[]
|
||||
*/
|
||||
private $BinaryData;
|
||||
|
||||
/**
|
||||
* Returns binary data that was read out the pairtwo file but was not needed immediately
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool|DateTime|int|string|null
|
||||
*/
|
||||
public function __get(string $key)
|
||||
{
|
||||
if (isset($this->BinaryData[$key])) {
|
||||
return $this->BinaryData[$key];
|
||||
if (isset($this->BinaryData[ $key ])) {
|
||||
return $this->BinaryData[ $key ];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets binary data that is read out the pairtwo file but is not needed immediately
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $key
|
||||
* @param bool|int|DateTime|string $value
|
||||
*/
|
||||
public function __set(string $key, $value): void
|
||||
{
|
||||
$this->BinaryData[$key] = $value;
|
||||
$this->BinaryData[ $key ] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the first tiebreak to the tournament
|
||||
*/
|
||||
private function addTiebreaks(): void
|
||||
{
|
||||
switch ($this->Tournament->System) {
|
||||
case TournamentSystem::KEIZER:
|
||||
$firstElement = new Tiebreak(Tiebreak::KEIZER);
|
||||
break;
|
||||
case TournamentSystem::AMERICAN:
|
||||
case TournamentSystem::CLOSED:
|
||||
case TournamentSystem::SWISS:
|
||||
$firstElement = new Tiebreak(Tiebreak::POINTS);
|
||||
break;
|
||||
}
|
||||
$tiebreaks = $this->Tournament->Tiebreaks;
|
||||
array_unshift($tiebreaks, $firstElement);
|
||||
$this->Tournament->Tiebreaks = $tiebreaks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts integer value to a date representation
|
||||
*
|
||||
* @param int $date
|
||||
*
|
||||
* @return bool|DateTime
|
||||
*/
|
||||
private function convertUIntToTimestamp(int $date)
|
||||
{
|
||||
$curyear = date('Y');
|
||||
$yearoffset = $curyear - self::PT_PASTOFFSET;
|
||||
|
||||
// Day
|
||||
$day = $date % self::PT_DAYFACTOR;
|
||||
if ($day < 1) {
|
||||
$day = 1;
|
||||
}
|
||||
|
||||
// Month
|
||||
$month = ($date / self::PT_DAYFACTOR) % self::PT_MONTHFACTOR;
|
||||
if ($month < 1) {
|
||||
$month = 1;
|
||||
}
|
||||
|
||||
// Year
|
||||
$year = ($date / self::PT_YEARFACTOR) + $yearoffset;
|
||||
|
||||
$concat = $month . '/' . $day . '/' . intval($year);
|
||||
$format = 'm/d/Y';
|
||||
|
||||
return DateTime::createFromFormat($format, $concat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually reads the Swar-File
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @throws IncompatibleReaderException
|
||||
*/
|
||||
public function read(string $filename): void
|
||||
@ -104,12 +166,11 @@ class Pairtwo6 implements ReaderInterface
|
||||
|
||||
$offset = 0;
|
||||
|
||||
|
||||
$length = 4;
|
||||
$this->Release = $this->readData('String', substr($swscontents, $offset, $length));
|
||||
$offset += $length;
|
||||
|
||||
if (array_search(substr($this->Release, 0, 2), self::CompatibleVersions) === false) {
|
||||
if (array_search(substr($this->Release, 0, 2), self::COMPATIBLE_VERSIONS) === false) {
|
||||
throw new IncompatibleReaderException("This file was not created with Pairtwo 5 or higher");
|
||||
}
|
||||
|
||||
@ -261,53 +322,53 @@ class Pairtwo6 implements ReaderInterface
|
||||
$length = 4;
|
||||
switch ($this->readData('Int', substr($swscontents, $offset, $length))) {
|
||||
case 1:
|
||||
$tiebreak = Tiebreak::Buchholz;
|
||||
$tiebreak = Tiebreak::BUCHHOLZ;
|
||||
break;
|
||||
case 2:
|
||||
$tiebreak = Tiebreak::BuchholzMed;
|
||||
$tiebreak = Tiebreak::BUCHHOLZ_MED;
|
||||
break;
|
||||
case 3:
|
||||
$tiebreak = Tiebreak::BuchholzCut;
|
||||
$tiebreak = Tiebreak::BUCHHOLZ_CUT;
|
||||
break;
|
||||
case 4:
|
||||
$tiebreak = Tiebreak::Sonneborn;
|
||||
$tiebreak = Tiebreak::SONNEBORN;
|
||||
break;
|
||||
case 5:
|
||||
$tiebreak = Tiebreak::Kashdan;
|
||||
$tiebreak = Tiebreak::KASHDAN;
|
||||
break;
|
||||
case 6:
|
||||
$tiebreak = Tiebreak::Cumulative;
|
||||
$tiebreak = Tiebreak::CUMULATIVE;
|
||||
break;
|
||||
case 7:
|
||||
$tiebreak = Tiebreak::Between;
|
||||
$tiebreak = Tiebreak::BETWEEN;
|
||||
break;
|
||||
case 8:
|
||||
$tiebreak = Tiebreak::Koya;
|
||||
$tiebreak = Tiebreak::KOYA;
|
||||
break;
|
||||
case 9:
|
||||
$tiebreak = Tiebreak::Baumbach;
|
||||
$tiebreak = Tiebreak::BAUMBACH;
|
||||
break;
|
||||
case 10:
|
||||
$tiebreak = Tiebreak::Performance;
|
||||
$tiebreak = Tiebreak::PERFORMANCE;
|
||||
break;
|
||||
case 11:
|
||||
$tiebreak = Tiebreak::Aro;
|
||||
$tiebreak = Tiebreak::ARO;
|
||||
break;
|
||||
case 12:
|
||||
$tiebreak = Tiebreak::AroCut;
|
||||
$tiebreak = Tiebreak::AROCUT;
|
||||
break;
|
||||
case 13:
|
||||
$tiebreak = Tiebreak::BlackPlayed;
|
||||
$tiebreak = Tiebreak::BLACK_PLAYED;
|
||||
break;
|
||||
case 14:
|
||||
$tiebreak = Tiebreak::Testmatch;
|
||||
$tiebreak = Tiebreak::TESTMATCH;
|
||||
break;
|
||||
case 15:
|
||||
$tiebreak = Tiebreak::Drawing;
|
||||
$tiebreak = Tiebreak::DRAWING_OF_LOT;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
$tiebreak = Tiebreak::None;
|
||||
$tiebreak = Tiebreak::NONE;
|
||||
break;
|
||||
}
|
||||
$this->Tournament->addTieBreak(new Tiebreak($tiebreak));
|
||||
@ -315,9 +376,14 @@ class Pairtwo6 implements ReaderInterface
|
||||
}
|
||||
|
||||
// Categorie
|
||||
$length = 4 * 10;
|
||||
$this->Categorie = $this->readData('Int', substr($swscontents, $offset, $length));
|
||||
$offset += $length;
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$length = 4;
|
||||
$category = $this->readData('Int', substr($swscontents, $offset, $length));
|
||||
if ($category != 0) {
|
||||
$this->Tournament->addCategory('+' . $category);
|
||||
}
|
||||
$offset += $length;
|
||||
}
|
||||
|
||||
// ExtraPoints
|
||||
$length = 4 * 20;
|
||||
@ -395,7 +461,8 @@ class Pairtwo6 implements ReaderInterface
|
||||
$offset += $length;
|
||||
|
||||
$length = 1;
|
||||
$player->Category = $this->readData('String', substr($swscontents, $offset, $length));
|
||||
$player->Category =
|
||||
$this->Tournament->Categories[ $this->readData('Int', substr($swscontents, $offset, $length)) - 1 ];
|
||||
$offset += $length;
|
||||
|
||||
$length = 1;
|
||||
@ -447,13 +514,13 @@ class Pairtwo6 implements ReaderInterface
|
||||
$length = 1;
|
||||
switch ($this->readData('Int', substr($swscontents, $offset, $length))) {
|
||||
case 1:
|
||||
$gender = Gender::Male;
|
||||
$gender = Gender::MALE;
|
||||
break;
|
||||
case 2:
|
||||
$gender = Gender::Female;
|
||||
$gender = Gender::FEMALE;
|
||||
break;
|
||||
default:
|
||||
$gender = Gender::Neutral;
|
||||
$gender = Gender::NEUTRAL;
|
||||
break;
|
||||
}
|
||||
$player->Gender = new Gender($gender);
|
||||
@ -498,12 +565,12 @@ class Pairtwo6 implements ReaderInterface
|
||||
$this->Tournament->addPlayer($player);
|
||||
}
|
||||
// PlayerNames
|
||||
$length = (Integer)$this->NewNamePos + 0;
|
||||
$length = (int)$this->NewNamePos + 0;
|
||||
$this->PlayerNames = substr($swscontents, $offset, $length);
|
||||
$offset += $length;
|
||||
|
||||
for ($i = 0; $i < $this->NewPlayer; $i++) {
|
||||
$player = $this->Tournament->PlayerById($i);
|
||||
$player = $this->Tournament->playerById($i);
|
||||
$namelength = $player->NameLength;
|
||||
$nameoffset = $player->NamePos;
|
||||
$player->Name = $this->readData("String", substr($this->PlayerNames, $nameoffset, $namelength));
|
||||
@ -585,17 +652,17 @@ class Pairtwo6 implements ReaderInterface
|
||||
$length = 4;
|
||||
switch ($this->readData('Int', substr($swscontents, $offset, $length))) {
|
||||
case 2:
|
||||
$system = TournamentSystem::Closed;
|
||||
$system = TournamentSystem::CLOSED;
|
||||
break;
|
||||
case 4:
|
||||
$system = TournamentSystem::American;
|
||||
$system = TournamentSystem::AMERICAN;
|
||||
break;
|
||||
case 6:
|
||||
$system = TournamentSystem::Keizer;
|
||||
$system = TournamentSystem::KEIZER;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
$system = TournamentSystem::Swiss;
|
||||
$system = TournamentSystem::SWISS;
|
||||
break;
|
||||
}
|
||||
$this->Tournament->System = new TournamentSystem($system);
|
||||
@ -651,12 +718,12 @@ class Pairtwo6 implements ReaderInterface
|
||||
for ($x = 0; $x < $this->CreatedRounds; $x++) {
|
||||
$pairing = new Pairing();
|
||||
|
||||
$pairing->Player = $this->Tournament->PlayerById($i);
|
||||
$pairing->Player = $this->Tournament->playerById($i);
|
||||
|
||||
$length = 4;
|
||||
$opponent = $this->readData('Int', substr($swscontents, $offset, $length));
|
||||
if ($opponent != 4294967295) {
|
||||
$pairing->Opponent = $this->Tournament->PlayerById($opponent);
|
||||
$pairing->Opponent = $this->Tournament->playerById($opponent);
|
||||
}
|
||||
$offset += $length;
|
||||
|
||||
@ -665,15 +732,15 @@ class Pairtwo6 implements ReaderInterface
|
||||
switch ($this->readData('Int', substr($swscontents, $offset, $length))) {
|
||||
case 255:
|
||||
case 253:
|
||||
$color = Color::Black;
|
||||
$color = Color::BLACK;
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
$color = Color::White;
|
||||
break;
|
||||
$color = Color::WHITE;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
$color = Color::None;
|
||||
$color = Color::NONE;
|
||||
break;
|
||||
}
|
||||
$pairing->Color = new Color($color);
|
||||
@ -682,38 +749,38 @@ class Pairtwo6 implements ReaderInterface
|
||||
$length = 1;
|
||||
switch ($this->readData('Int', substr($swscontents, $offset, $length))) {
|
||||
case 1:
|
||||
$result = Result::Lost;
|
||||
$result = Result::LOST;
|
||||
break;
|
||||
case 2:
|
||||
$result = Result::Absent;
|
||||
$result = Result::ABSENT;
|
||||
break;
|
||||
case 3:
|
||||
$result = Result::Adjourned;
|
||||
$result = Result::ADJOURNED;
|
||||
break;
|
||||
case 4:
|
||||
$result = Result::Bye;
|
||||
$result = Result::BYE;
|
||||
break;
|
||||
case 6:
|
||||
$result = Result::Draw;
|
||||
$result = Result::DRAW;
|
||||
break;
|
||||
case 8:
|
||||
$result = Result::DrawAdjourned;
|
||||
$result = Result::DRAW_ADJOURNED;
|
||||
break;
|
||||
case 11:
|
||||
$result = Result::Won;
|
||||
$result = Result::WON;
|
||||
break;
|
||||
case 12:
|
||||
$result = Result::WonForfait;
|
||||
$result = Result::WON_FORFAIT;
|
||||
break;
|
||||
case 13:
|
||||
$result = Result::WonAdjourned;
|
||||
$result = Result::WON_ADJOURNED;
|
||||
break;
|
||||
case 14:
|
||||
$result = Result::WonBye;
|
||||
$result = Result::WON_BYE;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
$result = Result::None;
|
||||
$result = Result::NONE;
|
||||
break;
|
||||
}
|
||||
$pairing->Result = new Result($result);
|
||||
@ -747,7 +814,8 @@ class Pairtwo6 implements ReaderInterface
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $data
|
||||
* @param mixed $default
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return bool|DateTime|int|string
|
||||
*/
|
||||
private function readData(string $type, string $data, $default = null)
|
||||
@ -758,8 +826,8 @@ class Pairtwo6 implements ReaderInterface
|
||||
if ($data == '') {
|
||||
return (is_null($default)) ? '' : $default;
|
||||
}
|
||||
|
||||
return iconv('windows-1252', 'utf-8', $data);
|
||||
break;
|
||||
case 'Hex':
|
||||
case 'Int':
|
||||
case 'Bool':
|
||||
@ -769,7 +837,7 @@ class Pairtwo6 implements ReaderInterface
|
||||
|
||||
foreach ($hex as $key => $item) {
|
||||
if ($item == "00") {
|
||||
$hex[$key] = "";
|
||||
$hex[ $key ] = "";
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@ -781,80 +849,28 @@ class Pairtwo6 implements ReaderInterface
|
||||
if ($hex == '00') {
|
||||
return (is_null($default)) ? '00' : $default;
|
||||
}
|
||||
|
||||
return $hex;
|
||||
} elseif ($type == 'Int') {
|
||||
if ($hex == '00') {
|
||||
return (is_null($default)) ? 0 : $default;
|
||||
}
|
||||
|
||||
return hexdec($hex);
|
||||
} elseif ($type == 'Date') {
|
||||
if ($hex == '00') {
|
||||
return (is_null($default)) ? $this->convertUIntToTimestamp(0) : $default;
|
||||
}
|
||||
|
||||
return $this->convertUIntToTimestamp(hexdec($hex));
|
||||
} elseif ($type == 'Bool') {
|
||||
return ($hex == "01") ? true : false;
|
||||
return ($hex == "01");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException("Datatype not known");
|
||||
break;
|
||||
throw new InvalidArgumentException("Datatype not known");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts integer value to a date representation
|
||||
*
|
||||
* @param int $date
|
||||
* @return bool|DateTime
|
||||
*/
|
||||
private function convertUIntToTimestamp(int $date)
|
||||
{
|
||||
$curyear = date('Y');
|
||||
$yearoffset = $curyear - self::PT_PASTOFFSET;
|
||||
|
||||
// Day
|
||||
$day = $date % self::PT_DAYFACTOR;
|
||||
if ($day < 1) {
|
||||
$day = 1;
|
||||
}
|
||||
|
||||
// Month
|
||||
$month = ($date / self::PT_DAYFACTOR) % self::PT_MONTHFACTOR;
|
||||
if ($month < 1) {
|
||||
$month = 1;
|
||||
}
|
||||
|
||||
// Year
|
||||
$year = ($date / self::PT_YEARFACTOR) + $yearoffset;
|
||||
|
||||
$concat = $month . '/' . $day . '/' . intval($year);
|
||||
$format = 'm/d/Y';
|
||||
|
||||
|
||||
return DateTime::createFromFormat($format, $concat);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the first tiebreak to the tournament
|
||||
*/
|
||||
private function addTiebreaks(): void
|
||||
{
|
||||
switch ($this->Tournament->System) {
|
||||
case TournamentSystem::Keizer:
|
||||
$firstElement = new Tiebreak(Tiebreak::Keizer);
|
||||
break;
|
||||
case TournamentSystem::American:
|
||||
case TournamentSystem::Closed:
|
||||
case TournamentSystem::Swiss:
|
||||
$firstElement = new Tiebreak(Tiebreak::Points);
|
||||
break;
|
||||
}
|
||||
$tiebreaks = $this->Tournament->Tiebreaks;
|
||||
array_unshift($tiebreaks, $firstElement);
|
||||
$this->Tournament->Tiebreaks = $tiebreaks;
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Reader Swar-4
|
||||
*
|
||||
* Reads out Swar-4 files
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo\Readers;
|
||||
|
||||
use DateTime;
|
||||
use InvalidArgumentException;
|
||||
use JeroenED\Libpairtwo\Enums\Color;
|
||||
use JeroenED\Libpairtwo\Enums\Gender;
|
||||
use JeroenED\Libpairtwo\Enums\Result;
|
||||
@ -23,45 +27,25 @@ use JeroenED\Libpairtwo\Pairing;
|
||||
use JeroenED\Libpairtwo\Player;
|
||||
use JeroenED\Libpairtwo\Round;
|
||||
use JeroenED\Libpairtwo\Tournament;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* Reader Swar4
|
||||
*
|
||||
* Reads out Swar-4 files
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Swar4 implements ReaderInterface
|
||||
{
|
||||
/**
|
||||
* Version of Pairtwo this file was created with
|
||||
*
|
||||
* @var string
|
||||
* @var array
|
||||
*/
|
||||
public $Release;
|
||||
public const COMPATIBLE_VERSIONS = ['v4.'];
|
||||
|
||||
/**
|
||||
* The tournament
|
||||
*
|
||||
* @var Tournament
|
||||
*/
|
||||
public $Tournament;
|
||||
|
||||
/**
|
||||
* Binary data that was read out of the pairing file
|
||||
*
|
||||
* @var bool|DateTime|int|string[]
|
||||
*/
|
||||
private $BinaryData;
|
||||
|
||||
/** @var array */
|
||||
const CompatibleVersions = ['v4.'];
|
||||
|
||||
const Tempos = [
|
||||
public const TEMPOS = [
|
||||
[
|
||||
'105 min/40 moves + 15 min. QPF',
|
||||
'120 min/40 moves + 15 min. with incr. 30" starting from 40th move',
|
||||
@ -78,7 +62,8 @@ class Swar4 implements ReaderInterface
|
||||
'90 min with incr. 30"',
|
||||
'50 min with incr. 10"',
|
||||
'other'
|
||||
],[
|
||||
],
|
||||
[
|
||||
'10 min. with incr. 10"',
|
||||
'10 min. with incr. 15"',
|
||||
'10 min. with incr.5"',
|
||||
@ -102,7 +87,8 @@ class Swar4 implements ReaderInterface
|
||||
'45 min. QPF',
|
||||
'8 min. with incr.4"',
|
||||
'other'
|
||||
],[
|
||||
],
|
||||
[
|
||||
'3 min. with incr. 2"',
|
||||
'3 min. with incr. 3"',
|
||||
'4 min. with incr. 2"',
|
||||
@ -120,10 +106,97 @@ class Swar4 implements ReaderInterface
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* Binary data that was read out of the pairing file
|
||||
*
|
||||
* @var bool|DateTime|int|string[]
|
||||
*/
|
||||
private $BinaryData;
|
||||
|
||||
/**
|
||||
* Version of Pairtwo this file was created with
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $Release;
|
||||
|
||||
/**
|
||||
* The tournament
|
||||
*
|
||||
* @var Tournament
|
||||
*/
|
||||
public $Tournament;
|
||||
|
||||
/**
|
||||
* Returns binary data that was read out the swar file but was not needed immediately
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool|DateTime|int|string|null
|
||||
*/
|
||||
public function __get(string $key)
|
||||
{
|
||||
if (isset($this->BinaryData[ $key ])) {
|
||||
return $this->BinaryData[ $key ];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets binary data that is read out the swar file but is not needed immediately
|
||||
*
|
||||
* @param string $key
|
||||
* @param bool|int|DateTime|string $value
|
||||
*/
|
||||
public function __set(string $key, $value): void
|
||||
{
|
||||
$this->BinaryData[ $key ] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the first tiebreak to the tournament
|
||||
*/
|
||||
private function addTiebreaks(): void
|
||||
{
|
||||
switch ($this->Tournament->System) {
|
||||
case TournamentSystem::AMERICAN:
|
||||
case TournamentSystem::CLOSED:
|
||||
case TournamentSystem::SWISS:
|
||||
default:
|
||||
$firstElement = new Tiebreak(Tiebreak::POINTS);
|
||||
}
|
||||
$tiebreaks = $this->Tournament->Tiebreaks;
|
||||
array_unshift($tiebreaks, $firstElement);
|
||||
$this->Tournament->Tiebreaks = $tiebreaks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a swar-4 string to a \DateTime object
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return DateTime
|
||||
*/
|
||||
public function convertStringToDate(string $string): DateTime
|
||||
{
|
||||
if (strlen($string) == 10) {
|
||||
return DateTime::createFromFormat('d/m/Y', $string);
|
||||
} elseif (strlen($string) == 8) {
|
||||
return DateTime::createFromFormat('Ymd', $string);
|
||||
} else {
|
||||
$default = new DateTime();
|
||||
$default->setTimestamp(0);
|
||||
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually reads the Swar-File
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @throws IncompatibleReaderException
|
||||
*/
|
||||
public function read(string $filename): void
|
||||
@ -131,7 +204,7 @@ class Swar4 implements ReaderInterface
|
||||
$swshandle = fopen($filename, 'rb');
|
||||
|
||||
$this->Release = $this->readData('String', $swshandle);
|
||||
if (array_search(substr($this->Release, 0, 3), self::CompatibleVersions) === false) {
|
||||
if (array_search(substr($this->Release, 0, 3), self::COMPATIBLE_VERSIONS) === false) {
|
||||
throw new IncompatibleReaderException("This file was not created with Swar 4");
|
||||
}
|
||||
|
||||
@ -181,16 +254,16 @@ class Swar4 implements ReaderInterface
|
||||
case 3:
|
||||
case 4:
|
||||
default:
|
||||
$system = TournamentSystem::Swiss;
|
||||
$system = TournamentSystem::SWISS;
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
$system = TournamentSystem::Closed;
|
||||
$system = TournamentSystem::CLOSED;
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
$system = TournamentSystem::American;
|
||||
$system = TournamentSystem::AMERICAN;
|
||||
break;
|
||||
}
|
||||
$this->Tournament->System = new TournamentSystem($system);
|
||||
@ -244,7 +317,7 @@ class Swar4 implements ReaderInterface
|
||||
// [DATES]
|
||||
$this->readData('String', $swshandle);
|
||||
|
||||
$this->Tournament->Tempo = Self::Tempos[$this->Tournament->TournoiStd][$this->Tournament->TempoIndex];
|
||||
$this->Tournament->Tempo = self::TEMPOS[ $this->Tournament->TournoiStd ][ $this->Tournament->TempoIndex ];
|
||||
|
||||
for ($i = 0; $i < $this->Tournament->NoOfRounds; $i++) {
|
||||
$round = new Round();
|
||||
@ -261,52 +334,52 @@ class Swar4 implements ReaderInterface
|
||||
switch ($this->readData('Int', $swshandle)) {
|
||||
case 0:
|
||||
default:
|
||||
$tiebreak = Tiebreak::None;
|
||||
$tiebreak = Tiebreak::NONE;
|
||||
break;
|
||||
case 1:
|
||||
$tiebreak = Tiebreak::Buchholz;
|
||||
$tiebreak = Tiebreak::BUCHHOLZ;
|
||||
break;
|
||||
case 2:
|
||||
$tiebreak = Tiebreak::BuchholzMed;
|
||||
$tiebreak = Tiebreak::BUCHHOLZ_MED;
|
||||
break;
|
||||
case 3:
|
||||
$tiebreak = Tiebreak::BuchholzMed2;
|
||||
$tiebreak = Tiebreak::BUCHHOLZ_MED_2;
|
||||
break;
|
||||
case 4:
|
||||
$tiebreak = Tiebreak::BuchholzCut;
|
||||
$tiebreak = Tiebreak::BUCHHOLZ_CUT;
|
||||
break;
|
||||
case 5:
|
||||
$tiebreak = Tiebreak::BuchholzCut2;
|
||||
$tiebreak = Tiebreak::BUCHHOLZ_CUT_2;
|
||||
break;
|
||||
case 6:
|
||||
$tiebreak = Tiebreak::Sonneborn;
|
||||
$tiebreak = Tiebreak::SONNEBORN;
|
||||
break;
|
||||
case 7:
|
||||
$tiebreak = Tiebreak::Cumulative;
|
||||
$tiebreak = Tiebreak::CUMULATIVE;
|
||||
break;
|
||||
case 8:
|
||||
$tiebreak = Tiebreak::Between;
|
||||
$tiebreak = Tiebreak::BETWEEN;
|
||||
break;
|
||||
case 9:
|
||||
$tiebreak = Tiebreak::Koya;
|
||||
$tiebreak = Tiebreak::KOYA;
|
||||
break;
|
||||
case 10:
|
||||
$tiebreak = Tiebreak::Baumbach;
|
||||
$tiebreak = Tiebreak::BAUMBACH;
|
||||
break;
|
||||
case 11:
|
||||
$tiebreak = Tiebreak::AveragePerformance;
|
||||
$tiebreak = Tiebreak::AVERAGE_PERFORMANCE;
|
||||
break;
|
||||
case 12:
|
||||
$tiebreak = Tiebreak::Aro;
|
||||
$tiebreak = Tiebreak::ARO;
|
||||
break;
|
||||
case 13:
|
||||
$tiebreak = Tiebreak::AroCut;
|
||||
$tiebreak = Tiebreak::AROCUT;
|
||||
break;
|
||||
case 14:
|
||||
$tiebreak = Tiebreak::BlackPlayed;
|
||||
$tiebreak = Tiebreak::BLACK_PLAYED;
|
||||
break;
|
||||
case 15:
|
||||
$tiebreak = Tiebreak::BlackWin;
|
||||
$tiebreak = Tiebreak::BLACK_WIN;
|
||||
break;
|
||||
}
|
||||
$tiebreaks[] = new Tiebreak($tiebreak);
|
||||
@ -323,19 +396,19 @@ class Swar4 implements ReaderInterface
|
||||
|
||||
$this->Tournament->Catogory_type = $this->readData('Int', $swshandle);
|
||||
for ($i = 0; $i <= 12; $i++) {
|
||||
$category[$i]['Cat1'] =$this->readData('String', $swshandle);
|
||||
$category[ $i ][ 'Cat1' ] = $this->readData('String', $swshandle);
|
||||
}
|
||||
|
||||
for ($i = 0; $i <= 12; $i++) {
|
||||
$category[$i]['Cat2'] =$this->readData('String', $swshandle);
|
||||
$category[ $i ][ 'Cat2' ] = $this->readData('String', $swshandle);
|
||||
}
|
||||
$this->Tournament->Category = $category;
|
||||
// [XTRA_POINTS]
|
||||
$this->readData('String', $swshandle);
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$extrapoints[$i]['pts'] = $this->readData('Int', $swshandle);
|
||||
$extrapoints[$i]['elo'] = $this->readData('Int', $swshandle);
|
||||
$extrapoints[ $i ][ 'pts' ] = $this->readData('Int', $swshandle);
|
||||
$extrapoints[ $i ][ 'elo' ] = $this->readData('Int', $swshandle);
|
||||
}
|
||||
$this->Tournament->Extrapoints = $extrapoints;
|
||||
|
||||
@ -351,19 +424,19 @@ class Swar4 implements ReaderInterface
|
||||
$player = new Player();
|
||||
$player->Classement = $this->readData('Int', $swshandle);
|
||||
$player->Name = $this->readData('String', $swshandle);
|
||||
$inscriptionNos[$this->readData('Int', $swshandle)] = $i;
|
||||
$inscriptionNos[ $this->readData('Int', $swshandle) ] = $i;
|
||||
$player->Rank = $this->readData('Int', $swshandle);
|
||||
$player->CatIndex = $this->readData('Int', $swshandle);
|
||||
$player->DateOfBirth = $this->readData('Date', $swshandle);
|
||||
switch ($this->readData('Int', $swshandle)) {
|
||||
case 1:
|
||||
$gender = Gender::Male;
|
||||
$gender = Gender::MALE;
|
||||
break;
|
||||
case 2:
|
||||
$gender = Gender::Female;
|
||||
$gender = Gender::FEMALE;
|
||||
break;
|
||||
default:
|
||||
$gender = Gender::Neutral;
|
||||
$gender = Gender::NEUTRAL;
|
||||
break;
|
||||
}
|
||||
$player->Gender = new Gender($gender);
|
||||
@ -415,10 +488,10 @@ class Swar4 implements ReaderInterface
|
||||
$player->setId('Club', $this->readData('Int', $swshandle));
|
||||
$player->ClubName = $this->readData('String', $swshandle);
|
||||
$player->NoOfMatchesNoBye = $this->readData('Int', $swshandle);
|
||||
$player->Points = $this->readData('Int', $swshandle); // To Calculate by libpairtwo
|
||||
$player->Points = $this->readData('Int', $swshandle); // To Calculate by libpairtwo
|
||||
$player->AmericanPoints = $this->readData('Int', $swshandle); // To Calculate by libpairtwo
|
||||
for ($t = 0; $t < 5; $t++) {
|
||||
$tiebreaks[$t] = $this->readData('Int', $swshandle); // To Calculate by libpairtwo
|
||||
$tiebreaks[ $t ] = $this->readData('Int', $swshandle); // To Calculate by libpairtwo
|
||||
}
|
||||
$player->Tiebreak = $tiebreaks;
|
||||
$player->Performance = $this->readData('Int', $swshandle); // To Calculate by libpairtwo
|
||||
@ -432,14 +505,14 @@ class Swar4 implements ReaderInterface
|
||||
|
||||
if ($player->AllocatedRounds != 0) {
|
||||
for ($j = 0; $j < $player->AllocatedRounds; $j++) {
|
||||
$pairing[$pt]['player'] = $i;
|
||||
$pairing[$pt]['round'] = $this->readData('Int', $swshandle) - 1;
|
||||
$pairing[$pt]['table'] = $this->readData('Int', $swshandle) - 1;
|
||||
$pairing[$pt]['opponent'] = $this->readData('Int', $swshandle);
|
||||
$pairing[$pt]['result'] = $this->readData('Hex', $swshandle);
|
||||
$pairing[$pt]['color'] = $this->readData('Int', $swshandle);
|
||||
$pairing[$pt]['float'] = $this->readData('Int', $swshandle);
|
||||
$pairing[$pt]['extrapoints'] = $this->readData('Int', $swshandle);
|
||||
$pairing[ $pt ][ 'player' ] = $i;
|
||||
$pairing[ $pt ][ 'round' ] = $this->readData('Int', $swshandle) - 1;
|
||||
$pairing[ $pt ][ 'table' ] = $this->readData('Int', $swshandle) - 1;
|
||||
$pairing[ $pt ][ 'opponent' ] = $this->readData('Int', $swshandle);
|
||||
$pairing[ $pt ][ 'result' ] = $this->readData('Hex', $swshandle);
|
||||
$pairing[ $pt ][ 'color' ] = $this->readData('Int', $swshandle);
|
||||
$pairing[ $pt ][ 'float' ] = $this->readData('Int', $swshandle);
|
||||
$pairing[ $pt ][ 'extrapoints' ] = $this->readData('Int', $swshandle);
|
||||
|
||||
$pt++;
|
||||
}
|
||||
@ -450,61 +523,62 @@ class Swar4 implements ReaderInterface
|
||||
}
|
||||
|
||||
$ptn = 0;
|
||||
while (isset($this->Tournament->Pairing[$ptn]['round'])) {
|
||||
while (isset($this->Tournament->Pairing[ $ptn ][ 'round' ])) {
|
||||
$pairing = new Pairing();
|
||||
|
||||
$pairing->Player = $this->Tournament->PlayerById($this->Tournament->Pairing[$ptn]['player']);
|
||||
$pairing->Round = $this->Tournament->Pairing[$ptn]['round'];
|
||||
if ($this->Tournament->Pairing[$ptn]['opponent'] != 4294967295) {
|
||||
$pairing->Opponent = $this->Tournament->PlayerById($inscriptionNos[$this->Tournament->Pairing[$ptn]['opponent']]);
|
||||
$pairing->Player = $this->Tournament->playerById($this->Tournament->Pairing[ $ptn ][ 'player' ]);
|
||||
$pairing->Round = $this->Tournament->Pairing[ $ptn ][ 'round' ];
|
||||
if ($this->Tournament->Pairing[ $ptn ][ 'opponent' ] != 4294967295) {
|
||||
$pairing->Opponent =
|
||||
$this->Tournament->playerById($inscriptionNos[ $this->Tournament->Pairing[ $ptn ][ 'opponent' ] ]);
|
||||
}
|
||||
switch ($this->Tournament->Pairing[$ptn]['result']) {
|
||||
switch ($this->Tournament->Pairing[ $ptn ][ 'result' ]) {
|
||||
case '1000':
|
||||
$result = Result::Lost;
|
||||
$result = Result::LOST;
|
||||
break;
|
||||
case '01':
|
||||
$result = Result::Absent;
|
||||
$result = Result::ABSENT;
|
||||
break;
|
||||
case '0010':
|
||||
$result = Result::Bye;
|
||||
$result = Result::BYE;
|
||||
break;
|
||||
case '2000':
|
||||
$result = Result::Draw;
|
||||
$result = Result::DRAW;
|
||||
break;
|
||||
case '4000':
|
||||
$result = Result::Won;
|
||||
$result = Result::WON;
|
||||
break;
|
||||
case '04':
|
||||
$result = Result::WonForfait;
|
||||
$result = Result::WON_FORFAIT;
|
||||
break;
|
||||
case '40':
|
||||
$result = Result::WonBye;
|
||||
$result = Result::WON_BYE;
|
||||
break;
|
||||
case '00':
|
||||
default:
|
||||
$result = Result::None;
|
||||
$result = Result::NONE;
|
||||
break;
|
||||
}
|
||||
if (array_search($this->Tournament->Pairing[$ptn]['table'], [ 16383, 8191 ]) !== false) {
|
||||
$result = Result::Absent;
|
||||
if (array_search($this->Tournament->Pairing[ $ptn ][ 'table' ], [16383, 8191]) !== false) {
|
||||
$result = Result::ABSENT;
|
||||
}
|
||||
$pairing->Result = new Result($result);
|
||||
|
||||
switch ($this->Tournament->Pairing[$ptn]['color']) {
|
||||
switch ($this->Tournament->Pairing[ $ptn ][ 'color' ]) {
|
||||
case 4294967295:
|
||||
$color = Color::Black;
|
||||
$color = Color::BLACK;
|
||||
break;
|
||||
case 1:
|
||||
$color = Color::White;
|
||||
$color = Color::WHITE;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
$color = Color::None;
|
||||
$color = Color::NONE;
|
||||
break;
|
||||
}
|
||||
$pairing->Color = new Color($color);
|
||||
|
||||
$pairing->Board = $this->Tournament->Pairing[$ptn]['table'];
|
||||
$pairing->Board = $this->Tournament->Pairing[ $ptn ][ 'table' ];
|
||||
$ptn++;
|
||||
$this->Tournament->addPairing($pairing);
|
||||
}
|
||||
@ -524,8 +598,9 @@ class Swar4 implements ReaderInterface
|
||||
* * Date (Date representation of $data. Default: 1902/01/01)
|
||||
*
|
||||
* @param string $type
|
||||
* @param $handle
|
||||
* @param null $default
|
||||
* @param $handle
|
||||
* @param null $default
|
||||
*
|
||||
* @return array|bool|DateTime|false|float|int|string|null
|
||||
*/
|
||||
private function readData(string $type, $handle, $default = null)
|
||||
@ -542,11 +617,13 @@ class Swar4 implements ReaderInterface
|
||||
if ($data == '') {
|
||||
return (is_null($default)) ? '' : $default;
|
||||
}
|
||||
|
||||
return iconv('windows-1252', 'utf-8', $data);
|
||||
} elseif ($type == 'Date') {
|
||||
if ($data == '') {
|
||||
return (is_null($default)) ? $this->convertStringToDate('01/01/1900') : $default;
|
||||
}
|
||||
|
||||
return $this->convertStringToDate($data);
|
||||
}
|
||||
break;
|
||||
@ -559,7 +636,7 @@ class Swar4 implements ReaderInterface
|
||||
|
||||
foreach ($hex as $key => $item) {
|
||||
if ($item == "00") {
|
||||
$hex[$key] = "";
|
||||
$hex[ $key ] = "";
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@ -571,77 +648,22 @@ class Swar4 implements ReaderInterface
|
||||
if ($hex == '00') {
|
||||
return (is_null($default)) ? '00' : $default;
|
||||
}
|
||||
|
||||
return $hex;
|
||||
} elseif ($type == 'Int') {
|
||||
if ($hex == '00') {
|
||||
return (is_null($default)) ? 0 : $default;
|
||||
}
|
||||
|
||||
return hexdec($hex);
|
||||
} elseif ($type == 'Bool') {
|
||||
return ($hex == "01") ? true : false;
|
||||
return ($hex == "01");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException("Datatype not known");
|
||||
break;
|
||||
throw new InvalidArgumentException("Datatype not known");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns binary data that was read out the swar file but was not needed immediately
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool|DateTime|int|string|null
|
||||
*/
|
||||
public function __get(string $key)
|
||||
{
|
||||
if (isset($this->BinaryData[$key])) {
|
||||
return $this->BinaryData[$key];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets binary data that is read out the swar file but is not needed immediately
|
||||
*
|
||||
* @param string $key
|
||||
* @param bool|int|DateTime|string $value
|
||||
*/
|
||||
public function __set(string $key, $value): void
|
||||
{
|
||||
$this->BinaryData[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a swar-4 string to a \DateTime object
|
||||
* @param string $string
|
||||
* @return DateTime
|
||||
*/
|
||||
public function convertStringToDate(string $string): DateTime
|
||||
{
|
||||
if (strlen($string) == 10) {
|
||||
return DateTime::createFromFormat('d/m/Y', $string);
|
||||
} elseif (strlen($string) == 8) {
|
||||
return DateTime::createFromFormat('Ymd', $string);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the first tiebreak to the tournament
|
||||
*/
|
||||
private function addTiebreaks(): void
|
||||
{
|
||||
switch ($this->Tournament->System) {
|
||||
case TournamentSystem::American:
|
||||
case TournamentSystem::Closed:
|
||||
case TournamentSystem::Swiss:
|
||||
default:
|
||||
$firstElement = new Tiebreak(Tiebreak::Points);
|
||||
}
|
||||
$tiebreaks = $this->Tournament->Tiebreaks;
|
||||
array_unshift($tiebreaks, $firstElement);
|
||||
$this->Tournament->Tiebreaks = $tiebreaks;
|
||||
}
|
||||
}
|
||||
|
108
src/Round.php
108
src/Round.php
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class Round
|
||||
*
|
||||
* Class for a round of the tournament
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
|
||||
namespace JeroenED\Libpairtwo;
|
||||
@ -20,10 +21,10 @@ use JeroenED\Libpairtwo\Enums\Result;
|
||||
*
|
||||
* Class for a round of the tournament
|
||||
*
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @author Jeroen De Meerleer <schaak@jeroened.be>
|
||||
* @category Main
|
||||
* @package Libpairtwo
|
||||
* @copyright Copyright (c) 2018-2019 Jeroen De Meerleer <schaak@jeroened.be>
|
||||
*/
|
||||
class Round
|
||||
{
|
||||
@ -41,6 +42,13 @@ class Round
|
||||
*/
|
||||
public $Games = [];
|
||||
|
||||
/**
|
||||
* Array of all pairings for this round
|
||||
*
|
||||
* @var Pairing[]
|
||||
*/
|
||||
public $Pairings = [];
|
||||
|
||||
/**
|
||||
* Number of the round
|
||||
*
|
||||
@ -49,11 +57,44 @@ class Round
|
||||
public $RoundNo;
|
||||
|
||||
/**
|
||||
* Array of all pairings for this round
|
||||
* Magic method to read out several fields. If field was not found it is being searched in the binary data fields
|
||||
*
|
||||
* @var Pairing[]
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool|DateTime|int|string|null
|
||||
*/
|
||||
public $Pairings = [];
|
||||
public function __get(string $key)
|
||||
{
|
||||
if ($key == 'Bye') {
|
||||
return $this->bye();
|
||||
} elseif ($key == 'Absent') {
|
||||
return $this->absent();
|
||||
} elseif ($key == 'GamesByBoard') {
|
||||
return $this->gamesByBoard();
|
||||
} elseif (isset($this->BinaryData[ $key ])) {
|
||||
return $this->BinaryData[ $key ];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of pairings where the player is absent
|
||||
*
|
||||
* @return Pairing[]
|
||||
*/
|
||||
private function absent(): array
|
||||
{
|
||||
$allPairings = $this->Pairings;
|
||||
$absentPairings = [];
|
||||
foreach ($allPairings as $pairing) {
|
||||
if ($pairing->Result == Result::ABSENT) {
|
||||
$absentPairings[] = $pairing;
|
||||
}
|
||||
}
|
||||
|
||||
return $absentPairings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a game to the round
|
||||
@ -89,28 +130,12 @@ class Round
|
||||
$allPairings = $this->Pairings;
|
||||
$byePairings = [];
|
||||
foreach ($allPairings as $pairing) {
|
||||
if ($pairing->Result == Result::WonBye) {
|
||||
if ($pairing->Result == Result::WON_BYE) {
|
||||
$byePairings[] = $pairing;
|
||||
}
|
||||
}
|
||||
return $byePairings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of pairings where the player is absent
|
||||
*
|
||||
* @return Pairing[]
|
||||
*/
|
||||
private function absent(): array
|
||||
{
|
||||
$allPairings = $this->Pairings;
|
||||
$absentPairings = [];
|
||||
foreach ($allPairings as $pairing) {
|
||||
if ($pairing->Result == Result::Absent) {
|
||||
$absentPairings[] = $pairing;
|
||||
}
|
||||
}
|
||||
return $absentPairings;
|
||||
return $byePairings;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,7 +146,8 @@ class Round
|
||||
private function gamesByBoard(): array
|
||||
{
|
||||
$allGames = $this->Games;
|
||||
usort($allGames, array($this, 'sortByBoard'));
|
||||
usort($allGames, [$this, 'sortByBoard']);
|
||||
|
||||
return $allGames;
|
||||
}
|
||||
|
||||
@ -130,6 +156,7 @@ class Round
|
||||
*
|
||||
* @param Game $a
|
||||
* @param Game $b
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function sortByBoard(Game $a, Game $b): int
|
||||
@ -137,26 +164,7 @@ class Round
|
||||
if (($a->Board == $b->Board) || ($a->Board === false) || ($b->Board === false)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a->Board > $b->Board) ? +1 : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic method to read out several fields. If field was not found it is being searched in the binary data fields
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool|DateTime|int|string|null
|
||||
*/
|
||||
public function __get(string $key)
|
||||
{
|
||||
if ($key == 'Bye') {
|
||||
return $this->bye();
|
||||
} elseif ($key == 'Absent') {
|
||||
return $this->absent();
|
||||
} elseif ($key == 'GamesByBoard') {
|
||||
return $this->gamesByBoard();
|
||||
} elseif (isset($this->BinaryData[$key])) {
|
||||
return $this->BinaryData[$key];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
1354
src/Tournament.php
1354
src/Tournament.php
File diff suppressed because it is too large
Load Diff
@ -23,6 +23,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
use JeroenED\Libpairtwo\IOFactory;
|
||||
|
||||
require_once '../vendor/autoload.php';
|
||||
@ -30,62 +31,67 @@ require_once '../vendor/autoload.php';
|
||||
$sws = IOFactory::createReader('Swar-4');
|
||||
$sws->read('../res/testswar.swar');
|
||||
|
||||
echo "Release: " . $sws->Release() . PHP_EOL;
|
||||
echo "Name: " . $sws->Tournament()->Name . PHP_EOL;
|
||||
echo "Organiser: " . $sws->Tournament()->Organiser. PHP_EOL;
|
||||
echo "TempoIndex: " . $sws->Tournament()->TempoIndex . PHP_EOL;
|
||||
echo "TempoType: " . $sws->Tournament()->TournoiStd . PHP_EOL;
|
||||
echo "Tempo: " . $sws->Tournament()->Tempo . PHP_EOL;
|
||||
echo "Place: " . $sws->Tournament()->OrganiserPlace . PHP_EOL;
|
||||
echo "Arbiter 1: " . $sws->Tournament()->Arbiters[0] . PHP_EOL;
|
||||
echo "Arbiter 2: " . $sws->Tournament()->Arbiter[1] . PHP_EOL;
|
||||
echo "Rounds: " . $sws->Tournament()->NoOfRounds . PHP_EOL;
|
||||
echo "Fidehomol: " . $sws->Tournament()->FideHomol . PHP_EOL;
|
||||
echo "Start-Date: " . $sws->Tournament()->StartDate->format('d/m/Y') . PHP_EOL;
|
||||
echo "End-Date: " . $sws->Tournament()->EndDate->format('d/m/Y') . PHP_EOL;
|
||||
echo "System: " . $sws->Tournament()->System->Key() . PHP_EOL;
|
||||
echo "Place: " . $sws->Tournament()->OrganiserPlace . PHP_EOL;
|
||||
echo "Unrated-Elo: " . $sws->Tournament()->NonRatedElo . PHP_EOL;
|
||||
echo "Federation: " . $sws->Tournament()->Federation . PHP_EOL;
|
||||
echo "Organiser: " . $sws->Tournament()->OrganiserClubNo . PHP_EOL;
|
||||
echo "Fide Elo P1: " . $sws->Tournament()->PlayerById(0)->Elo('Fide') . PHP_EOL;
|
||||
echo "Fide Elo P2: " . $sws->Tournament()->PlayerById(1)->Elo('Fide') . PHP_EOL;
|
||||
echo "Fide Elo P3: " . $sws->Tournament()->PlayerById(2)->Elo('Fide') . PHP_EOL;
|
||||
echo "KBSB Elo P1: " . $sws->Tournament()->PlayerById(0)->Elo('Nation') . PHP_EOL;
|
||||
echo "KBSB Elo P2: " . $sws->Tournament()->PlayerById(1)->Elo('Nation') . PHP_EOL;
|
||||
echo "KBSB Elo P3: " . $sws->Tournament()->PlayerById(2)->Elo('Nation') . PHP_EOL;
|
||||
echo "Name P1: " . $sws->Tournament()->PlayerById(0)->Name . PHP_EOL;
|
||||
echo "Name P2: " . $sws->Tournament()->PlayerById(1)->Name . PHP_EOL;
|
||||
echo "Name P3: " . $sws->Tournament()->PlayerById(2)->Name . PHP_EOL;
|
||||
echo "Gender P1: " . $sws->Tournament()->PlayerById(0)->Gender->Key() . PHP_EOL;
|
||||
echo "Gender P2: " . $sws->Tournament()->PlayerById(1)->Gender->Key() . PHP_EOL;
|
||||
echo "Gender P3: " . $sws->Tournament()->PlayerById(2)->Gender->Key() . PHP_EOL;
|
||||
echo "Absent P1: " . $sws->Tournament()->PlayerById(0)->Absent . PHP_EOL;
|
||||
echo "Absent P2: " . $sws->Tournament()->PlayerById(1)->Absent . PHP_EOL;
|
||||
echo "Absent P3: " . $sws->Tournament()->PlayerById(2)->Absent . PHP_EOL;
|
||||
echo "Date Round 1: " . $sws->Tournament()->RoundByNo(0)->Date->format('d/m/Y') . PHP_EOL;
|
||||
echo "Date Round 2: " . $sws->Tournament()->RoundByNo(1)->Date->format('d/m/Y') . PHP_EOL;
|
||||
echo "Date Round 3: " . $sws->Tournament()->RoundByNo(2)->Date->format('d/m/Y') . PHP_EOL;
|
||||
echo "Game Round 1: " . $sws->Tournament()->RoundByNo(0)->Games[0]->Result->getValue() . PHP_EOL;
|
||||
echo "Game Round 2: " . $sws->Tournament()->RoundByNo(1)->Games[0]->Result->getValue() . PHP_EOL;
|
||||
echo "Game Round 3: " . $sws->Tournament()->RoundByNo(2)->Games[0]->Result->getValue() . PHP_EOL;
|
||||
echo "Color Pairing 1: " . $sws->Tournament()->Pairings[1]->Color->getKey() . PHP_EOL;
|
||||
echo "Color Pairing 2: " . $sws->Tournament()->Pairings[2]->Color->getKey() . PHP_EOL;
|
||||
echo "Color Pairing 3: " . $sws->Tournament()->Pairings[3]->Color->getKey() . PHP_EOL;
|
||||
echo "Player Pairing 1: " . $sws->Tournament()->Pairings[0]->Player->Name . PHP_EOL;
|
||||
echo "Player Pairing 2: " . $sws->Tournament()->Pairings[1]->Player->Name . PHP_EOL;
|
||||
echo "Player Pairing 3: " . $sws->Tournament()->Pairings[2]->Player->Name . PHP_EOL;
|
||||
echo "Bye Round 1: " . $sws->Tournament()->RoundByNo(2)->Bye[0]->Player->Name . PHP_EOL;
|
||||
echo "Absent Round 1: " . $sws->Tournament()->RoundByNo(2)->Absent[0]->Player->Name . PHP_EOL;
|
||||
echo "Tiebreak 1: " . $sws->Tournament()->Tiebreaks[0]->Value() . PHP_EOL;
|
||||
echo "Tiebreak 2: " . $sws->Tournament()->Tiebreaks[1]->Value() . PHP_EOL;
|
||||
echo "Tiebreak 3: " . $sws->Tournament()->Tiebreaks[2]->Value() . PHP_EOL;
|
||||
echo "Tiebreak 4: " . $sws->Tournament()->Tiebreaks[3]->Value() . PHP_EOL;
|
||||
echo "Tiebreak 5: " . $sws->Tournament()->Tiebreaks[4]->Value() . PHP_EOL;
|
||||
echo "Tiebreak 6: " . $sws->Tournament()->Tiebreaks[5]->Value() . PHP_EOL;
|
||||
echo "Average Elo: " . $sws->Tournament()->AverageElo . PHP_EOL;
|
||||
foreach ($sws->Tournament()->Ranking as $player) {
|
||||
echo str_pad($player->Name . '(' . $player->Elo($sws->Tournament()->PriorityElo) . ') ', 35) . implode_pad(' ', $player->Tiebreaks, 5, ' ') . PHP_EOL;
|
||||
echo "Release: " . $sws->Release . PHP_EOL;
|
||||
echo "Name: " . $sws->Tournament->Name . PHP_EOL;
|
||||
echo "Organiser: " . $sws->Tournament->Organiser . PHP_EOL;
|
||||
echo "TempoIndex: " . $sws->Tournament->TempoIndex . PHP_EOL;
|
||||
echo "TempoType: " . $sws->Tournament->TournoiStd . PHP_EOL;
|
||||
echo "Tempo: " . $sws->Tournament->Tempo . PHP_EOL;
|
||||
echo "Place: " . $sws->Tournament->OrganiserPlace . PHP_EOL;
|
||||
echo "Arbiter 1: " . $sws->Tournament->Arbiters[ 0 ] . PHP_EOL;
|
||||
echo "Arbiter 2: " . $sws->Tournament->Arbiters[ 1 ] . PHP_EOL;
|
||||
echo "Rounds: " . $sws->Tournament->NoOfRounds . PHP_EOL;
|
||||
echo "Fidehomol: " . $sws->Tournament->FideHomol . PHP_EOL;
|
||||
echo "Start-Date: " . $sws->Tournament->StartDate->format('d/m/Y') . PHP_EOL;
|
||||
echo "End-Date: " . $sws->Tournament->EndDate->format('d/m/Y') . PHP_EOL;
|
||||
echo "System: " . $sws->Tournament->System->getKey() . PHP_EOL;
|
||||
echo "Place: " . $sws->Tournament->OrganiserPlace . PHP_EOL;
|
||||
echo "Unrated-Elo: " . $sws->Tournament->NonRatedElo . PHP_EOL;
|
||||
echo "Federation: " . $sws->Tournament->Federation . PHP_EOL;
|
||||
echo "Organiser: " . $sws->Tournament->OrganiserClubNo . PHP_EOL;
|
||||
echo "Fide Elo P1: " . $sws->Tournament->PlayerById(0)->getElo('Fide') . PHP_EOL;
|
||||
echo "Fide Elo P2: " . $sws->Tournament->PlayerById(1)->getElo('Fide') . PHP_EOL;
|
||||
echo "Fide Elo P3: " . $sws->Tournament->PlayerById(2)->getElo('Fide') . PHP_EOL;
|
||||
echo "KBSB Elo P1: " . $sws->Tournament->PlayerById(0)->getElo('Nation') . PHP_EOL;
|
||||
echo "KBSB Elo P2: " . $sws->Tournament->PlayerById(1)->getElo('Nation') . PHP_EOL;
|
||||
echo "KBSB Elo P3: " . $sws->Tournament->PlayerById(2)->getElo('Nation') . PHP_EOL;
|
||||
echo "Name P1: " . $sws->Tournament->PlayerById(0)->Name . PHP_EOL;
|
||||
echo "Name P2: " . $sws->Tournament->PlayerById(1)->Name . PHP_EOL;
|
||||
echo "Name P3: " . $sws->Tournament->PlayerById(2)->Name . PHP_EOL;
|
||||
echo "Gender P1: " . $sws->Tournament->PlayerById(0)->Gender->getKey() . PHP_EOL;
|
||||
echo "Gender P2: " . $sws->Tournament->PlayerById(1)->Gender->getKey() . PHP_EOL;
|
||||
echo "Gender P3: " . $sws->Tournament->PlayerById(2)->Gender->getKey() . PHP_EOL;
|
||||
echo "Absent P1: " . $sws->Tournament->PlayerById(0)->Absent . PHP_EOL;
|
||||
echo "Absent P2: " . $sws->Tournament->PlayerById(1)->Absent . PHP_EOL;
|
||||
echo "Absent P3: " . $sws->Tournament->PlayerById(2)->Absent . PHP_EOL;
|
||||
echo "Category P1: " . $sws->Tournament->PlayerById(0)->Category . PHP_EOL;
|
||||
echo "Category P2: " . $sws->Tournament->PlayerById(1)->Category . PHP_EOL;
|
||||
echo "Category P3: " . $sws->Tournament->PlayerById(2)->Category . PHP_EOL;
|
||||
echo "Date Round 1: " . $sws->Tournament->RoundByNo(0)->Date->format('d/m/Y') . PHP_EOL;
|
||||
echo "Date Round 2: " . $sws->Tournament->RoundByNo(1)->Date->format('d/m/Y') . PHP_EOL;
|
||||
echo "Date Round 3: " . $sws->Tournament->RoundByNo(2)->Date->format('d/m/Y') . PHP_EOL;
|
||||
echo "Game Round 1: " . $sws->Tournament->RoundByNo(0)->Games[ 0 ]->Result->getValue() . PHP_EOL;
|
||||
echo "Game Round 2: " . $sws->Tournament->RoundByNo(1)->Games[ 0 ]->Result->getValue() . PHP_EOL;
|
||||
echo "Game Round 3: " . $sws->Tournament->RoundByNo(2)->Games[ 0 ]->Result->getValue() . PHP_EOL;
|
||||
echo "Color Pairing 1: " . $sws->Tournament->Pairings[ 1 ]->Color->getKey() . PHP_EOL;
|
||||
echo "Color Pairing 2: " . $sws->Tournament->Pairings[ 2 ]->Color->getKey() . PHP_EOL;
|
||||
echo "Color Pairing 3: " . $sws->Tournament->Pairings[ 3 ]->Color->getKey() . PHP_EOL;
|
||||
echo "Player Pairing 1: " . $sws->Tournament->Pairings[ 0 ]->Player->Name . PHP_EOL;
|
||||
echo "Player Pairing 2: " . $sws->Tournament->Pairings[ 1 ]->Player->Name . PHP_EOL;
|
||||
echo "Player Pairing 3: " . $sws->Tournament->Pairings[ 2 ]->Player->Name . PHP_EOL;
|
||||
echo "Bye Round 1: " . $sws->Tournament->RoundByNo(2)->Bye[ 0 ]->Player->Name . PHP_EOL;
|
||||
echo "Absent Round 1: " . $sws->Tournament->RoundByNo(2)->Absent[ 0 ]->Player->Name . PHP_EOL;
|
||||
echo "Tiebreak 1: " . $sws->Tournament->Tiebreaks[ 0 ]->getValue() . PHP_EOL;
|
||||
echo "Tiebreak 2: " . $sws->Tournament->Tiebreaks[ 1 ]->getValue() . PHP_EOL;
|
||||
echo "Tiebreak 3: " . $sws->Tournament->Tiebreaks[ 2 ]->getValue() . PHP_EOL;
|
||||
echo "Tiebreak 4: " . $sws->Tournament->Tiebreaks[ 3 ]->getValue() . PHP_EOL;
|
||||
echo "Tiebreak 5: " . $sws->Tournament->Tiebreaks[ 4 ]->getValue() . PHP_EOL;
|
||||
echo "Tiebreak 6: " . $sws->Tournament->Tiebreaks[ 5 ]->getValue() . PHP_EOL;
|
||||
echo "Average Elo: " . $sws->Tournament->AverageElo . PHP_EOL;
|
||||
foreach ($sws->Tournament->RankingForCategory('+2500') as $player) {
|
||||
echo str_pad($player->Name . '(' . $player->getElo($sws->Tournament->PriorityElo) . ') ', 35) .
|
||||
implode_pad(' ', $player->Tiebreaks, 5, ' ') .
|
||||
PHP_EOL;
|
||||
}
|
||||
|
||||
function implode_pad($glue, $collection, $padlength, $padstring): string
|
||||
@ -94,5 +100,6 @@ function implode_pad($glue, $collection, $padlength, $padstring): string
|
||||
foreach ($collection as $elem) {
|
||||
$newarray[] = str_pad($elem, $padlength, $padstring);
|
||||
}
|
||||
|
||||
return implode($glue, $newarray);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user