2017 © Pedro Peláez
 

library hunter

Hunter is an easy to use uHunt wrapper to receive information from UVA servers.

image

kaspars/hunter

Hunter is an easy to use uHunt wrapper to receive information from UVA servers.

  • Tuesday, March 28, 2017
  • by kasparsklavins
  • Repository
  • 4 Watchers
  • 8 Stars
  • 47 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Build Status Scrutinizer Code Quality Code Coverage, (*1)

Introduction

Hunter is an easy to use uHunt wrapper to receive information from UVa's online judge., (*2)

Hunter is licensed under the MIT License - see the LICENSE file for details., (*3)

Basic Usage

use Hunter\Hunter;

require "vendor/autoload.php";

$hunter = new Hunter();

echo $hunter->getIdFromUsername("Kaspars");

Installing

With Composer

The easiest and recommended method to install Hunter is via composer., (*4)

Use the following command to install with composer., (*5)

$ composer require kaspars/hunter

If you wish you can create the following composer.json file and run composer install to install it., (*6)

{
   "require": {
      "kaspars/hunter": "~1.0"
   }
}

Direct Download

First of all, you really should use composer.. But if you insist, then just copy the content from src folder into your project, (*7)

Data Format

All data is returned as an associated array., (*8)

Problem format

  • id Problem ID
  • number Problem number
  • title Problem title
  • dacu Number of distinct accepted users
  • bestRuntime Best runtime in milliseconds of an Accepted Submission
  • verdicts An array given verdicts
    • Hunter\Status::NO_VERDICT Number of _No Verdict Given_ (can be ignored)
    • Hunter\Status::SUBMISSION_ERROR Number of Submission Error
    • Hunter\Status::CANT_BE_JUDGED Number of Can't be Judged
    • Hunter\Status::IN_QUEUE Number of In Queue
    • Hunter\Status::COMPILATION_ERROR Number of Compilation Error
    • Hunter\Status::RESTRICTED_FUNCTION Number of Restricted Function
    • Hunter\Status::RUNTIME_ERROR Number of Runtime Error
    • Hunter\Status::OUTPUT_LIMIT Number of Output Limit Exceeded
    • Hunter\Status::TIME_LIMIT Number of Time Limit Exceeded
    • Hunter\Status::MEMORY_LIMIT Number of Memory Limit Exceeded
    • Hunter\Status::WRONG_ANSWER Number of Wrong Answer
    • Hunter\Status::PRESENTATION_ERROR Number of Presentation Error
    • Hunter\Status::ACCEPTED Number of Accepted
  • limit Problem runtime limit in milliseconds
  • status Problem Status
    • Hunter\Status::UNAVAILABLE Unavailable
    • Hunter\Status::Normal Normal
    • Hunter\Status::SPECIAL_JUDGE A special judging program is used.
  • rejudged Last time (unix timestamp) the problem was rejudged, null if never.

Submission format

  • id Submission`s ID
  • user User ID
  • name User's full name
  • username User`s username
  • problem Problem's ID
  • verdict Given verdict
    • Hunter\Status::SUBMISSION_ERROR Submission Error
    • Hunter\Status::CANT_BE_JUDGED Can't be Judged
    • Hunter\Status::IN_QUEUE In Queue
    • Hunter\Status::COMPILATION_ERROR Compilation Error
    • Hunter\Status::RESTRICTED_FUNCTION Restricted Function
    • Hunter\Status::RUNTIME_ERROR Runtime Error
    • Hunter\Status::OUTPUT_LIMIT Output Limit Exceeded
    • Hunter\Status::TIME_LIMIT Time Limit Exceeded
    • Hunter\Status::MEMORY_LIMIT Memory Limit Exceeded
    • Hunter\Status::WRONG_ANSWER Wrong Answer
    • Hunter\Status::PRESENTATION_ERROR Presentation Error
    • Hunter\Status::ACCEPTED Accepted
  • language Language in which submission was written
    • Hunter\Language::ANSI_C Ansi C
    • Hunter\Language::Java Java
    • Hunter\Language::CPLUSPLUS C++
    • Hunter\Language::PASCAL Pascal
    • Hunter\Language::CPLUSPLUS11 C++11
    • Hunter\Language::PYTHON Python
  • runtime Runtime in milliseconds
  • rank Submission rank, compared to all
  • time Submission unix timestamp

