AP PT CodePrint © Baker Franke 2017
A one-stop shopping browser tool for preparing your code to submit for the AP CSP Performance Tasks.
If you can print a PDF from the browser, this should be everything you need.
▸ Update: nov 13, 2018 (click to expand)
(1) Type (or paste) your code into the big box below. Add titles if you like. Click this button Prettify if you don't see the code being laid out prettily below.
Project Title: U.S. National Park GeneratorOther Text:
var index;
if (category === "small" && [Link] > 0) {
index = randomNumber(0, [Link] - 1);
return {
name: filteredSmallNames[index],
location: filteredSmallLocations[index],
description: filteredSmallDescriptions[index],
image: filteredSmallImages[index]
};
} else if (category === "large" && [Link] > 0) {
index = randomNumber(0, [Link] - 1);
return {
name: filteredLargeNames[index],
location: filteredLargeLocations[index],
description: filteredLargeDescriptions[index],
image: filteredLargeImages[index]
};
(2) Set font size and draw shapes on the code. (3) Hide the controls. (4) Print to PDF from the browser.
Font Size: 12px | Draw Shape: Rect Clear Rect Clear All
Hide/Show Controls Print
U.S. National Park Generator
1 var names = getColumn("US National Parks", "Name");
2 var images = getColumn("US National Parks", "Image");
3 var locations = getColumn("US National Parks", "Location");
4 var description = getColumn("US National Parks", "Description");
5 var acresArea = getColumn("US National Parks", "Area in acres");
6
7 // Purpose: Move the user to the "bigger_or_smaller_park_screen"
8 //when the start button is clicked.
9 onEvent("start_button", "click", function() {
10 setScreen("bigger_or_smaller_park_screen");
11 playSound("sound://category_app/app_button_3.mp3", false);
12 });
13
14 // Purpose: Reset the app and clear displayed data when the user clicks the restart
15 //button.
16 onEvent("restart_button", "click", function() {
17 setScreen("national_park_home_screen");
18 setProperty("description_text_area", "text", "");
19 setProperty("location_text_area", "text", "");
20 setProperty("name_text_area", "text", "");
21 setProperty("random_image", "image", "");
22 playSound("sound://category_app/app_button_click_1.mp3", false);
23 });
24
25 var filteredSmallNames = [];
26 var filteredSmallLocations = [];
27 var filteredSmallImages = [];
28 var filteredSmallDescriptions = [];
29 var filteredLargeNames = [];
30 var filteredLargeLocations = [];
31 var filteredLargeImages = [];
32 var filteredLargeDescriptions = [];
33 var area = "";
34
35 // Filter parks into smaller and larger categories
36 updateScreen();
37
38 // Purpose: Take the user to the results screen and store their selection of park size.
39 onEvent("next_button", "click", function() {
40 setScreen("results_screen");
41 area = getText("size_dropdown");
42 playSound("sound://category_app/app_button_2.mp3", false);
43 });
44
45 // Purpose: Display a random park based on the user’s selected size (small or large).
46 onEvent("get_park_button", "click", function() {
47 var park;
48 if (area == "Smaller parks") {
49 park = getRandomPark("small");
50 } else if (area == "Larger parks") {
51 park = getRandomPark("large");
52 }
53
54 if (park) {
55 setText("name_text_area", [Link]);
56 setText("location_text_area", [Link]);
57 setText("description_text_area", [Link]);
58 setProperty("random_image", "image", [Link]);
59 }
60
61 playSound("sound://category_app/app_button_5.mp3", false);
62 });
63
64 // Purpose: Categorize parks into "small" (area < 20,000 acres) and "large"
65 //(area ≥ 20,000 acres).
66 function updateScreen() {
67 for (var i = 0; i < [Link]; i++) {
68 if (acresArea[i] < 20000) {
69 appendItem(filteredSmallNames, names[i]);
70 appendItem(filteredSmallLocations, locations[i]);
71 appendItem(filteredSmallImages, images[i]);
72 appendItem(filteredSmallDescriptions, description[i]);
73 } else {
74 appendItem(filteredLargeNames, names[i]);
75 appendItem(filteredLargeLocations, locations[i]);
76 appendItem(filteredLargeImages, images[i]);
77 appendItem(filteredLargeDescriptions, description[i]);
78 }
79 }
80 }
81
82 // Purpose: Get a random park based on the category ("small" or "large").
83 // Functionality: Returns an object containing the name, location, description, and
84 //image of a randomly selected park.
85 function getRandomPark(category) {
86 var index;
87 if (category === "small" && [Link] > 0) {
88 index = randomNumber(0, [Link] - 1);
89 return {
90 name: filteredSmallNames[index],
91 location: filteredSmallLocations[index],
92 description: filteredSmallDescriptions[index],
93 image: filteredSmallImages[index]
94 };
95 } else if (category === "large" && [Link] > 0) {
96 index = randomNumber(0, [Link] - 1);
97 return {
98 name: filteredLargeNames[index],
99 location: filteredLargeLocations[index],
100 description: filteredLargeDescriptions[index],
101 image: filteredLargeImages[index]
102 };
103 }
104 return null;
105 }
106
107 //Mountain image in the home screen is from [Link]
108 //A%2F%[Link]%2Ffree-png%2Fmountains-png&psig=AOvVaw3TXx2AwGLzbMZcywa-GJd1&
109 //ust=1734484372193000&source=images&cd=vfe&opi=89978449&ved=0CBQQjhxqFwoTCOi19vjPrYoDF
110 //QAAAAAdAAAAABAE
111 //All the tree images in the home screen is from [Link]
112 //20730/ourmid/pngtree-isolated-redwood-tree-on-transparent-background-png-image_609291
113 //[Link]
114 //Lake image in the home screen is from [Link]
115 //thumbnails/041/713/973/small_2x/ai-generated-serene-lake-with-lush-green-mountainous-
116 //[Link]
117 //Birds image in the home screen is from [Link]
118 //humbnails/021/594/744/small/flying-birds-silhouettes-pattern-wallpaper-transparent-is
119 //[Link]
120 //Sunset in the question screen is from [Link]
121 //The canynon photo in the question screen is from [Link]
122 ///resources/thumbnails/049/515/092/small/majestic-sandstone-canyons-at-sunset-in-a-
123 //[Link]
124 //the birds image in the question screen is from [Link]
125 //40206/ourmid/pngtree-birds-fly-in-the-clouds-png-image_11668057.png
126 //The tree images in the results screen is from [Link]
127 ///resources/thumbnails/037/500/612/small/[Link]
128 //The plot of land in the results screen is from [Link]
129 ///resources/thumbnails/041/714/021/small/ai-generated-lush-green-forest-covering-seren
130 //[Link]
131
132
PDF document made with CodePrint using Prism