UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Volleyball Tournament Teams    
 
   
gary84
post Oct 10 2015, 09:04 PM
Post#1



Posts: 369
Joined: 20-May 07



would someone be interested in writing this in php. i'm toying with the idea of learning enough php to do it myself but it seems pretty advanced.


--------------------------------------------------------------
app name: RRAP
description: rank, randomize, alternate-pick
purpose: php webpage to create tournament teams
-------------------------------
filename: vb_config.txt
fields: parameter, value
order: meaningless
content:
MaxTeams,5
MaxPlayersPerTeam,4
--------------------------------------------------------------
filename: vb_players.txt
fields: playerID,fullname,gender,rank
order: meaningless
content:
323,Rosetta Slaugh,M,1.2 A
342,Mumson Fikes,M,1.2 A
466,Louie Waite,M,1.2 A
377,Eustolia Hilt,M,1.2 A
304,Tyesha Delany,M,1.2 A
313,Vella Widrick,M,1.2 A
87,Lawanna Duffel,M,1.1 A +
467,Nicola Barreras,M,1.1 A +
238,Anamaria Swink,F,2.1 B+
409,Barb Mertes,M,1.2 A
305,Cristine Lago,M,3.2 C
420,Deonna Fabrizio,F,3.1 C+
404,Esteban Auslander,M,2.1 B+
378,Filiberto Cerda,M,2.1 B+
518,Fred Barber,M,1.2 A
280,Hedwig Glover,F,2.1 B+
514,Israel Rosa,M,2.2 B
98,Jasper Lipka,F,2.1 B+
23,Jenice Thibert,F,2.1 B+
406,Jule Seefeldt,M,2.2 B
320,Lahoma Nimmons,F,3.1 C+
357,Lucy Jamal,M,2.2 B
303,Lynnette Nino,F,2.2 B
32,Marcelino Halberg,M,2.1 B+
318,Mechelle Stouffer,F,2.2 B
92,Noel Krom,F,4 D
384,Rosalyn Barfield,M,2.1 B+
516,Sammy Hammond,M,2.1 B+
246,Sharla Lachapelle,M,1.2 A
380,Tarah Landgraf,M,2.1 B+
283,Tayna Kirsch,M,2.1 B+
70,Zelma Shott,F,2.2 B
--------------------------------------------------------------
filename: vb_signedin.txt
fields: fullname,role
order: TeamCaptains in order of weakest-to-strongest. Player order meaningless.
content:
Mumson Fikes,TC
Louie Waite,TC
Tyesha Delany,TC
Vella Widrick,TC
Barb Mertes,TC
Cristine Lago,player
Deonna Fabrizio,player
Esteban Auslander,player
Filiberto Cerda,player
Fred Barbe,player
Hedwig Glover,player
Israel Rosa,player
Jasper Lipka,player
Jenice Thibert,player
Jule Seefeldt,player
Lucy Jamal,player
Lynnette Nino,player
Marcelino Halberg,player
Rosalyn Barfield,player
Zelma Shott,player
--------------------------------------------------------------
user guide

1. use ftp to edit the 3 files described above.
2. navigate to webpage and click "RUN".
3. read contents of tall wide RESULT TEST BOX on webpage to see results.
4. if needed, click "RUN" repeatedly to replace contents of RESULT TEST BOX.

there are 2 genders: M;F.
there are 7 ranks: 1.1 A+; 1.2 A; 2.1 B+; 2.2 B; 3.1 C+; 3.2 C; 4 D.
-------------------------------
processing

distribute team captains, one per team, where team 1 has the weakest captain.
when distributing players, always alternate the team picking order: 1,2,3,4,4,3,2,1,1,2,3,4 (the 4th captain gets the 4th and 5th pick).
randomize all players within their gender and rank.
distribute male players.
distribute female players.
show results.
-------------------------------
output sample, as shown in RESULT TEST BOX

