Giter Club home page Giter Club logo

libpairtwo's People

Contributors

jeroened avatar

Watchers

 avatar  avatar  avatar

Forkers

fleuronjovial

libpairtwo's Issues

Tiebreaks

Tiebreaks are currently not implemented. Fixing this requires quite some work where the generalization is part of. This issue is to keep track of this work.

Required steps

  • Read which tiebreaks used
  • Get rid of pairtwo tiebreak fields
  • Implement tiebreak algorithms
  • (Pairtwo-6) implement calculation of tiebreaks

getId is returning the Elo

When requesting the the id of a player the elo of the player is being returned

Expected results

$ php getId.php
{'id': 14948}

Actual results

{'id': 1150}

Path to disaster

<?php
use JeroenED\Libpairtwo\IOFactory;

require_once 'vendor/autoload.php';

$sws = IOFactory::createReader('Pairtwo-6');
$sws->read('res/testsws.sws');
echo "Fide id P1:  " . $sws->getTournament()->getPlayerById(0)->getId('Fide') . PHP_EOL;

Libpairtwo version

962a2ec

PHP version

PHP 7.3.9-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Sep 2 2019 12:54:24) ( NTS )

SWS File

All of them. Libpairtwo issue. See https://github.com/JeroenED/libpairtwo/blob/master/src/Player.php#L138

Empty string data returns wrong data

When some data contains only 0x00 characters it is returned as length * 0x00 data.

Expected results

When data is not filled it returns nothing

Actual results

When data is not filled in it returns length * 0x00

Path to disaster

use JeroenED\Libpairtwo\Sws;
require_once 'vendor/autoload.php';
$sws = Sws::readSws('upload/issue.sws');
echo "Empty value:    " . $sws->getTournament()->getFirstPeriod() . PHP_EOL;

Libpairtwo version

53b6316

PHP version

PHP 7.3.2-3+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Feb 8 2019 15:43:57) ( NTS )

SWS File

issue1.zip

Extended ASCII characters fail

Names and other data containing extended ASCII characterers (eg. é) fail to be transmitted properly

Expected results

Getting a name with extended ascii character gets the name as it was written in the sws-file

Actual results

Getting a name with extended ascii character gets the name as it was written in the sws-file but extended ascii characters are replaced with question marks

Path to disaster

require_once 'vendor/autoload.php';
$sws = Sws::readSws('uploads/issue1.sws');
echo "Chloé:  " . $sws->getTournament()->getPlayerById(0)->getName() . PHP_EOL;
echo "Noëlla: " . $sws->getTournament()->getPlayerById(1)->getName() . PHP_EOL;
echo "André:  " . $sws->getTournament()->getPlayerById(2)->getName() . PHP_EOL;

Libpairtwo version

53b6316

PHP version

PHP 7.3.2-3+ubuntu18.04.1+deb.sury.org+1

SWS File

issue1.zip

Adjourned results are not reliable

When saving a adjourned result (eg. 1-1Adj) the result is different when using libpairtwo

Expected results

$ php disaster.php 
Ronde: 1
Player 1 1-1A Player 2

Actual results

$ php disaster.php 
Ronde: 1
Player 1 1-0A Player 2
Player 1 0-1A Player 2

Path to disaster

<?php

require_once("vendor/autoload.php");
$sws = JeroenED\Libpairtwo\Sws::ReadSws("Adjourned results not reliable_R04.sws");

$calendar = $sws->getTournament()->getRounds();
$roundNo = 1;
foreach ($calendar as $round) {
    echo "Ronde: " . $roundNo . PHP_EOL; $roundNo++;
    foreach($round->getGames() as $game) {
        if (!is_null($game->getResult())) {
            echo (is_null($game->getWhite())) ? "bye" : htmlentities($game->getWhite()->getName());
            echo " " . $game->getResult()->getValue() . " ";
            echo (is_null($game->getBlack())) ? "bye" : htmlentities($game->getBlack()->getName());
            echo PHP_EOL;
        }
    }
    echo PHP_EOL;
}

Libpairtwo version

4db54e8

PHP version

$ php -v
PHP 7.3.2-3+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Feb  8 2019 15:43:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.2, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.2-3+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

SWS File

adjourned.zip