Ranklist format

  • id User`s ID
  • name User`s name
  • username User`s username
  • rank User's rank
  • accepted The number of accepted problems
  • submissions The number of submissions
  • activity Array of user's activity
    • Hunter\Activity::DAYS Activity in the last 2 days
    • Hunter\Activity::WEEK Activity in the last 7 days
    • Hunter\Activity::MONTH Activity in the last 31 days
    • Hunter\Activity::QUARTER Activity in the last 3 months
    • Hunter\Activity::YEAR Activity in the last year

API

getIdFromUsername(string $username)

Convert the given $username to a UVa ID., (*9)

Returns either the id, or null if not found, (*10)

$hunter = new Hunter\Hunter();
echo $hunter->getIdFromUsername("Kaspars"); //343417
echo $hunter->getIdFromUsername("Foobar"); // null

Examples

problems(void)

Returns an array of available UVa problems, (*11)

$hunter = new Hunter\Hunter();
var_dump($hunter->problems());

problem(int $id, string $type = "id")

Retrieved data of a specific problem, (*12)

$hunter = new Hunter\Hunter();
var_dump($hunter->problem(36));
var_dump($hunter->problem(100, "num"));

problemSubmissions(array|int $problemIDS, int $start = 0, int $end = 2^31)

View submissions to specific problems on a given submission date range. $start and $end are unix timestamps, (*13)

$hunter = new Hunter\Hunter();
var_dump($hunter->problemSubmissions(36));
var_dump($hunter->problemSubmissions(array(36,37)));

problemRanklist(int $problemID, int $rank = 1, int $count = 100)

Returns submissions to a problem ranked from $rank to $rank + $count - 1., (*14)

$hunter = new Hunter\Hunter();
var_dump($hunter->problemRanklist(36));

userProblemRanklist(int $problemID, int $userID, int $above = 10, int $below = 10)

Returns nearby submissions (by runtime) for a particular user submission to a problem., (*15)

$hunter = new Hunter\Hunter();
var_dump($hunter->userProblemRanklist(36, 343417));

userSubmissions(int $userID, int $min = null)

Returns all of the submissions of a particular user., (*16)

if $min is specified, only submissions with ID larger than $min will be returned., (*17)

$hunter = new Hunter\Hunter();
var_dump($hunter->userSubmissions(343417));

userLatestSubmissions(int $userID, int $count = 10)

Returns the last $count submissions of a particular user., (*18)

$hunter = new Hunter\Hunter();
var_dump($hunter->userLatestSubmissions(343417));

userProblemSubmissions(array|int $userIDs, array|int $problemIDs, int $min, string $type = "id")

Returns all the submissions of the users on specific problems., (*19)

Possible $type values are id and num. This changes whether you pass problem id's or problem num's as the second argument., (*20)

$hunter = new Hunter\Hunter();
var_dump($hunter->userProblemSubmissions(343417, 36);

userSolvedProblems(array|int $userIDs)

Get The Bit-Encoded-Problem IDs that Has Been Solved by Some Authors., (*21)

$hunter = new Hunter\Hunter();
var_dump($hunter->userSolvedProblems(343417));

userRanklist(int $userID, int $above = 10, int $below = 10)

Returns the user's ranklist and their closest neighbors., (*22)

$hunter = new Hunter\Hunter();
var_dump($hunter->userRanklist(343417, 10, 10));

ranklist(int $rank = 1, int $count = 10)

Global ranklist, starteing from $rank to $rank+$count, (*23)

$hunter = new Hunter\Hunter();
var_dump($hunter->ranklist(1, 100));

setSource(string $source)

Change the source of API data. The default is http://uhunt.felix-halim.net/api/, another valid source is http://icpcarchive.ecs.baylor.edu/uhunt/api/. But you can switch to any source that has the same data format., (*24)

$hunter = new Hunter\Hunter();
var_dump($hunter->setSource('http://icpcarchive.ecs.baylor.edu/uhunt/api/'));

getSource()

Returns the current used API source., (*25)

$hunter = new Hunter\Hunter();
var_dump($hunter->getSource());

The Versions

28/03 2017

dev-master

9999999-dev https://github.com/kasparsklavins/Hunter

Hunter is an easy to use uHunt wrapper to receive information from UVA servers.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Kaspars

online judge uva uhunt competitive programming

14/09 2015

1.2.1

1.2.1.0 https://github.com/kasparsklavins/Hunter

Hunter is an easy to use uHunt wrapper to receive information from UVA servers.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Kaspars

online judge uva uhunt competitive programming

13/09 2015

v1.2

1.2.0.0 https://github.com/kasparsklavins/Hunter

Hunter is an easy to use uHunt wrapper to receive information from UVA servers.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Kaspars

online judge uva uhunt

19/04 2015

v1.1

1.1.0.0 https://github.com/kasparsklavins/Hunter

Hunter is an easy to use uHunt wrapper to receive information from UVA servers.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Kaspars

online judge uva uhunt

19/04 2015

v1.0

1.0.0.0

Hunter is an easy to use uHunt wrapper to receive information from UVA servers.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Kaspars