Games::Tournament::Contestant

A competitor matched with others over a series of rounds
Download

Games::Tournament::Contestant Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Dr Bean
  • Publisher web site:
  • http://search.cpan.org/~drbean/

Games::Tournament::Contestant Tags


Games::Tournament::Contestant Description

A competitor matched with others over a series of rounds Games::Tournament::Contestant is a generic tournament/series player/team contestant object.SYNOPSIS my $foo = Games::Tournament::Contestant->new( rating => '15', name => 'Your New Knicks' ); ...METHODSnew $team = Games::Tournament::Contestant->new( id => '15', name => 'Lala Lakers', rating => 0, score => 1000, ) $grandmaster = Games::Tournament::Contestant->new( name => 'Jose Raul Capablanca', rating => 1000 )clone $monster = $alekhine->clone( score => 1000, reputation => 'bad' )Creates a similar object to $alekhine, with the same id, name, score, title, and rating fields but with any other changes or additions you want to make.findCard @venues = $player->findCard(@games);Returns a/the first game in @games in which $player is a contestant. 'findCard' expects the game objects to have 'contestants' accessors and be 'canonize'able. The players are grepped for stringwise id equality.myOpponent $opponent = $player->myOpponent($game);Returns a/the opponent in $game of $player. 'myOpponent' expects the game object to have 'contestants' accessors. The players are grepped for stringwise id equality.copyCard @result = $player->copyCard(@games);Stores a ref to the @games in which $player has participated and copied the cards for. @games may or may not be a complete list of result for all rounds, and may include games in which $player wasn't a participant. Pushed to an anonymous array stored as the 'play' field. 'copyCard' expects the game objects to have 'round' and 'contestants' accessors and be 'canonize'able.writeCard (deprecated) @result = $player->writeCard(@games);Updates the contestant's result in the matches played, using no intelligence if records only have only opponents' scores. @games may or may not be a complete list of result for all rounds, and may include games in which $player wasn't a participant. Stored as a 'play' field and keyed on the round, the resultant records have 'opponent' and 'result' subfields. 'writeCard' expects the game objects to have 'round', 'contestants' and 'result' accessors. Returns the new play field. TODO The 'opponent' subfield will be an anonymous array of player objects if it is a multi-player game.score $rounds = $deepblue->score next if $deepblue->scoreGets/sets the total score over the rounds in which $deepblue has a score. Don't forget to tally $deepblue's scorecard with the appropriate games first! We don't check any cards. Internally, this method accumulates the results of all the rounds into a total score, unless no results exist. If they don't exist, a hash key $self->{score} is consulted. You can set the score this way too, bypassing the elegant code to do it from individual game results stored by the Games::Tournament::Contestant object. A hack to allow importing a pairing table.met $rounds = $deepblue->met(@grandmasters) next if $deepblue->met($capablanca)Returns an anonymous hash, keyed on @grandmasters' ids, either of the gamecards in which $deepblue remembers meeting the members of @grandmasters or of the empty string '' if there is no record of such a meeting. Don't forget to tally $deepblue's scorecard with the appropriate games first (using collectCards?)! We don't check $deepblue's partners' cards. (Assumes players do not meet more than once!) Don't confuse this with Games::Tournament::met!name $member->name('Alexander Alekhine'); $member->nameSets or gets the name of the contesting individual or team, a string that may or may not be unique to the tournament member.title $member->title('Grandmaster')Sets/gets the title of the contestant, a courtesy given to the contestant.scores $member->scoresSets/gets the scores (actually results, eg 'Draw', 'Win') of the contestant in the different matches of the tournament, an ongoing record of their standing in the competition. These scores may or may not include the current score. To calculate the total score, use 'score', because internally the scores are not stored as number scores.rating $member->ratingSets/gets the rating of the contestant, an estimate of their strength. The constructor assumes if no rating or a non-numeric rating is given, that they don't have a rating, and it is set to 0.play $games = $member->play; $games = $member->play( { $lastround => $game } );Sets/gets a hash reference to the result of the pairings in each of the rounds played so far. Don't use this to enter a player's match result. Use $tourney->collectCards. Implementation: The keys of the hash are the round numbers and the values are the gamecard of the player in that round. Very similar to the play accessor for tournaments, so this is not good repetition?id $member->idReturns/sets the id of the contestant, a number unique to the member. Requirements: · Perl


Games::Tournament::Contestant Related Software