Creating a Tournament-style Bracket System

Tom Harrigan

Alley Interactive

Hi, I'm Tom

fac642e8fada29a09d895cdf4060430c

@TomHarrigan

ThomasHarrigan.com

Road to WordPress

Rootbuzz-PRODUCTIVE-300x119Kz2dhScreen-Shot-2015-04-08-at-3.44.10-PM-970x546code-theory

Alley Interactive

BZ0QRoPM

@AlleyDev

AlleyInteractive.com

Who are you?

tumblr_ln2hiep8DL1qg38ico1_500

How to Solve a Complex Problem

Start with whiskey

The-Whiskey-Ball

Using starter themes

genesis-theme-framework roots_wordpress_-_Google_Search Underscores___A_Starter_Theme_for_WordPress woothemes_-_Google_Search

Installs plugin. Uses 1 feature

original

March Madness

017090f553490b5ea80a85d9bab737eebfd4d718ed9490cd5342d7318a3d70bf

March Madness

635620648959976627513046929_March-Madness-2013

Bracket Essentials: Match-ups

Pairing up items and allowing users to vote.

Demo - Super Heroes

Super_Heroes___Decider

( modals, voting, rounds )

Applications of a Bracket

  • E-commerce
  • Classroom
  • Content

What's needed in a bracket?

  • Match-ups
  • Things to match up
  • Voting
  • Sharing

The building blocks are...

  • Match-ups – Polls ( polldaddy )
  • Things to match up – custom fields ( Fieldmanager)
  • Voting – Part of polls ( polldaddy )
  • Sharing – ( Sharedaddy/ Jetpack sharing module )

Enter Polldaddy

Create_Polls__Surveys___Quizzes_Quickly_and_Easily___Polldaddy_com

 

Polldaddy.com | Polldaddy Plugin

Polldaddy has an API

The_Polldaddy_API___Polldaddy_Support

Create Poll

{

Vote

_pdRequest___{

Get Results

_pdRequest___{

API Shortfalls

image

Polldaddy API only allows a single polls to be created at a time

Determining rounds

total number of items = 2^x

Where X = total rounds

Bracket of 32 items:

32 = 2^X

X = 4

So:

X = log2( total number of items )

$total_rounds = log( $total_number_items, 2 );

Creating matchups

Let’s take a look at the admin panel

Edit_Bracket_‹_Decider_—_WordPress

Seeds - Algorithmically

language_agnostic_-_Tournament_bracket_placement_algorithm_-_Stack_Overflow

Stack Overflow – Tournament Bracket Placement Algorithm

Seed spacing

language_agnostic_-_Tournament_bracket_placement_algorithm_-_Stack_Overflow

Seeds - Statically

class-post-type-bracket_php

Seeds - Statically

2class-post-type-bracket_php

Procession of Rounds

Calculate winners of previous rounds.

Match up the round winners.

Create new polls.

Quadrants, Semi finals, Finals

Filtering array data

Check out article by Jon David John
Pluck_and_Filter_Arrays_in_WordPress_-_Jonathan_D__Johnson

wp_list_filter

Pluck_and_Filter_Arrays_in_WordPress_-_Jonathan_D__Johnson

wp_list_pluck

Pluck_and_Filter_Arrays_in_WordPress_-_Jonathan_D__Johnson

Voting

nypost-bracket_js

Modals

Best__Dad__Ever____Decider___Where_To_Stream_Movies___Shows_on_Netflix__Hulu__Amazon_Instant__HBO_Go

Modal code

nypost-bracket_js

SimpleModal

SimpleModal___Eric_Martin___ericmmartin_com

Sharedaddy

nypost-bracket_js

Safety Mechanisms

vip_safe_wp_remote_get()

Disabling drag/drop ordering once Round 1 starts

Only allow next round to be chosen

 

vip_safe_wp_remote_get

vip-helper_php

Future Considerations

Displaying tightest match-ups

Handling a bye for rounds that are not a power of 2

Possibly a plugin?

Custom Fields

Fieldmanager

Custom field plugins

Beware of repeating fields

107365-lie-down-try-not-to-cry-cry-a-2GiD

Core Fields API

  • Check it out on Slack #core-fields
  • Check it out on Github

[Insert Questions Here]

man-asks-upset-woman-what-do-you-want-meme_45_paused