// HW9 // Put the required comments below: // Jennifer Shin // Section D // jshin1@andrew.cmu.edu // Copyright © Jennifer Shin April 2011 Pittsburgh, PA 15221 All Rights Reserved // // /*************************** Travel through NYC from 42nd Street (Times Square) to Canal Street on the N subway line.
The N train travels on Broadway Ave in the Manhattan Borough.
To head downtown, press the down arrow key.
And to head uptown, press the up arrow key.
To know what station you are currently at, look at the right hand side of the screen.
There you will be notified when the station has changed.
After you leave the subway station, there are two places you can go visit.
The bottom left box will always have info on an eatery, since eating is extremely important.
The bottom right box will have interesting places to go. Let's mix things up!
**********************************/ PImage p1; String [ ] stations = {"42 Street", "34 Street","28 Street","23 Street", "14 Street","8 Street","Prince Street","Canal Street"}; String [ ] names = {"John's Pizzeria","M&M World","Chipotle Mexican Grill", "Empire State Building","The Red Cat","Ace Hotel","Shake Shack", "Hotel Giraffe","Blue 9 Burger","Strand Book Store","Gyu-Kaku", "Washington Square Park","Dean & Deluca","Rice To Riches", "Ten Ren's Tea Time","Columbus Park"}; String [ ] info3 = {"smart casual pizzeria","candy galore","Mexican fast food joint", "tourist attraction","smart casual restaurant","hotel","American fast food joint", "hotel","burger joint","books galore","Japanese BBQ","park filled with events", "massive grocery store","rice pudding experts","bubble tea masters", "great people-watching park"}; String [ ] info1 = {"260 W 44th St","1600 Broadway","304 W 34th St", "350 5th Ave","227 10th Ave","20 W 29th St","11 Madison Ave #1", "365 Park Ave South","92 3rd Ave","828 Broadway","34 Cooper Sq", "1 5th Ave","560 Broadway","37 Spring St","79 Mott St","67 Mulberry St"}; char [ ] info2 = {'3','7','2','2','9','1','0','5','4','0','3','3','0','5','6','6'}; String [ ] info4 = {"brick oven pizza that's to die for","beware: crazy flavors", "big food for big men","do not jump off","neat bent forks and spoons as decor", "get comfortable","worth the long wait","no actual giraffes", "best burger sauce ever","interesting finds for $1", "discount specials every day","enjoy the sun and homeless men", "overpriced mediocre food","innovative rice pudding", "best bubble tea you will ever drink","play soccer and observe Asian festivals"}; int t, x; void setup ( ) { size ( 750, 500 ); p1 = loadImage ( "p1.jpg" ); image ( p1, 0, 0, width, height ); fill ( 255 ); rect ( .2*width, .8*height, .39*width, .19*height ); rect ( .6*width, .8*height, .39*width, .19*height ); fill ( 0 ); rect ( .21*width, .81*height, .37*width, .17*height ); rect ( .61*width, .81*height, .37*width, .17*height ); rect ( .89 * width, .1 * height, .11 * width, .18 * height ); x = 0; t = 0; fill ( 255 ); textSize ( 14 ); text ( names[t], .22*width, .81*height, .37*width, .17*height ); text ( info1[t], .22*width, .87*height ); text ( info2[t] + " blocks away", .22*width, .93*height ); text ( info3[t], .22*width, .90*height ); text ( info4[t], .22*width, .96*height ); text ( names[t+1], .62*width, .81*height, .37*width, .17*height ); text ( info1[t+1], .62*width, .87*height ); text ( info2[t+1] + " blocks away", .62*width, .93*height ); text ( info3[t+1], .62*width, .90*height ); text ( info4[t+1], .62*width, .96*height ); textSize ( 18 ); text ( stations[x], .9*width, .12*height, .1*width, .18*height); text ( "Shindig's Guide to NYC (on 1/4 of the N train)", .08*width, .05*height ); } void draw ( ) { endpoints ( ); } void endpoints ( ) { fill ( 255 ); textSize ( 14 ); text ( stations[0], .06*width, .875*height ); text ( "Manhattan", .06*width, .9*height ); text ( stations[stations.length-1], .06*width, .95*height ); text ( "Manhattan", .06*width, .975*height ); } void placesToGo ( ) { fill ( 0 ); rect ( .21*width, .81*height, .37*width, .17*height ); rect ( .61*width, .81*height, .37*width, .17*height ); fill (255); text ( names[t], .22*width, .84*height ); text ( info1[t], .22*width, .87*height ); text ( info2[t] + " blocks away", .22*width, .93*height ); text ( info3[t], .22*width, .90*height ); text ( info4[t], .22*width, .96*height ); text ( names[t+1], .62*width, .81*height, .37*width, .17*height ); text ( info1[t+1], .62*width, .87*height ); text ( info2[t+1] + " blocks away", .62*width, .93*height ); text ( info3[t+1], .62*width, .90*height ); text ( info4[t+1], .62*width, .96*height ); } void keyPressed ( ) { // if ( key == 'j') // { // saveFrame("HW9.jpg"); // } if ( key == CODED ) { if ( keyCode == DOWN ) { if ( x < stations.length && t < names.length-2 ) { t=t+2; placesToGo ( ); x++; fixInitials ( ); } else { x = stations.length - 1; fixInitials ( ); } } else if ( keyCode == UP ) { if ( x > 0 && t > 0 ) { t=t-2; placesToGo ( ); x--; fixInitials ( ); } else { x = 0; fixInitials ( ); } } } } void fixInitials ( ) { if ( x < stations.length && x >= 0 ) { fill ( 0 ); rect ( .89 * width, .1 * height, .11 * width, .18 * height ); fill ( 255 ); textSize ( 18 ); text ( stations[x], .9*width, .12*height, .1*width, .18*height ); } } //http://articles.nydailynews.com/2008-12-14/local/17912417_1_mta-plan-mta-board-subway-stations //http://www.yelp.com/biz/johns-pizzeria-new-york-2 //http://www.mymms.com/merchandise/locations.aspx //http://www.chipotle.com/en-US/Default.aspx?type=default //http://www.esbnyc.com/ //http://www.theredcat.com/redcat.php //http://www.acehotel.com/ //http://www.shakeshack.com/ //http://www.hotelgiraffe.com/ //http://www.yelp.com/biz/blue-9-burger-new-york-2 //http://www.strandbooks.com/ //http://www.gyu-kaku.com/ //http://www.nycgovparks.org/parks/washingtonsquarepark //http://www.deandeluca.com/ //http://www.ricetoriches.com/puddy.aspx //http://www.tenren.com/ //http://www.nycgovparks.org/parks/M015/