Behind the scenes: @cryptocameo's glass giveaway contest!

in #glass8 years ago (edited)

Greetings steemers! You may have just arrived here from @cryptocameo's glass giveaway post, but if not you should definitely click that link and go check it out ;)

<h3>I will be acting as an impartial judge for the contestants in the giveaway <p dir="auto">I'll be using the program below to pick the winners, here's an easy to read screenshot as well as the full copy/pasteable text for those of you who might be so inclined to run it.<br /> <img src="https://images.hive.blog/768x0/https://www.steemimg.com/images/2016/09/07/Capturea8086.png" srcset="https://images.hive.blog/768x0/https://www.steemimg.com/images/2016/09/07/Capturea8086.png 1x, https://images.hive.blog/1536x0/https://www.steemimg.com/images/2016/09/07/Capturea8086.png 2x" /><br /> <code> <p dir="auto">package winnerpicker;<br /> import static java.lang.System.out;<br /> import java.util.ArrayList;<br /> import java.util.Arrays;<br /> import java.util.Random; <p dir="auto">public class WinnerPicker { <pre><code>public static void main(String[] args) { ArrayList<String> contestants=new ArrayList<>();//build contestants arraylist String[] dumpToContestants= new String[]{"a","b","c","d","e","f","g","h"}; //this is the list of contestants contestants.addAll(Arrays.asList(dumpToContestants));//dump list of contestants into arraylist out.println("The contestants are "+Arrays.toString(contestants.toArray())); Random r = new Random(); int result=0; int place=1; while(contestants.isEmpty()==false)//keep choosing winners until there are no more contestants { result=r.nextInt(contestants.size()); out.println("["+place+"]:"+contestants.get(result));//declare contestant's ranking overall contestants.remove(result); place++; //increment place variable before moving on to next contestant } } <p dir="auto">} <p dir="auto"> <p dir="auto">So, basically what this code does is take a list of <strong>n contestants and rank them in a random order. All contestants will be able to see what place they got for full transparency, but only the first <strong>x contestants will get prizes as outlined by the rules of the specific giveaway... <h6><em>hint: more to come in the future perhaps ;) <p dir="auto"><a href="http://webm.land/media/tmp/3a2a0a4d-d70d-4f24-8ca8-7aabc2cd817b.webm" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Here you can find a brief video of me explaining the code: I'm not going to teach you java in 5 minutes but hopefully even if you don't know anything about code you'll be able to grasp what is going on from watching the following enough to understand the contest! <p dir="auto">Feel free to ask questions below in the comment section :)
Sort:  

Sorry everybody! It looks like my original video link broke! You can find a mirror I've uploaded here!

Amazing work! Thanks for your help @desmonid

This will be a lot of fun.

nice job, really cool way to do a giveaway