1,1,Mumson Fikes, TC
1,2,Fred Barbe
1,3,Hedwig Glover
1,4,Jasper Lipka
2,1,Louie Waite, TC
2,2,Marcelino Halberg
2,3,Cristine Lago
2,4,Jenice Thibert
3,1,Tyesha Delany, TC
3,2,Esteban Auslander
3,3,Jule Seefeldt
3,4,Zelma Shott
4,1,Vella Widrick, TC
4,2,Rosalyn Barfield
4,3,Israel Rosa
4,4,Lynnette Nino
5,1,Barb Mertes, TC
5,2,Filiberto Cerda
5,3,Lucy Jamal
5,4,Deonna Fabrizio
-------------------------------
Go to the top of the page
 
GroverParkGeorge
post Oct 10 2015, 09:45 PM
Post#2


UA Admin
Posts: 31,263
Joined: 20-June 02
From: Newcastle, WA


Before someone takes on a project like this, it helps to be clear on expectations and assumptions.

Have you established a budget for this project? Do you have a rough estimate of the time required? Do you have an hourly rate in mind which you're willing to pay?

Do you already have a domain and web presence on which to host the finished pages? Do you plan to integrate it into an existing site?

How will security be handled? Is this open to the public?

Will teams or members be able to make changes, or only the site owner?

What long term storage is needed? I.e. is a database required?
Go to the top of the page
 
Jeff B.
post Oct 11 2015, 06:46 AM
Post#3


UtterAccess VIP
Posts: 9,886
Joined: 30-April 10
From: Pacific NorthWet


... and to add to George's list of clarifications, what "skill level" will you be targeting? That is, will the folks using this be experienced data-entry types or will they have trouble knowing how to turn on a computer?
Go to the top of the page
 
gary84
post Dec 30 2015, 12:27 PM
Post#4



Posts: 369
Joined: 20-May 07



I chose to try to figure it out. Didn't take as long as I thought. Probably not the most optimized php ever written but it works.

electronrock.com/php/vb_signin.php

The hard part was vb_teams.php that's where the randomizing logic is.

CODE
<html><body>
<a href="vb_rank.php">Rank List</a></br>
<a href="vb_signin.php">Signin List</a></br>
<a href="vb_teams.php">Teams</a></br>
<a href="vb_userguide.php">User Guide</a></br>
---------------------------------</br>
Randomly Generated Teams:</br>
<?php
$boolgenerate = TRUE;

// save displayed most-recently-generated team list
if($_POST['savebutton']){
    $strwhole = stripslashes($_POST['textarea1']);
    $file = fopen("vb_teams.txt","w") or die ("error");
    fputs($file,$strwhole);
    fclose($file) or die ("error");
    echo "List Saved</br>";
    $boolgenerate = FALSE;}

// recall older saved team list
if($_POST['recallbutton']){
    $file = "vb_teams.txt";
    $strwhole = file_get_contents($file);
    echo "List Recalled</br>";
    $boolgenerate = FALSE;}