Performance rating is not correct

When calculating the performance rating, the returned value is not correct

Expected results

Perf P1:      1810
Perf P2:      2602
Perf P3:      1331

Actual results

Perf P1:      1803
Perf P2:      2203
Perf P3:      1401

Path to disaster

$sws = IOFactory::createReader('Pairtwo-6');
$sws->read('../res/testsws.sws');

echo "Perf P1:      " . $sws->getTournament()->getPlayerById(0)->getPerformance($sws->getTournament()->getPriorityElo(), $sws->getTournament()->getNonRatedElo()) . PHP_EOL;
echo "Perf P2:      " . $sws->getTournament()->getPlayerById(1)->getPerformance($sws->getTournament()->getPriorityElo(), $sws->getTournament()->getNonRatedElo()) . PHP_EOL;
echo "Perf P3:      " . $sws->getTournament()->getPlayerById(2)->getPerformance($sws->getTournament()->getPriorityElo(), $sws->getTournament()->getNonRatedElo()) . PHP_EOL;

Libpairtwo version

ae832bb

PHP version

$ php -v
PHP 7.3.6-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May 31 2019 11:06:48) ( NTS )

SWS File

https://github.com/JeroenED/libpairtwo/blob/ae832bb02525e4907a1d3b706c2f21ad3e1f5b15/res/testsws.sws

Calculation of matual result is not correct

When using the mutual result tiebreak where not all players played each other, the tiebreak is still calculated if 1 player did play all others.

Expected results

Player C
Opponents: Player K (Result: 0.5), Player M (Result: 0.5), Player O (Result: 1), Player F (Result: 1), Player D (Result: 1), Player E (Result: 0), Player G (Result: 0.5), 
Points: 4.5
Mutual Result: 0

Player E
Opponents: Player M (Result: 0.5), Player O (Result: 0.5), Player K (Result: 1), Player B (Result: 0.5), Player L (Result: 1), Player C (Result: 1), Player D (Result: 0), 
Points: 4.5
Mutual Result: 0

Player G
Opponents: Player O (Result: 0.5), Player D (Result: 0), Player M (Result: 0.5), Player H (Result: 1), Player F (Result: 1), Player L (Result: 1), Player C (Result: 0.5), 
Points: 4.5
Mutual Result: 0

Actual results

Player C
Opponents: Player K (Result: 0.5), Player M (Result: 0.5), Player O (Result: 1), Player F (Result: 1), Player D (Result: 1), Player E (Result: 0), Player G (Result: 0.5), 
Points: 4.5
Mutual Result: 0.5

Player E
Opponents: Player M (Result: 0.5), Player O (Result: 0.5), Player K (Result: 1), Player B (Result: 0.5), Player L (Result: 1), Player C (Result: 1), Player D (Result: 0), 
Points: 4.5
Mutual Result: 0

Player G
Opponents: Player O (Result: 0.5), Player D (Result: 0), Player M (Result: 0.5), Player H (Result: 1), Player F (Result: 1), Player L (Result: 1), Player C (Result: 0.5), 
Points: 4.5
Mutual Result: 0

Path to disaster

<?php
require_once("vendor/autoload.php");
$reader = JeroenED\Libpairtwo\IOFactory::createReader("Swar-4");
$reader->read('Libpairtwo test tournament.swar');

$tournamenttiebreaks = $reader->Tournament->Tiebreaks;
foreach ($reader->Tournament->Ranking as $key => $standing) {
    $rankarray = array();
    echo $standing->Name . PHP_EOL;
    echo "Opponents: ";
    foreach ($standing->Pairings as $pairing) {
        echo $pairing->Opponent->Name . ' (Result: ' . $pairing->Result . '), ';
    }
    echo PHP_EOL;

    foreach ($standing->Tiebreaks as $key=>$tiebreak) {
        if($tournamenttiebreaks[$key] != '') echo $tournamenttiebreaks[$key] . ': ' . $tiebreak . PHP_EOL;
    }
    echo PHP_EOL;

}

Libpairtwo version

e4d96e0

PHP version

$ php -v
PHP 7.4.1 (cli) (built: Dec 18 2019 14:44:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.1, Copyright (c), by Zend Technologies

SWS File

disaster.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.