Sunday, February 2, 2014

Coding for birdies (or even albatrosses)! - by Maverick McNealy


As "Nerd Nation" golfers, who hasn't spent hours conjuring up designs for golf holes on Paint or some other computer art program? 

Yes, we've all done it! 

But... how many of us could actually write the artwork's computer code from scratch?


Here below, Maverick McNealy shares with us his coding "artistry" from one of his computer science classes and how he has already coded some great golf shots...


TO JUMP THE CODE AND GO STRAIGHT TO THE PICTURE click here >>



/*
 * File: Artistry.java
 * Name: Maverick McNealy
 * Section Leader: Matt Lathrop
 * ==========================================================
 * This is a pretty awesome picture. It is what I hope happens a lot this year for
 * our team! (Funny thing, because in the week after I programmed this, Keegan English made a hole-in-one on hole 7 at Peninsula G&CC, David Boote made a hole-in--one on hole 1 of the Peter Hay par 3 course at Pebble Beach and Viraat Badhwar made a double eagle on hole 12 at Fort Ord - Black Horse!!!)
 */


import java.awt.Color;

import acm.graphics.GLabel;
import acm.graphics.GOval;
import acm.graphics.GLine;
import acm.graphics.GRect;
import acm.program.*;

public class Artistry extends GraphicsProgram {
     
      //makes the best picture in the history of GraphicsProgram pictures (GO STANFORD GOLF!!)
      public void run() {
            addPuttingGreen();
            addSandTrap1();
            addSandTrap2();
            addLake();
            addHole();
            addPin();
            addBall();
            addSignature();
      }
     
      //Adds a green oval putting green
      private void addPuttingGreen() {
            GOval puttingGreen = new GOval (400, 300);
            puttingGreen.setColor(Color.green);
            puttingGreen.setLocation(150,50);
            puttingGreen.setFillColor(Color.green);
            puttingGreen.setFilled(true);
            add(puttingGreen);
      }
     
      //adds a yellow oval sand trap to the bottom-left of the green
      private void addSandTrap1() {
            GOval sandTrap1 = new GOval (100,100);
            sandTrap1.setColor(Color.yellow);
            sandTrap1.setLocation(100,300);
            sandTrap1.setFillColor(Color.yellow);
            sandTrap1.setFilled(true);
            add(sandTrap1);  
      }
     
      //adds a yellow oval sand trap to the bottom-right of the green
      private void addSandTrap2() {
            GOval sandTrap2 = new GOval (100,200);
            sandTrap2.setColor(Color.yellow);
            sandTrap2.setLocation(550,230);
            sandTrap2.setFillColor(Color.yellow);
            sandTrap2.setFilled(true);
            add(sandTrap2);
      }
     
      //adds a blue oval lake to the top left of the screen
      private void addLake() {
            GOval lake = new GOval (300, 500);
            lake.setColor(Color.blue);
            lake.setLocation(-150, -250);
            lake.setFilled(true);
            add(lake);
      }
     
      //adds a black oval hole in the left center of the putting green
      private void addHole() {
            GOval hole = new GOval (20,10);
            hole.setLocation(250,250);
            hole.setFilled(true);
            add(hole);
      }
     
      /*adds a black line (flagstick), coming out of the hole, with a red rectangle flag on
       * the top of the flagstick
       */
      private void addPin() {
            GLine flagStick = new GLine (260, 260, 260, 140);
            add(flagStick);
           
            GRect flag = new GRect (260, 140, 30, 20);
            flag.setColor(Color.red);
            flag.setFilled(true);
            add(flag);
      }
     
      //adds a white circle golf ball with black outline and two black horizontal lines to its top right
      private void addBall() {
            GOval ball = new GOval (7, 7);
            ball.setLocation(280, 230);
            ball.setFillColor(Color.white);
            ball.setColor(Color.black);
            ball.setFilled(true);
            add(ball);
           
            GLine streak1 = new GLine (291, 230, 301, 220);
            add(streak1);
           
            GLine streak2 = new GLine (287, 227, 297, 217);
            add(streak2);
      }
     
      //adds a red signature flush up against the bottom right corner of the screen.
      private void addSignature() {
            GLabel signature = new GLabel ("Artistry by Maverick McNealy. Go Stanford Golf!");
            signature.setFont("Sans Serif-25");
            signature.setColor(Color.red);
            Double xCoordinate = getWidth() - signature.getWidth();
            Double yCoordinate = getHeight() - signature.getDescent();
            signature.setLocation(xCoordinate, yCoordinate);
            add(signature);
      }

}