// generate fresh randomized team list    
if ($boolgenerate == TRUE){
    // input lists
    $signinlist = array_map('str_getcsv', file('vb_signin.txt'));
    $ranklist = array_map('str_getcsv', file('vb_rank_.txt'));

    // validate players on signin list are on rank list
    foreach($signinlist AS $signin){
        $boolfound = FALSE;
        foreach($ranklist AS $rank){
            if (strtolower(trim($signin[0])) == strtolower(trim($rank[2]))){
                $boolfound = TRUE;}}
        if (!$boolfound){
            echo "ERROR missing rank: $signin[0]</br>";}}
            
    // validate no duplicate players on signin list
    $signingroup = array();
    foreach($signinlist AS $signin){
        $player=strtolower(trim($signin[0]));
        if ($player != ""){
                $signingroup[$player]++;}}
    foreach($signingroup AS $signin => $qty){
        if ($qty > 1){
            echo "ERROR duplicate signin: $signin</br>";}}
    
    // group by rank type
    $rankgroup = array();
    foreach($ranklist AS $rank){
        $r=strtolower(trim($rank[1]));
        if ($r != ""){
            if (!in_array($r, $rankgroup)){
                $rankgroup[] = $r;
                $intrank++;}}}
    if ($intrank > 7){
        echo "ERROR ranks exceed 7</br>";}

    // sort rank types alphabetically
    sort($rankgroup);

    // randomize, 1st by gender, 2nd by rank, create picklistA
    shuffle($ranklist); // randomize all players
    $picklistA = array();
    $gender = array("M","F");
    $intgender = 0;
    do{
        foreach($rankgroup as $rankloop){             // one loop per rank type  
            foreach($ranklist AS $rank){              // one loop per rank list player
                foreach($signinlist AS $signin){      // one loop per signin list player
                    if (strtolower(trim($signin[0]) != "")){
                        if (strtolower(trim($rank[2]) == trim($signin[0]))){   // is player ranked
                            if (trim($rank[0]) == $gender[$intgender]){        // do males then females
                                if (strtolower(trim($rank[1])) == $rankloop){  // do one rank type
                                    if (strtolower(trim($signin[1])) != "tc"){ // exclude captains
                                        $picklistA[] = trim($rank[2]);}}}}}}}} // append to picklist
        $intgender++;}
    while ($intgender <= 1);

    // create array of captains, count them, dictates qty teams
    $intcaptains=0;
    foreach($signinlist AS $signin){
        if (strtolower(trim($signin[1])) == "tc"){
            $captain[$intcaptains] = trim($signin[0]);
            $intcaptains++;}}

    // apply alternating-order, create picklistB
    $intpickdirection = 1;
    $intteam = 0;
    $intplayer = 0;
    foreach($picklistA AS $pick){
        if ($pick!=""){    
            $picklistB[$intplayer][0] = ($intteam+1);
            $picklistB[$intplayer][1] = $intplayer;
            $picklistB[$intplayer][2] = $pick;
    
            if ($intpickdirection == 1){
                $intteam++;
                if ($intteam == $intcaptains){
                    $intpickdirection = 2;
                    $intteam = $intcaptains-1;}}
            else{
                $intteam = $intteam - 1;
                if ($intteam == -1){
                    $intpickdirection = 1;
                    $intteam = 0;}}
            $intplayer=$intplayer+1;}}
    
    // sort players by team number
    sort($picklistB);

    // display teams
    $intplayer=1;
    $intteam = -1;
    $indent = "&nbsp&nbsp";
    foreach($picklistB AS $pick){
        if ($pick[0]!=($intteam+1)){
            $intteam = ($pick[0]-1);
            $strwhole .= "Team ".($intteam+1)."</br>$indent$intplayer. $captain[$intteam]</br>";
            $intplayer++;}
        $strwhole .= "$indent$intplayer. $pick[2]</br>";
        $intplayer++;}
        echo "</br>";
}
$strwhole = str_replace("&nbsp", " ", $strwhole);
$strwhole = str_replace("</br>", "\r\n", $strwhole);

//metrics        
//echo "</br></br>";
//echo count($signinlist)." players on signin list</br>";
//echo count($ranklist)." players on rank list</br>";
//echo "$intrank unique ranks</br>";
//echo "rev_2015-12-26-2</br>";
?>

<form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post">
<input type="submit" name="savebutton" value="Save">
<input type="submit" name="recallbutton" value="Recall"></br>
<textarea rows="40" cols="35" name="textarea1"><?php echo $strwhole; ?></textarea></br>
</form

</body></html>

Attached File(s)
Attached File  files.zip ( 4.19K )Number of downloads: 1
 
Go to the top of the page
 
gary84
post Dec 30 2015, 01:06 PM
Post#5



Posts: 369
Joined: 20-May 07



correction #1:
in the URL above, change
from /php/vb_signin.php
to /php1005/vb_signin.php
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    18th December 2017 - 03:33 PM