kaspars/hunter
最新稳定版本:1.2.1
Composer 安装命令:
composer require kaspars/hunter
包简介
Hunter is an easy to use uHunt wrapper to receive information from UVA servers.
README 文档
README
Introduction
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.
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.
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"
}
}
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
Data Format
All data is returned as an associated array.
Problem format
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.
Submission format
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
Ranklist format
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"); // null
Examples
problems(void)
Returns an array of available UVa problems
$hunter = new Hunter\Hunter(); var_dump($hunter->problems());
problem(int $id, string $type = "id")
Retrieved data of a specific problem
$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
$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.
$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.
$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.
if $min is specified, only submissions with ID larger than $min will be returned.
$hunter = new Hunter\Hunter(); var_dump($hunter->userSubmissions(343417));
userLatestSubmissions(int $userID, int $count = 10)
Returns the last $count submissions of a particular user.
$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.
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);
userSolvedProblems(array|int $userIDs)
Get The Bit-Encoded-Problem IDs that Has Been Solved by Some Authors.
$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.
$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
$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.
$hunter = new Hunter\Hunter(); var_dump($hunter->setSource('http://icpcarchive.ecs.baylor.edu/uhunt/api/'));
getSource()
Returns the current used API source.
$hunter = new Hunter\Hunter(); var_dump($hunter->getSource());
统计信息
- 总下载量: 71
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-04-19