Hunter is an easy to use uHunt wrapper to receive information from UVa's online judge.
Hunter is licensed under the MIT License - see the LICENSE file for details.
use Hunter\Hunter;
require "vendor/autoload.php";
$hunter = new Hunter();
echo $hunter->getIdFromUsername("Kaspars");The easiest and recommended method to install Hunter is via composer.
Use the following command to install with composer.
$ composer require kaspars/hunter
If you wish you can create the following composer.json file and run composer install to install it.
{
"require": {
"kaspars/hunter": "~1.0"
}
}
First of all, you really should use composer.. But if you insist, then just copy the content from src folder into your project
All data is returned as an associated array.
idProblem IDnumberProblem numbertitleProblem titledacuNumber of distinct accepted usersbestRuntimeBest runtime in milliseconds of an Accepted SubmissionverdictsAn array given verdictsHunter\Status::NO_VERDICTNumber of No Verdict Given (can be ignored)Hunter\Status::SUBMISSION_ERRORNumber of Submission ErrorHunter\Status::CANT_BE_JUDGEDNumber of Can't be JudgedHunter\Status::IN_QUEUENumber of In QueueHunter\Status::COMPILATION_ERRORNumber of Compilation ErrorHunter\Status::RESTRICTED_FUNCTIONNumber of Restricted FunctionHunter\Status::RUNTIME_ERRORNumber of Runtime ErrorHunter\Status::OUTPUT_LIMITNumber of Output Limit ExceededHunter\Status::TIME_LIMITNumber of Time Limit ExceededHunter\Status::MEMORY_LIMITNumber of Memory Limit ExceededHunter\Status::WRONG_ANSWERNumber of Wrong AnswerHunter\Status::PRESENTATION_ERRORNumber of Presentation ErrorHunter\Status::ACCEPTEDNumber of Accepted
limitProblem runtime limit in millisecondsstatusProblem StatusHunter\Status::UNAVAILABLEUnavailableHunter\Status::NormalNormalHunter\Status::SPECIAL_JUDGEA special judging program is used.
rejudgedLast time (unix timestamp) the problem was rejudged,nullif never.
idSubmission`s IDuserUser IDnameUser's full nameusernameUser`s usernameproblemProblem's IDverdictGiven verdictHunter\Status::SUBMISSION_ERRORSubmission ErrorHunter\Status::CANT_BE_JUDGEDCan't be JudgedHunter\Status::IN_QUEUEIn QueueHunter\Status::COMPILATION_ERRORCompilation ErrorHunter\Status::RESTRICTED_FUNCTIONRestricted FunctionHunter\Status::RUNTIME_ERRORRuntime ErrorHunter\Status::OUTPUT_LIMITOutput Limit ExceededHunter\Status::TIME_LIMITTime Limit ExceededHunter\Status::MEMORY_LIMITMemory Limit ExceededHunter\Status::WRONG_ANSWERWrong AnswerHunter\Status::PRESENTATION_ERRORPresentation ErrorHunter\Status::ACCEPTEDAccepted
languageLanguage in which submission was writtenHunter\Language::ANSI_CAnsi CHunter\Language::JavaJavaHunter\Language::CPLUSPLUSC++Hunter\Language::PASCALPascalHunter\Language::CPLUSPLUS11C++11Hunter\Language::PYTHONPython
runtimeRuntime in millisecondsrankSubmission rank, compared to alltimeSubmission unix timestamp
idUser`s IDnameUser`s nameusernameUser`s usernamerankUser's rankacceptedThe number of accepted problemssubmissionsThe number of submissionsactivityArray of user's activityHunter\Activity::DAYSActivity in the last 2 daysHunter\Activity::WEEKActivity in the last 7 daysHunter\Activity::MONTHActivity in the last 31 daysHunter\Activity::QUARTERActivity in the last 3 monthsHunter\Activity::YEARActivity in the last year
#API
##getIdFromUsername(string $username)
Convert the given $username to a UVa ID.
Returns either the id, or null if not found
$hunter = new Hunter\Hunter();
echo $hunter->getIdFromUsername("Kaspars"); //343417
echo $hunter->getIdFromUsername("Foobar"); // nullReturns an array of available UVa problems
$hunter = new Hunter\Hunter();
var_dump($hunter->problems());Retrieved data of a specific problem
$hunter = new Hunter\Hunter();
var_dump($hunter->problem(36));
var_dump($hunter->problem(100, "num"));View submissions to specific problems on a given submission date range.
$start and $end are unix timestamps
$hunter = new Hunter\Hunter();
var_dump($hunter->problemSubmissions(36));
var_dump($hunter->problemSubmissions(array(36,37)));Returns submissions to a problem ranked from $rank to $rank + $count - 1.
$hunter = new Hunter\Hunter();
var_dump($hunter->problemRanklist(36));Returns nearby submissions (by runtime) for a particular user submission to a problem.
$hunter = new Hunter\Hunter();
var_dump($hunter->userProblemRanklist(36, 343417));Returns all of the submissions of a particular user.
if $min is specified, only submissions with ID larger than $min will be returned.
$hunter = new Hunter\Hunter();
var_dump($hunter->userSubmissions(343417));Returns the last $count submissions of a particular user.
$hunter = new Hunter\Hunter();
var_dump($hunter->userLatestSubmissions(343417));Returns all the submissions of the users on specific problems.
Possible $type values are id and num. This changes whether you pass problem id's or problem num's as the second argument.
$hunter = new Hunter\Hunter();
var_dump($hunter->userProblemSubmissions(343417, 36);Get The Bit-Encoded-Problem IDs that Has Been Solved by Some Authors.
$hunter = new Hunter\Hunter();
var_dump($hunter->userSolvedProblems(343417));Returns the user's ranklist and their closest neighbors.
$hunter = new Hunter\Hunter();
var_dump($hunter->userRanklist(343417, 10, 10));Global ranklist, starteing from $rank to $rank+$count
$hunter = new Hunter\Hunter();
var_dump($hunter->ranklist(1, 100));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.
$hunter = new Hunter\Hunter();
var_dump($hunter->setSource('http://icpcarchive.ecs.baylor.edu/uhunt/api/'));Returns the current used API source.
$hunter = new Hunter\Hunter();
var_dump($hunter->getSource());