hole-in-one!

Wednesday, January 29, 2014

Cameron Wilson blog - January 2014

Cameron Wilson reflects upon his time on The Farm and has "unfinished business" to attend to...


            I’d like to take this opportunity to write a bit about my time on the golf team at Stanford.  Several of these blog posts have given detailed descriptions of some of the experiences which make being a Stanford golfer so special. Members of our team have played Cypress Point and Augusta National and been privileged to meet people who have been incredibly successful in business and politics. We are fortunate to travel to exotic locales such as Hawaii and Scotland and compete on some of the best courses in America. But rather than list the many highlights of my time at Stanford, I’d prefer to give a glimpse into the evolution of my own golf game over the last few years.

            Before I arrived at Stanford, I knew I wanted to play professional golf for a living. The odds are stacked against any junior golfer dreaming of winning majors and playing in Ryder Cups. Still, I knew that Stanford was the right place to come if I wanted to prepare myself to succeed on the course or in anything else were professional golf not to pan out. I was confident in my abilities but knew that I needed to improve certain areas of my game were I to compete at the highest level. I thought (not unreasonably) that four years of great competition, weather, and facilities would be all I could ask for in terms of trying to play my best golf. As I look back now, I realize I was accurate in this judgement.

            There is no question that I am a better player now than I was at the start of my freshman year. That is not to say that the path of improvement has been consistent or easy to follow. Other golfers can understand that making significant gains is hard work and often involves some backward steps for every few that are forward. That said, I’ve come to a point in my game where I know as well as I ever have what I must practice to play good golf. Very simply put, I understand the factors most strongly correlated to hitting good shots with every club in my bag. Rarely will I practice something that is not closely related to the quality of my shots be they drives, short game shots, or putts. Too often, golfers spend time working on making changes to their game that are based on incorrect or incomplete information and as such will not make a marked difference in the shots they hit. Through some extensive thought and analysis (along with some frustration and dead ends), I’ve come to a few conclusions which when applied to how I play and practice have helped me improve.

            Some of these are quite technical in nature. A putting grip change during my sophomore year at the behest of my coaches was a huge breakthrough for me. I’ve been fortunate that our program has a Trackman launch monitor which has enabled me to better understand ball flight and my own swing. Through some statistical analysis I’ve gained insights into how to play certain courses and most importantly what strategy to use off the tee. These gains may seem small but when added together it is easy to see why I’m a better player now than I was three years ago. In black and white terms, my scoring average has improved every year as have my finishes in most tournaments.

            It would be hard to thank all the people who have helped me along the way. Coaches Ray and Rowe and my swing coach Debbie all deserve a great deal of thanks. The same can be said for our trainer Jason who has helped me become fitter and more aware of how to take care of my body. I also have to thank all of my teammates who have been great to play with and from whom I have learned plenty about all parts of the game. Simply put, I’ve made an effort to seek out people with knowledge and learn from them. At our program, that is easy to do and for that I’m thankful. At this point I plan on playing professional golf after graduation this June and couldn’t be more excited to make that step. Hopefully I can continue on this path of improvement and keep learning. Being a part of this program made a lot of information and resources accessible to me and that is not the norm at most college teams. I know I’ll have a good chance of success if I can find another golf environment that is competitive, intellectually stimulating, and has people from whom I can learn.

            Before all that becomes a reality, I have some unfinished business here on the Farm. The past three years has seen some encouraging team success but we haven’t played well in the postseason. We are working hard to ensure that is not the case this year. I aim to make the most of my last season of college golf and am excited about our team’s chances this spring. We have as talented a group as I’ve seen in my time here. Thus far we have seen contributions from members of every class and several of the guys have made some big breakthroughs since September. Qualifying has been competitive and it has taken low scores to crack our starting lineup. Our schedule until the postseason is extremely competitive and we couldn’t ask for a better scenario to test our games and keep getting better. I’m confident this team will have a successful year but I don’t want to say any more than that!

            I can’t finish this blog without giving thanks to our many supporters near Stanford and around the world. A young golfer couldn’t find a better situation no matter how hard he tried. We have great facilities and weather, fantastic donors, and a tournament schedule that is second to none. All of this is due to the continued support of our donors, alumni, and volunteers. Know that all of the team members appreciate your efforts and that you want us to succeed on and off the course.

Go Card!
Cameron


Cameron's course record round of 61 at Cordevalle is proudly hung on the wall in the Stanford Coaches Office

Twitter Star... Cameron graces the @stanfordmgolf scene!
https://twitter.com/stanfordmgolf