diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..fed464b1 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,217 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) 2011 Teaching Kids Programming (http://www.teachingkidsprogramming.org). All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +## Contributors: +* Lynn Langit +* Samantha Langit +* James Counts +* Genevieve L'Esperance +* Jessica Ellis +* Matt Ballin +* Llewellyn Falco +* Katrina Owen +* June Clarke +* Brick Ellis +* David Coopersmith +* Edgar Melendrez +* Alex Puente +* 8th Grade students from PALM STEM Academy - Moreno Valley, CA - class of 2015-2016 diff --git a/Ninite JDK 8 Installer.exe b/Ninite JDK 8 Installer.exe deleted file mode 100644 index 681459e1..00000000 Binary files a/Ninite JDK 8 Installer.exe and /dev/null differ diff --git a/README.md b/README.md index e0777af1..73a47af1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ -#Get Started With TKP +# Get Started With TKP -Setup your computer +Setup your computer for TKP based on its operating system: * [Windows](#windows) * [Mac](#mac) +* [Linux](#linux) ### Windows @@ -11,15 +12,15 @@ Setup your computer ![Create C:\TKPSource](/images/01CreateFolder.png?raw=true) -1. **Download** the TKP zip file from this site by clicking the `Download ZIP` button on the middle right side of this page (or use the link directly below this line). Wait for the download to complete. +1. **Download** the TKP zip file from this site by clicking the green `Clone or Download` button on the middle right side of this page, and then click the blue download zip button (or use the link directly below this line). Wait for the download to complete. - [![download zip button][2]][1] + [![download](/images/download_zip.png?raw=true)](https://github.com/TeachingKidsProgramming/TeachingKidsProgramming.Java/archive/master.zip) 1. **Move** the zip file from your **Downloads** folder to the **C:\TKPSource** folder. The name of the downloaded file is `TeachingkidsProgramming.Java-master.zip` ![Move zip to C:\TKPSource](/images/02MoveZip.png?raw=true) -1. **Unzip** the downloaded file. Right click on the zip file, and choose `Extract All...`. Next click `Extract` to create the TKP folder. +1. **Unzip** the downloaded file. Right-click on the zip file, and choose `Extract All...`. Next click `Extract` to create the TKP folder. ![Extract Zip](/images/03ExtractAll.png?raw=true) @@ -27,7 +28,7 @@ Setup your computer ![TKP Launcher](/images/04TKPLauncher.png?raw=true) -1. **Run** the `TKP_Launcher.jar` file by double-clicking it. Wait for it to run. *Tip* if the jar wont run, double check that you are double-clicking it from the extracted **folder** and not inside the **zip**. +1. **Run** the `TKP_Launcher.jar` file by double-clicking it. Wait for it to run. *Tip* if the jar won't run, double-check that you are double-clicking it from the extracted **folder** and not inside the **zip**. If the jar file runs ok, then Eclipse will launch with the TKP workspace open. A successful install should look like the screenshot below: (you can test with two lines of code below) @@ -36,7 +37,7 @@ Setup your computer Tortoise.move(50); ``` - ![screenshot of Eclipse](http://teachingkidsprogramming.org/blog/wp-content/uploads/2012/04/Screen-shot-TKP-Java1.png) + ![screenshot of Eclipse](/images/20Success.png?raw=true) If an error MessageBox pops up, you probably just need a little more setup, keep reading. @@ -71,7 +72,7 @@ Setup your computer ![Move zip to TKPSource](/images/09MoveZip.png?raw=true) -1. **Unzip** the downloaded file. Right click on the zip file, and choose `Open` to create the TKP folder. +1. **Unzip** the downloaded file. Right-click on the zip file, and choose `Open` to create the TKP folder. ![Extract Zip](/images/10Open.png?raw=true) @@ -79,7 +80,7 @@ Setup your computer ![TKP Launcher](/images/11TKPLauncher.png?raw=true) -1. **Run** the `TKP_Launcher.jar` file by double-clicking it. Wait for it to run. *Tip* if the jar wont run, double check that you are double-clicking it from the extracted **folder** and not inside the **zip**. +1. **Run** the `TKP_Launcher.jar` file by double-clicking it. Wait for it to run. *Tip* if the jar won't run, double-check that you are double-clicking it from the extracted **folder** and not inside the **zip**. If the jar file runs ok, then Eclipse will launch with the TKP workspace open. A successful install should look like the screenshot below: (you can test with two lines of code below) @@ -110,7 +111,7 @@ Setup your computer ![Choose JDK](/images/16JDK.png?raw=true) - On the next page there is a table of files you can download. First, accept the Java license by choosing `Accept License Agreement`. Now, find `Mac OS X x64` in the table and download the `dmg` file from the same row. + On the next page, there is a table of files you can download. First, accept the Java license by choosing `Accept License Agreement`. Now, find `Mac OS X x64` in the table and download the `dmg` file from the same row. ![Choose Mac DMG](/images/17JDK2.png?raw=true) @@ -120,17 +121,41 @@ Setup your computer ![Eclipse Missing](/images/18NoEclipse.png?raw=true) -1. **Download** [Eclipse Luna][3]. To extract the eclipse files, right-click on the `eclipse-java-luna-SR2-macosx-cocoa-x86_64.tar.gz` file and choose `Open`. Next, drag the `eclipse` folder to `Applications`. +1. **Download** [Eclipse Luna][3]. To extract the eclipse files, right-click on the `eclipse-java-luna-SR2-macosx-cocoa-x86_64.tar.gz` file and choose `Open`. Next, drag the `eclipse` folder to `Applications` for your username, i.e. //Applications. ![Move Eclipse](/images/19Eclipse.png?raw=true) When you have put `eclipse` into `Applications` try launching TKP again by double-clicking `TKP_Launcher.jar`. If it works, great! Otherwise, visit the [Fixing Installation Errors](#troubleshooting) section below for more tips. +### Linux + +1. **Ubuntu** + + To install on Ubuntu, open a terminal window and run the following command: + + ```bash + source <(curl -L -s http://tinyurl.com/hzvqvck) + ``` + + This command will download everything needed for TKP and create a shortcut on your desktop. + +Eclipse should run automatically and the first lesson from TKP will open. + +If you are having trouble reading the text inside the "JavaDoc" panel, you might need to change your system colors. This can be done by using the "color chooser" app. Just type: + +```bash +sudo apt install gnome-color-chooser +gnome-color-chooser +``` + +You will need to go to the "Specific" tab and change your tooltip colors. + + ## Fixing Installation Errors We're sorry that you are having trouble getting started with TKP. Below you will find a few more troubleshooting tips that we have used to resolve issues in the past. -###Correct version of Java (7 or higher) not installed +### Correct version of Java (7 or higher) not installed We test the standard installation steps using "clean" computers with no software installed except what comes with Windows or OSX. However, your computer might have an older version of Java on it that we don't support. @@ -138,7 +163,7 @@ To validate the version of Java that is installed, go to [this website](http://j If the reported version of your Java installation is less than 7, then update Java to the version that Oracle recommends. -###Correct version of Eclipse (Luna) not installed +### Correct version of Eclipse (Luna) not installed We test the standard installation steps using "clean" computers with no software installed except what comes with Windows or OSX. However, your computer might have an older version of eclipse on it that we don't support. @@ -150,25 +175,25 @@ We test TKP with `Luna`. The friendly names are in alphabetical order, so if yo We recommend that you delete your current version of eclipse. (Advanced users can rename it, but we won't cover that here). On **Windows**, delete `C:\eclipse`. On **Mac** delete `eclipse` from `Applications`. Next, go back to the installation instructions for [Windows](#wineclipse) or [Mac](#maceclipse) to setup Luna. -###Customized TKP workspace did not open in Eclipse. +### Customized TKP workspace did not open in Eclipse. -Open Eclipse and change the default workspace directory, by clicking on `File` then choosing `Switch Workspace` and then `Open...`. Navigate to the `\TeachingKidsProgramming.Java` folder (under `C:\TKPSource` on **Windows**, or `Documents\TKPSource` on **Mac**). After you do this, then your `TeachingKidsProgramming.Java` should include the following folders: +Open Eclipse and change the default workspace directory, by clicking on `File` then choosing `Switch Workspace` and then `Open...`. Navigate to the `\TeachingKidsProgramming.Java\TeachingKidsProgramming` folder (under `C:\TKPSource` on **Windows**, or `Documents\TKPSource` on **Mac**). After you do this, then your `TeachingKidsProgramming.Java` should include the following folders: * `\.metadata` * `\TeachingKidsProgramming` -###Unable to write to file system location(s) +### Unable to write to file system location(s) This general installation failure can occur if your school has "locked down" permissions to student lab computers. Try to `run as administrator` for **Windows**, or `run as root` for **Mac** and this may allow the downloaded TKP files to unzip. Some schools create a virtual (sometimes shared) `C:\` drive. If the drive is shared, eclipse should still be installed to `C:\`, but `TKPSource` should be created in each student's `C:\temp` directory. -###Still Stuck? +### Still Stuck? -Please consider writing a description of the errors/problems you are seeing and sharing it with us by opening a GitHub issue. You can be a detailed as you like, and your story will help us make TKP better. +Please consider writing a description of the errors/problems you are seeing and sharing it with us by opening a GitHub issue. You can be as detailed as you like, and your story will help us make TKP better. -You can create a issue by following this link (GitHub account required): [Create An Issue][4] +You can create an issue by following this link (GitHub account required): [Create An Issue][4] Or you can [email us from this page](http://teachingkidsprogramming.org/contact/) and we will create the issue for you (no account required). diff --git a/TeachingKidsProgramming/.classpath b/TeachingKidsProgramming/.classpath index 6b893c9b..f253a67e 100644 --- a/TeachingKidsProgramming/.classpath +++ b/TeachingKidsProgramming/.classpath @@ -4,9 +4,9 @@ + - diff --git a/TeachingKidsProgramming/.gitignore b/TeachingKidsProgramming/.gitignore new file mode 100644 index 00000000..ae3c1726 --- /dev/null +++ b/TeachingKidsProgramming/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/TeachingKidsProgramming/LICENSE.md b/TeachingKidsProgramming/LICENSE.md new file mode 100644 index 00000000..fed464b1 --- /dev/null +++ b/TeachingKidsProgramming/LICENSE.md @@ -0,0 +1,217 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) 2011 Teaching Kids Programming (http://www.teachingkidsprogramming.org). All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +## Contributors: +* Lynn Langit +* Samantha Langit +* James Counts +* Genevieve L'Esperance +* Jessica Ellis +* Matt Ballin +* Llewellyn Falco +* Katrina Owen +* June Clarke +* Brick Ellis +* David Coopersmith +* Edgar Melendrez +* Alex Puente +* 8th Grade students from PALM STEM Academy - Moreno Valley, CA - class of 2015-2016 diff --git a/TeachingKidsProgramming/src/jars/TeachingKidsProgramming.jar b/TeachingKidsProgramming/src/jars/TeachingKidsProgramming.jar index cee23bd4..8b593772 100644 Binary files a/TeachingKidsProgramming/src/jars/TeachingKidsProgramming.jar and b/TeachingKidsProgramming/src/jars/TeachingKidsProgramming.jar differ diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/DeepDive09exceptions.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/DeepDive09exceptions.java deleted file mode 100644 index 0c3fc075..00000000 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/DeepDive09exceptions.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.teachingkidsprogramming.recipes.inDevelopment; - -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.teachingextensions.approvals.lite.util.FormattedException; - - -@SuppressWarnings("unused") -public class DeepDive09exceptions -{ - // How to do deep dive: - // Step 1: Select the method name (doesABear on line 20) Press the Run Button - // PC: Ctrl+F11 - // Mac: Command+fn+F11 - // Step 2: Read the name of the method that failed - // Step 3: Fill in the blank (___) to make it pass - // Step 4: Consider at least one thing you just learned - // Step 5: Advance to the next method - // Do not change anything except the blank (___) - // THERE ARE NO BLANKS! - // - @Test - public void exceptionsShouldProvideInformation() throws Exception - { - Chain c = createChain(); - int answer = c.get("a").get("b").get("c").get("d").get("e").value; /* Fix This Line */ - Assert.assertEquals(2048, answer); - } - @Test - public void exceptionsShouldExplainPreconditions() throws Exception - { - Game game = new Game(); - /* Add needed line here */ - int fun = game.play(); - Assert.assertEquals(11, fun); - } - @Test - public void creatingYourOwnExceptions() throws Exception - { - Exception yourException = null; - try - { - int[] indexes = {5, 83, 14, 20, 2, 6, 7}; - String[] values = new String[8]; - for (int i : indexes) - { - if (i < 0 || values.length <= i) - { - int length = ____; - throw new FormattedException("Index out of Boands [%s] for Array of length %s", ___, length); - } - String e = values[i]; - } - } - catch (Exception e) - { - yourException = e; - } - Assert.assertEquals("Index out of Boands [83] for Array of length 8", yourException.getMessage()); - } - @Test(expected = RuntimeException.class) - public void youCanAugmentExceptions() throws Exception - { - int[] indexes = {5, 83, 14, 20, 2, 6, 7}; - String[] values = new String[8]; - for (int i : indexes) - { - try - { - String e = values[i]; - } - catch (Exception originalException) - { - String message = String.format("Index out of Boands [%s] for Array of length %s", i, values.length); - throw new _____(message, originalException); - } - } - } - @Test - public void exceptionsShouldShowAllInputs() throws Exception - { - int s = 0; - s += call(1, 3, 7); - s += call(2, 3, 8); - s += call(-6, 3, 9); - s += call(-11, 3, 17); - s += call(-10, 3, 31); - /* ^^^ Change 1 of the 3's of the above to a 4 ^^^ */ - Assert.assertEquals(64, s); - } - /** - * Ignore the following, It's needed to run the homework - * - * - * - * - * - * - * - * - * - * - */ - private int call(int a, int b, int c) - { - if (((a + c) / 2) == b) { throw new FormattedException("%s is not a valid input for (%s, %s, %s)", b, a, b, c); } - return a + b + c; - } - private static class Game - { - boolean on = false; - public void turnOn() - { - on = true; - } - public int play() - { - if (!on) { throw new FormattedException("Before you can play a game you need to turn it on.\n game.turnOn()"); } - return 11; - } - } - private static class Chain - { - private String label; - private Chain chain; - public int value; - public Chain(String label, Chain chain) - { - this.label = label; - this.chain = chain; - } - public Chain(int value) - { - this.value = value; - } - public Chain get(String string) - { - if (!label.equals(string)) { throw new FormattedException("There is no value for '%s', please use '%s'", - string, label); } - return chain; - } - } - private Chain createChain() - { - return new Chain("a", new Chain("b", new Chain("surprise", new Chain("d", new Chain("e", new Chain(2048)))))); - } - private static class _____ extends Exception - { - private static final long serialVersionUID = 7013264013388843231L; - public _____(String message, Exception originalException) - { - super(message, originalException); - } - } - public String ___ = "You need to fill in the blank ___"; - public Integer ____ = -99; -} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/SmallBasicHolidayCard.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/HolidayCard.java similarity index 89% rename from TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/SmallBasicHolidayCard.java rename to TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/HolidayCard.java index 30173acd..80ecd5ea 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/SmallBasicHolidayCard.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/HolidayCard.java @@ -1,10 +1,10 @@ package org.teachingkidsprogramming.recipes.inDevelopment; -public class SmallBasicHolidayCard +public class HolidayCard { //**needs to be translated from the SmallBasic // Holiday Recipe - Enjoy! - // Set the background to the color of Snow + // Set the background to the color to Snow // // Make the tortoise move as fast as possible // @@ -19,20 +19,20 @@ public class SmallBasicHolidayCard // // Otherwise, // - // DrawMerryChristmas(recipe below) + // DrawHappyHolidays(recipe below) // // ------------- End of Click recipe // // - // ------------- Recipe for DrawMerryChristmas + // ------------- Recipe for DrawHappyHolidays // // Play the music for Jingle Bells (Hint:"EEEP4EEEP4EGCDL1E") // // Set the font to be 48pt // - // Set the color of the font to red + // Set the font color to red // - // Write "Merry Christmas" on the screen at position 150, 150 + // Write the text "Happy Holidays" on the screen at position 150, 150 // // ------------- End of DrawMerryChristmas recipe // @@ -67,7 +67,7 @@ public class SmallBasicHolidayCard // // Hide the tortoise // - // Turn the tortoise to the left (90 degrees) + // Turn the tortoise 90 degrees to the left // // Move the tortoise half of the current length // diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/SpiderWebQuiz.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/SpiderWebQuiz.java deleted file mode 100644 index 5ca65fd3..00000000 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/SpiderWebQuiz.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.teachingkidsprogramming.recipes.inDevelopment; - -import org.teachingkidsprogramming.recipes.quizzes.graders.SpiderQuiz; -import org.teachingkidsprogramming.recipes.quizzes.graders.SpiderWebQuizGrader; - -public class SpiderWebQuiz extends SpiderQuiz -{ - //*this needs to be translated from the SmallBasic original into Java - public void question1() - { - // Do the following the current number of times - // Call circle() - // Repeat - } - // - // Question2 - // Create a subroutine called circleAround which - // Does the following 3 times - // Call adjust() - // Call question1 - // Repeat - // - // - // Question3 - // Create a subroutine called grow which - // Changes the current length so it is multiplied by 2.5 - // - // - // Question4 - // Create a subroutine called shrink which - // Decreases the current length by 9 pixels - // - // - // Question5 - // Create a subroutine called expand which - // Increases the current number by 12 - // - public static void main(String[] args) - { - new SpiderWebQuizGrader().grade(new SpiderWebQuiz()); - } -} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/SmallBasicTicTacToe.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/TicTacToe.java similarity index 78% rename from TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/SmallBasicTicTacToe.java rename to TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/TicTacToe.java index de6226dd..9a998371 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/SmallBasicTicTacToe.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/TicTacToe.java @@ -1,11 +1,12 @@ package org.teachingkidsprogramming.recipes.inDevelopment; -public class SmallBasicTicTacToe +public class TicTacToe { - //**needs to be translated from the SmallBasic** + //**need to create the TicTacToe board (object) and Player objects** + // // Tell TicTacToe to call PlayInFirstEmptySpot (recipe below) when its Xs turn // - // Start TicTacToe + // Start TicTacToe // // Recipe for PlayInFirstEmptySpot // diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/forLoopUpdate.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/forLoopUpdate.java new file mode 100644 index 00000000..4a48795a --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/inDevelopment/forLoopUpdate.java @@ -0,0 +1,12 @@ +package org.teachingkidsprogramming.recipes.inDevelopment; + +public class forLoopUpdate +{ + public static void main(String[] args) throws Exception + { + // Input from Brick Ellis + // Update 'for loop English syntax' + // End of loop s/b 'end repeat' -- DONE + // Refer to 'for loop ' as 'this ' with a noun + } +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/AdLibsQuizGrader.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/AdLibsQuizGrader.java index 569638b0..5f0e862c 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/AdLibsQuizGrader.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/AdLibsQuizGrader.java @@ -5,52 +5,52 @@ import javax.swing.JPanel; -import org.teachingextensions.logo.Paintable; -import org.teachingextensions.logo.PenColors; import org.teachingextensions.logo.Tortoise; -import org.teachingextensions.simpleparser.Parser; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; +import org.teachingextensions.logo.utils.LineAndShapeUtils.Paintable; +import org.teachingextensions.logo.utils.MVCUtils.Parser; import org.teachingkidsprogramming.recipes.quizzes.graders.AdLibsQuizAdapter.Pieces; -public class AdLibsQuizGrader implements Paintable { - private static class Model { +public class AdLibsQuizGrader implements Paintable +{ + private static class Model + { @SuppressWarnings("unused") public String three; - - public Model(String three) { + public Model(String three) + { this.three = three; } } - private boolean[] answers; public static int TURTLE_SPEED = 9; private AdLibsQuizAdapter quiz; - - private void displayScreen() { + private void displayScreen() + { QuizUtils.prepareScoringScreen(answers, this, TURTLE_SPEED); } - - public void grade(AdLibsQuizAdapter quiz) { + public void grade(AdLibsQuizAdapter quiz) + { this.quiz = quiz; - answers = new boolean[] { grade1You(), grade2Won(), grade3The(), - grade4Game() }; + answers = new boolean[]{grade1You(), grade2Won(), grade3The(), grade4Game()}; displayScreen(); } - @Override - public void paint(Graphics2D g, JPanel caller) { + public void paint(Graphics2D g, JPanel caller) + { QuizUtils.displayScores(g, 300, answers); Tortoise.hide(); drawRewardShape(g); } - - public void drawRewardShape(Graphics2D g) { + public void drawRewardShape(Graphics2D g) + { drawYou(g); drawWin(g); drawThe(g); drawGame(g); } - - private void drawGame(Graphics2D g) { + private void drawGame(Graphics2D g) + { quiz.template4 = ""; Pieces pieces = new Pieces(); quiz.question4(pieces); @@ -58,43 +58,43 @@ private void drawGame(Graphics2D g) { String word = Parser.parse(quiz.template4, pieces); drawWord(g, word, 0, 4, true); } - - private void drawThe(Graphics2D g) { + private void drawThe(Graphics2D g) + { quiz.word3 = ""; Pieces model = new Pieces(); model.middle = "H"; quiz.question3("T{middle}E", model); drawWord(g, quiz.word3, 3, 2, false); } - - private void drawWin(Graphics2D g) { + private void drawWin(Graphics2D g) + { quiz.word2 = "WO"; quiz.question2("n"); drawWord(g, quiz.word2, 1, 0, false); } - - private void drawWord(Graphics2D g, String word, int x, int y, - boolean horizontal) { + private void drawWord(Graphics2D g, String word, int x, int y, boolean horizontal) + { char[] letters = word.toUpperCase().toCharArray(); int dx = horizontal ? 1 : 0; int dy = horizontal ? 0 : 1; - for (int i = 0; i < letters.length; i++) { + for (int i = 0; i < letters.length; i++) + { char c = letters[i]; drawLetter(getPosition(x + dx * i), getPosition(y + dy * i), c, g); } } - - private int getPosition(int i) { + private int getPosition(int i) + { return 100 + i * 53; } - - private void drawYou(Graphics2D g) { + private void drawYou(Graphics2D g) + { quiz.word1 = "NOT"; quiz.question1("y", "u"); drawWord(g, quiz.word1, 0, 1, true); } - - private void drawLetter(int x, int y, char c, Graphics2D g) { + private void drawLetter(int x, int y, char c, Graphics2D g) + { g.setColor(PenColors.Browns.BurlyWood); g.drawRect(x, y, 50, 50); g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 36)); @@ -104,26 +104,26 @@ private void drawLetter(int x, int y, char c, Graphics2D g) { int textX = x + (50 - charWidth) / 2; g.drawString("" + c, textX, textY); } - - private boolean grade1You() { + private boolean grade1You() + { quiz.word1 = "fake"; quiz.question1("f", "o"); return "foo".equals(quiz.word1); } - - private boolean grade2Won() { + private boolean grade2Won() + { quiz.word2 = "passe"; quiz.question2("d"); return "passed".equals(quiz.word2); } - - private boolean grade3The() { + private boolean grade3The() + { quiz.word3 = "fake"; quiz.question3("12{three}4", new Model("3")); return "1234".equals(quiz.word3); } - - private boolean grade4Game() { + private boolean grade4Game() + { quiz.template4 = "fake"; quiz.question4(new Pieces()); return "g{middle}e".equals(quiz.template4); diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/HiLowQuizGrader.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/HiLowQuizGrader.java index c3d74e31..a90dc908 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/HiLowQuizGrader.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/HiLowQuizGrader.java @@ -4,12 +4,12 @@ import javax.swing.JPanel; -import org.teachingextensions.logo.Paintable; -import org.teachingextensions.logo.PenColors; import org.teachingextensions.logo.Tortoise; import org.teachingextensions.logo.utils.TortoiseUtils; -import org.teachingextensions.windows.MessageBox; -import org.teachingextensions.windows.MessageBox.MessageBoxInstance; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; +import org.teachingextensions.logo.utils.EventUtils.MessageBox; +import org.teachingextensions.logo.utils.EventUtils.MessageBox.MessageBoxInstance; +import org.teachingextensions.logo.utils.LineAndShapeUtils.Paintable; public class HiLowQuizGrader implements Paintable { @@ -22,18 +22,69 @@ private void displayScreen() QuizUtils.prepareScoringScreen(answers, this, TURTLE_SPEED); drawRewardShape(); } + @Override public void paint(Graphics2D g, JPanel caller) { QuizUtils.displayScores(g, 300, answers); } private void drawRewardShape() { - int[] angles = { - 90, -90, -90, 135, -45, 90, 90, -135, 90, 135, -90, 90, 90, 90, -90, -90, -90, -90, -90, 90, 90, 90, -90, - 90, 90, -90, -90, -90}; - int[] lengths = { - 70, 85, 25, 43, 40, 18, 26, 50, 113, 25, 85, 40, 30, 30, 20, 20, 20, 10, 20, 10, 10, 20, 10, 10, 30, 30, - 60, 183}; + int[] angles = {90, + -90, + -90, + 135, + -45, + 90, + 90, + -135, + 90, + 135, + -90, + 90, + 90, + 90, + -90, + -90, + -90, + -90, + -90, + 90, + 90, + 90, + -90, + 90, + 90, + -90, + -90, + -90}; + int[] lengths = {70, + 85, + 25, + 43, + 40, + 18, + 26, + 50, + 113, + 25, + 85, + 40, + 30, + 30, + 20, + 20, + 20, + 10, + 20, + 10, + 10, + 20, + 10, + 10, + 30, + 30, + 60, + 183}; Tortoise.setX(20); Tortoise.setPenColor(PenColors.Greens.LawnGreen); for (int i = 0; i < lengths.length; i++) diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/HousesQuizGrader.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/HousesQuizGrader.java index a855f192..5be5b29a 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/HousesQuizGrader.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/HousesQuizGrader.java @@ -5,11 +5,11 @@ import javax.swing.JPanel; import org.teachingextensions.approvals.lite.util.NumberUtils; -import org.teachingextensions.logo.Paintable; -import org.teachingextensions.logo.PenColors; import org.teachingextensions.logo.Tortoise; import org.teachingextensions.logo.Turtle; import org.teachingextensions.logo.utils.TortoiseUtils; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; +import org.teachingextensions.logo.utils.LineAndShapeUtils.Paintable; public class HousesQuizGrader implements Paintable { @@ -24,11 +24,15 @@ private void displayScreen() public void grade(HousesQuizAdapter quiz) { this.quiz = quiz; - answers = new boolean[]{ - grade1Small(), grade2Medium(), grade3Large(), grade4moveTheLength(), grade5turnTheCorner(), + answers = new boolean[]{grade1Small(), + grade2Medium(), + grade3Large(), + grade4moveTheLength(), + grade5turnTheCorner(), grade6drawASide()}; displayScreen(); } + @Override public void paint(Graphics2D g, JPanel caller) { QuizUtils.displayScores(g, 300, answers); diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/MessageBoxMock.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/MessageBoxMock.java index 9741e6f5..8ea7c568 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/MessageBoxMock.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/MessageBoxMock.java @@ -1,6 +1,6 @@ package org.teachingkidsprogramming.recipes.quizzes.graders; -import org.teachingextensions.windows.MessageBox.MessageBoxInstance; +import org.teachingextensions.logo.utils.EventUtils.MessageBox.MessageBoxInstance; public class MessageBoxMock extends MessageBoxInstance { diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/PentagonCrazyQuizGrader.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/PentagonCrazyQuizGrader.java index 296f7d78..4fe49b89 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/PentagonCrazyQuizGrader.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/PentagonCrazyQuizGrader.java @@ -6,13 +6,13 @@ import javax.swing.JPanel; import org.teachingextensions.approvals.lite.util.NumberUtils; -import org.teachingextensions.logo.ColorWheel; -import org.teachingextensions.logo.Paintable; -import org.teachingextensions.logo.PenColors; import org.teachingextensions.logo.Tortoise; import org.teachingextensions.logo.Turtle; -import org.teachingextensions.logo.Wheel; import org.teachingextensions.logo.utils.TortoiseUtils; +import org.teachingextensions.logo.utils.ColorUtils.ColorWheel; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; +import org.teachingextensions.logo.utils.ColorUtils.Wheel; +import org.teachingextensions.logo.utils.LineAndShapeUtils.Paintable; public class PentagonCrazyQuizGrader implements Paintable { @@ -35,6 +35,7 @@ public void grade(PentagonQuizAdapter quiz) answers = new boolean[]{gradeThread(), grade2Stitch76(), grade3Lime(), grade4Red()}; displayScreen(); } + @Override public void paint(Graphics2D g, JPanel caller) { QuizUtils.displayScores(g, 300, answers); @@ -60,7 +61,7 @@ private boolean gradeThread() Turtle turtle = QuizUtils.createTestTurtle(); TortoiseUtils.setTurtle(turtle); TortoiseUtils.setOrientation(0, 0, 90); - quiz.callThread(); + quiz.callCreateAStitch(); return NumberUtils.equals(TortoiseUtils.getTurtle().getX(), 6, 0.005); } private boolean grade2Stitch76() @@ -110,9 +111,9 @@ public void stitch() Tortoise.setPenColor(getSafeColor()); Tortoise.turn(wheel.next()); Tortoise.setPenDown(); - quiz.callThread(); + quiz.callCreateAStitch(); Tortoise.setPenUp(); - quiz.callThread(); + quiz.callCreateAStitch(); } } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/PentagonQuizAdapter.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/PentagonQuizAdapter.java index e26e4e07..6c48a7ab 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/PentagonQuizAdapter.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/PentagonQuizAdapter.java @@ -3,9 +3,9 @@ public class PentagonQuizAdapter { public PentagonCrazyQuizGrader grader; - public void callThread() + public void callCreateAStitch() { - HousesQuizAdapter.call(this, "thread"); + HousesQuizAdapter.call(this, "createAStitch"); } public void question2() { @@ -16,7 +16,7 @@ public void question3() public void question4() { } - public void stitch() + public void sewAStitch() { grader.stitch(); } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/QuizUtils.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/QuizUtils.java index 5f5e6ac9..0dfe8ac5 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/QuizUtils.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/QuizUtils.java @@ -1,16 +1,13 @@ package org.teachingkidsprogramming.recipes.quizzes.graders; -import java.awt.Color; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.RenderingHints; - -import org.teachingextensions.logo.Paintable; -import org.teachingextensions.logo.PenColors; import org.teachingextensions.logo.Tortoise; import org.teachingextensions.logo.Turtle; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; +import org.teachingextensions.logo.utils.LineAndShapeUtils.Paintable; import org.teachingextensions.logo.utils.TortoiseUtils; +import java.awt.*; + public class QuizUtils { public static void displayScores(Graphics2D g, int x, boolean[] answers) @@ -52,7 +49,7 @@ public static void prepareScoringScreen(boolean[] answers, Paintable paintable, TortoiseUtils.resetTurtle(); Tortoise.setSpeed(turtleSpeed); Tortoise.getBackgroundWindow().setColor(Color.black); - Tortoise.getBackgroundWindow().addPaintable(paintable); + Tortoise.getBackgroundWindow().getCanvas().add(paintable); Tortoise.show(); } public static Turtle createTestTurtle() diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/SimpleBubbleQuizGrader.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/SimpleBubbleQuizGrader.java index 6b62b1f5..1d24a265 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/SimpleBubbleQuizGrader.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/SimpleBubbleQuizGrader.java @@ -1,13 +1,12 @@ package org.teachingkidsprogramming.recipes.quizzes.graders; -import java.awt.Graphics2D; - -import javax.swing.JPanel; - -import org.teachingextensions.logo.Paintable; -import org.teachingextensions.logo.PenColors; import org.teachingextensions.logo.Tortoise; -import org.teachingextensions.logo.shapes.Text; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; +import org.teachingextensions.logo.utils.LineAndShapeUtils.Paintable; +import org.teachingextensions.logo.utils.LineAndShapeUtils.Text; + +import javax.swing.*; +import java.awt.*; public class SimpleBubbleQuizGrader implements Paintable { @@ -30,11 +29,12 @@ public void grade(SimpleBubbleQuizAdapter quiz) this.quiz = quiz; displayScreen(); } + @Override public void paint(Graphics2D g, JPanel caller) { this.answers[0] = quiz.leftClickWiredUp; this.answers[2] = quiz.rightClickWiredUp; - for (Paintable p : Tortoise.getBackgroundWindow().additional) + for (Paintable p : Tortoise.getBackgroundWindow().getCanvas().getPainters()) { try { diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/SimpleSquareQuizGrader.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/SimpleSquareQuizGrader.java index 561118cb..a1f2cee8 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/SimpleSquareQuizGrader.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/SimpleSquareQuizGrader.java @@ -6,9 +6,9 @@ import javax.swing.JPanel; import org.teachingextensions.approvals.lite.util.NumberUtils; -import org.teachingextensions.logo.Paintable; import org.teachingextensions.logo.Turtle; import org.teachingextensions.logo.utils.TortoiseUtils; +import org.teachingextensions.logo.utils.LineAndShapeUtils.Paintable; public class SimpleSquareQuizGrader implements Paintable { @@ -26,6 +26,7 @@ public void grade(SquareQuiz quiz) answers = new boolean[]{grade1Move(), grade2Turn(), grade3Color(), grade4Width()}; displayScreen(); } + @Override public void paint(Graphics2D g, JPanel caller) { QuizUtils.displayScores(g, 200, answers); diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/SpiderWebQuizGrader.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/SpiderWebQuizGrader.java index 36b3aed4..7a5a30fa 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/SpiderWebQuizGrader.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/SpiderWebQuizGrader.java @@ -4,11 +4,11 @@ import javax.swing.JPanel; -import org.teachingextensions.logo.ColorWheel; -import org.teachingextensions.logo.Paintable; -import org.teachingextensions.logo.PenColors; import org.teachingextensions.logo.Tortoise; import org.teachingextensions.logo.utils.TortoiseUtils; +import org.teachingextensions.logo.utils.ColorUtils.ColorWheel; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; +import org.teachingextensions.logo.utils.LineAndShapeUtils.Paintable; public class SpiderWebQuizGrader implements Paintable { @@ -85,6 +85,7 @@ private boolean grade5Expand() quiz.expand(); return quiz.number == -100; } + @Override public void paint(Graphics2D g, JPanel caller) { QuizUtils.displayScores(g, 400, answers); diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/TreeQuizGrader.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/TreeQuizGrader.java index 6d3bcc5d..e014c342 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/TreeQuizGrader.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/recipes/quizzes/graders/TreeQuizGrader.java @@ -6,10 +6,10 @@ import javax.swing.JPanel; -import org.teachingextensions.logo.Paintable; -import org.teachingextensions.logo.PenColors; import org.teachingextensions.logo.Tortoise; import org.teachingextensions.logo.utils.TortoiseUtils; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; +import org.teachingextensions.logo.utils.LineAndShapeUtils.Paintable; public class TreeQuizGrader implements Paintable { @@ -29,6 +29,7 @@ public void grade(TreeQuizAdapter quiz) answers = new boolean[]{grade1DoubleLength(), grade2DecreaseTurn(), grade3SetNinety(), grade4AngleFive()}; displayScreen(); } + @Override public void paint(Graphics2D g, JPanel caller) { QuizUtils.displayScores(g, 380, answers); @@ -69,9 +70,37 @@ public void drawRewardShape() quiz.question1(); Tortoise.setPenColor(PenColors.Greens.Lime); Tortoise.setPenWidth(2); - int[] turns = { - 0, 90, 0, -90, 90 - 36, -90, 0, 90, -90, 0, 0, 0, -90, -90, 0, 0, 90, 0, 0, 90, 0, 0, 0, 0, 90, 90, -90, - 0, -90, 90, -90}; + int[] turns = {0, + 90, + 0, + -90, + 90 - 36, + -90, + 0, + 90, + -90, + 0, + 0, + 0, + -90, + -90, + 0, + 0, + 90, + 0, + 0, + 90, + 0, + 0, + 0, + 0, + 90, + 90, + -90, + 0, + -90, + 90, + -90}; for (int i = 0; i < turns.length; i++) { if (i == 4) @@ -103,10 +132,23 @@ private void drawMaze(Graphics2D g) { g.setColor(PenColors.Grays.DarkGray); g.setStroke(new BasicStroke(4, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); - int[][] verticalLines = { - {1, 4}, {0, 2, 3, 1}, {2, 1}, {0, 1}, {1, 3}, {1, 2}, {2, 1}, new int[0], {1, 1, 3, 2}, {2, 1}, {0, 4}}; - int[][] horizontalLines = { - {0, 10}, {2, 1, 5, 4}, {1, 1, 3, 1, 7, 1}, {0, 1, 2, 2, 5, 3, 9, 1}, {1, 2, 4, 3, 8, 1}, {0, 10}}; + int[][] verticalLines = {{1, 4}, + {0, 2, 3, 1}, + {2, 1}, + {0, 1}, + {1, 3}, + {1, 2}, + {2, 1}, + new int[0], + {1, 1, 3, 2}, + {2, 1}, + {0, 4}}; + int[][] horizontalLines = {{0, 10}, + {2, 1, 5, 4}, + {1, 1, 3, 1, 7, 1}, + {0, 1, 2, 2, 5, 3, 9, 1}, + {1, 2, 4, 3, 8, 1}, + {0, 10}}; drawLines(horizontalLines, g, true); drawLines(verticalLines, g, false); } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section00demos/QuickShape.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section00demos/QuickShape.java new file mode 100644 index 00000000..b77c4115 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section00demos/QuickShape.java @@ -0,0 +1,28 @@ +package org.teachingkidsprogramming.section00demos; + +import java.util.Random; + +import org.teachingextensions.logo.Tortoise; + +@SuppressWarnings("unused") +public class QuickShape +{ + public static void main(String[] args) throws Exception + { + Tortoise.show(); + Tortoise.setX(150); + // Tip: Use the Tortoise object to draw shapes! + // Draw a red square that is 50 pixels per side with a line that's 2 pixels thick -- #1 + // + Tortoise.setX(425); + // Draw a blue hexagon that is 65 pixels per side with a line that's 40 pixels thick -- #2 + // + Tortoise.setX(250); + Tortoise.setY(375); + Random r = new Random(); + int sides = r.nextInt(10) + 1; + // Draw a purple shape that is 50 pixel on each side with a line that's 10 pixels thick -- #3 + // + } + // See "your" work at http://virtualproctor.tkpjava.org +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section00demos/QuickTortoise.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section00demos/QuickTortoise.java new file mode 100644 index 00000000..f1cc7a98 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section00demos/QuickTortoise.java @@ -0,0 +1,12 @@ +package org.teachingkidsprogramming.section00demos; + +import org.teachingextensions.logo.Tortoise; + +public class QuickTortoise +{ + public static void main(String[] args) throws Exception + { + Tortoise.show(); + // Use the Tortoise object to draw a Tortoise! + } +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/DeepDive01ForLoops.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/DeepDive01ForLoops.java index df7da0b6..6722bfa7 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/DeepDive01ForLoops.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/DeepDive01ForLoops.java @@ -2,25 +2,21 @@ import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.teachingextensions.logo.Tortoise; import org.teachingextensions.logo.Turtle; import org.teachingextensions.logo.utils.TortoiseUtils; - public class DeepDive01ForLoops { - // How to do deep dive: - // Step 1: Select the method name (numbersDoNotNeedQuotes on line 24) Press the Run Button - // PC: Ctrl+F11 - // Mac: Command+fn+F11 - // Step 2: Read the name of the method that failed - // Step 3: Fill in the blank (___) to make it pass - // Step 4: Consider at least one thing you just learned - // Step 5: Advance to the next method - // Do not change anything except the blank (___) - // + // Step 1: SELECT the method name (numbersDoNotNeedQuotes on line 23), then click the Run Button + // Keyboard shortcut to run -> PC: Ctrl+F11 or Mac: Command+fn+F11 + // Step 2: READ the name of the method that failed + // Step 3: FILL IN the blank (___) to make that method pass + // Step 4: SAY at least one thing you just learned + // Step 5: GO to the next method + // IMPORTANT - Do NOT change anything except the blank (___) + // @Test public void numbersDoNotNeedQuotes() { diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/DoubleLoop.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/DoubleLoop.java index bb1aac0f..df4701bb 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/DoubleLoop.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/DoubleLoop.java @@ -1,14 +1,15 @@ package org.teachingkidsprogramming.section01forloops; -import org.teachingextensions.logo.ColorWheel; -import org.teachingextensions.logo.PenColors; import org.teachingextensions.logo.Tortoise; +import org.teachingextensions.logo.utils.ColorUtils.ColorWheel; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; public class DoubleLoop { public static void main(String[] args) { - // Set the tortoise x position to 225 --#1.1 + Tortoise.show(); + // Set the tortoise x position to 225 --#1.1 // Set the tortoise y position to 150 --#1.2 // UPDATE the tortoise speed to 10 --#8.2 Tortoise.setSpeed(5); @@ -25,18 +26,18 @@ public static void main(String[] args) // Set the pen width of the line the tortoise draws to 17 --#9 // Move the tortoise 8 times the current line number you are drawing --#8.1 // Turn the tortoise 1/5 of 360 degrees to the right --#6 - // Repeat --#7.2 + // End Repeat --#7.2 // // Hide the Tortoise --#10 Tortoise.getBackgroundWindow().setBackground(PenColors.Yellows.PeachPuff); - // Repeat --#3.2 + // End Repeat --#3.2 // Set the tortoise x position to 300 --#15.1 // Set the tortoise y position to 200 --#15.2 // Do the following 5 times --#12.1 // Change the pen color of the line the tortoise draws to black --#14 // Move the Tortoise 25 pixels --#11 // Turn the tortoise 1/5 of 360 degrees to the right --#13 - // Repeat --#12.2 + // End Repeat --#12.2 // } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/MakeALogo.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/MakeALogo.java new file mode 100644 index 00000000..7f4fe6b0 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/MakeALogo.java @@ -0,0 +1,19 @@ +package org.teachingkidsprogramming.section01forloops; + +public class MakeALogo +{ + public static int YValue = 300; + public static int XValue = 100; + public static void main(String[] args) + { + // Show the Tortoise --#1 + // Make the Tortoise draw a line as fast as possible --#2 + // Setup the Color Wheel --#3 HINT: Use the TKPLogo object + // Draw a TKP 'T' --#4 + // Draw a left bracket --#8 + // Draw a TKP 'K' --#5 + // Draw a right bracket --#9 + // Draw an outer TKP 'P' --#6 + // Draw an inner TKP 'P' --#7 + } +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/SimpleSquare.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/SimpleSquare.java index 5b5dd92c..91e458d9 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/SimpleSquare.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/SimpleSquare.java @@ -10,6 +10,9 @@ public static void main(String[] args) throws Exception // Change the pen color of the line the tortoise draws to blue --#4 // Move the tortoise 50 pixels --#2 // Turn the tortoise to the right (90 degrees) --#3 - // Repeat --#5.2 + // End Repeat --#5.2 + // + // (Optional): Sign your work using the Virtual Proctor + // See your work at http://virtualproctor.tkpjava.org } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/Spiral.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/Spiral.java index 2cb1fde8..482d9ae2 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/Spiral.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section01forloops/Spiral.java @@ -1,18 +1,27 @@ package org.teachingkidsprogramming.section01forloops; +import org.teachingextensions.logo.utils.EventUtils.MessageBox; + public class Spiral { public static void main(String[] args) { // Show the tortoise --#1 // Make the tortoise go as fast as possible --#4 - // Add Blue Violet to the Color Wheel --#7 + // Add Blue Violet to the Color Wheel --#7 HINT: Use the ColorWheel object // Add Violet to the Color Wheel --#8 // Add Purple to the Color Wheel --#9 // Do the following 75 times --#3.1 - // Change the pen color of the line the tortoise draws the next color on the Color Wheel --#6 - // Move the tortoise 5 times the current line number you are drawing --#5 - // Turn the tortoise 1/3 of 360 degrees to the right --#2 - // Repeat --#3.2 + try + { + // Change the pen color of the line the tortoise draws the next color on the Color Wheel --#6 + // Move the tortoise 5 times the current line number you are drawing --#5 + // Turn the tortoise 1/3 of 360 degrees to the right --#2 + } + catch (RuntimeException re) + { + MessageBox.showMessage("Hold up: " + re); + } + // End Repeat --#3.2 } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/DeepDive02Variables.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/DeepDive02Variables.java index 4ccd5c5d..e7fd139d 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/DeepDive02Variables.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/DeepDive02Variables.java @@ -1,23 +1,19 @@ package org.teachingkidsprogramming.section02methods; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - @SuppressWarnings("unused") public class DeepDive02Variables { - // How to do deep dive: - // Step 1: Select the method name (youCanReadVariables on line 20) Press the Run Button - // PC: Ctrl+F11 - // Mac: Command+fn+F11 - // Step 2: Read the name of the method that failed - // Step 3: Fill in the blank (___) to make it pass - // Step 4: Consider at least one thing you just learned - // Step 5: Advance to the next method - // Do not change anything except the blank (___) - // + // Step 1: SELECT the method name (youCanReadVariables on line 19), then click the Run Button + // Keyboard shortcut to run -> PC: Ctrl+F11 or Mac: Command+fn+F11 + // Step 2: READ the name of the method that failed + // Step 3: FILL IN the blank (___) to make that method pass + // Step 4: SAY at least one thing you just learned + // Step 5: GO to the next method + // IMPORTANT - Do NOT change anything except the blank (___)// + // @Test public void youCanReadVariables() throws Exception { diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/FourSquare.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/FourSquare.java index 347ea188..65d1eb3a 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/FourSquare.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/FourSquare.java @@ -13,9 +13,9 @@ public static void main(String[] args) // Change the pen color of the line the tortoise draws to a random color --#3 // Move the tortoise 50 pixels --#2 // Turn the tortoise 90 degrees to the right --#4 - // Repeat --#5.2 + // End Repeat --#5.2 // ------------- End of drawSquare recipe --#6.3 // Turn the tortoise 90 degrees to the right --#9 - // Repeat --#8.2 + // End Repeat --#8.2 } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/Houses.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/Houses.java index 13e04d68..9baabf68 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/Houses.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/Houses.java @@ -1,9 +1,12 @@ package org.teachingkidsprogramming.section02methods; +import org.teachingextensions.logo.Tortoise; + public class Houses { public static void main(String[] args) { + Tortoise.show(); // Make the tortoise move as fast as possible --#11 // Have the tortoise start at 200 pixels in on the X axis --#14 // The current height is 40 --#1.2 diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/PyramidsOfGiza.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/PyramidsOfGiza.java new file mode 100644 index 00000000..04a44c48 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/PyramidsOfGiza.java @@ -0,0 +1,37 @@ +package org.teachingkidsprogramming.section02methods; + +import org.teachingextensions.logo.Tortoise; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; + +public class PyramidsOfGiza +{ + public static void main(String[] args) throws Exception + { + setUpPyramidLand(); + // Turn the tortoise 90 degrees to the left + // Move the tortoise 220 pixels + // Turn the tortoise 135 degrees to the right + // Move the tortoise 100 pixels + // Turn the tortoise 90 degrees to the right + // Move the tortoise 100 pixels + // Turn the tortoise 90 degrees to the left + // Move the tortoise 100 pixels + // Turn the tortoise 90 degrees to the right + // Move the tortoise 100 pixels + // Turn the tortoise 90 degrees to the left + // Move the tortoise 100 pixels + // Turn the tortoise 90 degrees to the right + // Move the tortoise 100 pixels + // Turn the tortoise 135 degrees to the right + // Move the tortoise 210 pixels + } + private static void setUpPyramidLand() + { + Tortoise.show(); + Tortoise.setSpeed(10); + Tortoise.getBackgroundWindow().setBackground(PenColors.Blues.AliceBlue); + Tortoise.setPenColor(PenColors.Yellows.DarkGoldenrod); + Tortoise.setPenWidth(2); + Tortoise.hide(); + } +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/TriangleShell.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/TriangleShell.java index 8166647f..f910d751 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/TriangleShell.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/TriangleShell.java @@ -3,7 +3,7 @@ @SuppressWarnings("unused") public class TriangleShell { - private static int length; + private static int length = 1; public static void main(String[] args) { // Show the tortoise --#1 @@ -15,12 +15,12 @@ public static void main(String[] args) // // ------------- Recipe for drawTriangle --#5.2 // Do the following 3 times --#3.1 - // Move the tortoise the current length of a side --#4 + // Move the tortoise using the current length --#4 // Turn the tortoise 1/3rd of 360 degrees --#2 - // Repeat --#3.2 + // End Repeat --#3.2 // ------------- End of drawTriangle recipe --#5.3 // // Turn the tortoise 1/60th of 360 degrees to the right --#10 - // Repeat --#7.2 + // End Repeat --#7.2 } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/ChooseYourOwnAdventure.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/ChooseYourOwnAdventure.java index ece5f238..80471ff2 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/ChooseYourOwnAdventure.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/ChooseYourOwnAdventure.java @@ -1,92 +1,90 @@ package org.teachingkidsprogramming.section03ifs; +import java.awt.Color; + +import org.teachingextensions.approvals.lite.util.ThreadUtils; +import org.teachingextensions.logo.Tortoise; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; +import org.teachingextensions.logo.utils.EventUtils.MessageBox; + public class ChooseYourOwnAdventure { public static void main(String[] args) { - // startStory (recipe below) --#2.1 - // - // ------------- Recipe for startStory --#2.2 - // Tell the user "One morning the Tortoise woke up in a dream." --#1 - // - // animateStartStory (recipe below) --#38.1 - // - // ------------- Recipe for animateStartStory --#38.2 - // Show the Tortoise --#37 - // The current pen color is black --#39.2 - // Do the following 25 times --#41.1 - // Turn the background to the current pen color --#39.1 - // Lighten the current pen color --#42 - // Wait for 100 milliseconds --#40 - // Repeat --#41.2 - // ------------- End of animateStartStory recipe --#38.3 - // - // Ask the user "Do you want to 'wake up' or 'explore' the dream?" --#3 - // If they answer "wake up" --#6 - // wakeUp (recipe below) --#5.1 - // - // ------------- Recipe for wakeUp --#5.2 - // Tell the user "You Wake up and have a boring day. The End." --#4 - // ------------- End of wakeUp recipe --#5.3 - // Otherwise, if they answer "explore" --#9 - // approachOoze (recipe below) --#8.1 - // - // ------------- Recipe for approachOoze --#8.2 - // Tell the user "You approach a glowing, green bucket of ooze, worried that you will get in trouble, you pick up the bucket." --#7 - // Ask the user "Do you want to pour the ooze into the 'backyard' or 'toilet'?" --#13 - // If they answer "toilet" --#16 - // pourIntoToilet (recipe below) --#15.1 - // - // ------------- Recipe for pourIntoToilet --#15.2 - // Tell the user "As you pour the ooze into the toilet it backs up, gurgles and explodes covering you in radio-active waste." --#14 - // Ask the user "Do you want to train to be a NINJA? 'Yes' or 'HECK YES'?" --#29 - // If they answer "yes" --#32 - // ninjaTortoise (recipe below) --#31.1 - // - // ------------- Recipe for ninjaTortoise --#31.2 - // Tell the user "Awesome Dude! You live out the rest of your life fighting crimes and eating pizza!" --#30 - // ------------- End of ninjaTortoise recipe --#31.3 - // - // Otherwise, if they answer "heck yes" --#34 - // ninjaTortoise (recipe below) --#33 - // - // Otherwise, if they answer anything else --#36 - // badAnswer (recipe below) --#35 - // - // ------------- End of pourIntoToilet recipe --#15.3 - // - // Otherwise, if they answer "backyard" --#19 - // pourIntoBackyard (recipe below) --#18.1 - // - // ------------- Recipe for pourIntoBackyard --#18.2 - // Tell the user "As you walk into the backyard a net scoops you up and a giant takes you to a boiling pot of water." --#17 - // Ask the user "As the man starts to prepare you as soup, do you... 'Scream' or 'Faint'?" --#21 - // If they answer "faint" --#24 - // - // tortoiseSoup (recipe below) --#23.1 - // - // ------------- Recipe for tortoiseSoup --#23.2 - // Tell the user "You made a delicious soup! Yum! The End." --#22 - // ------------- End of tortoiseSoup recipe --#23.3 - // - // Otherwise, if they answer "scream" --#26 - // startStory (recipe below) --#25.1 - // - // Otherwise, if they answer anything else --#28 - // badAnswer (recipe below) --#27 - // - // ------------- End of pourIntoBackyard recipe --#18.3 - // Otherwise, if they answer anything else --#20 - // badAnswer (recipe below) --#19 - // ------------- End of approachOoze recipe --#8.3 - // - // Otherwise, if they answer anything else --#12 - // badAnswer (recipe below) --#11.1 - // - // ------------- Recipe for badAnswer --#11.2 - // Tell the user "You don't know how to read directions. You can't play this game. The End." --#10 - // ------------- End of badAnswer recipe --#11.3 - // - // ------------- End of startStory recipe --#2.3 + startStory(); + } + private static void startStory() + { + tellMoreStory("One morning the Tortoise woke up in a dream."); + animateStartStory(); + String action = askAQuestion("Do you want to 'wake up' or 'explore' the dream?"); + if ("wake up".equalsIgnoreCase(action)) + { + // wakeUp (recipe below) --#2.1 + // ------------- Recipe for wakeUp --#2.2 + // Tell the user "You wake up and have a boring day. The end." --#1 + // ------------- End of wakeUp recipe --#2.3 + } + else if ("explore".equalsIgnoreCase(action)) + { + // approachOoze (recipe below) --#4.1 + // ------------- Recipe for approachOoze --#4.2 + // Tell the user "You approach a glowing, green bucket of ooze. Worried that you will get in trouble, you pick up the bucket." --#3 + // Ask the user "Do you want to pour the ooze into the 'backyard' or 'toilet'?" --#7 + // If they answer "toilet" --#8.1 + // pourIntoToilet (recipe below) --#12.1 + // ------------- Recipe for pourIntoToilet --#12.2 + // Tell the user "As you pour the ooze into the toilet it backs up, gurgles, and explodes, covering you in radioactive waste." --#10 + // Ask the user "Do you want to train to be a NINJA? 'Yes' or 'HECK YES'?" --#11 + // If they answer "yes" --#13.1 + // Tell the user "Awesome dude! You live out the rest of your life fighting crimes and eating pizza!" --#14 + // Otherwise, if they answer "heck yes" --#13.2 + // Tell the user "Awesome dude! You live out the rest of your life fighting crimes and eating pizza!" --#15 + // Otherwise, if they answer anything else --#13.3 + // endStory --#16 + // ------------- End of pourIntoToilet recipe --#12.3 + // Otherwise, if they answer "backyard" --#8.2 + // pourIntoBackyard (recipe below) --#19.1 + // ------------- Recipe for pourIntoBackyard --#19.2 + // Tell the user "As you walk into the backyard a net scoops you up and a giant takes you to a boiling pot of water." --#17 + // Ask the user "As the man starts to prepare you as soup, do you...'Scream' or 'Faint'?" --#18 + // If they answer "faint" --#20.1 + // Tell the user "You made a delicious soup! Yum! The end." --#21 + // Otherwise, if they answer "scream" --#20.2 + // startStory --#22 + // Otherwise, if they answer anything else --#20.3 + // endStory --#23 + // ------------- End of pourIntoBackyard recipe --#19.3 + // Otherwise, if they answer anything else --#8.3 + // endStory --#9 + // ------------- End of approachOoze recipe --#4.3 + } + else + { + // endStory (recipe below) --#6.1 + // ------------- Recipe for endStory --#6.2 + // Tell the user "You don't know how to read directions. You can't play this game. The end." --#5 + // ------------- End of endStory recipe --#6.3 + } + } + private static void animateStartStory() + { + Tortoise.show(); + Color color = PenColors.Grays.Black; + for (int i = 0; i < 25; i++) + { + Tortoise.getBackgroundWindow().setColor(color); + color = PenColors.lighten(color); + ThreadUtils.sleep(100); + } + } + private static void tellMoreStory(String message) + { + MessageBox.showMessage(message); + } + private static String askAQuestion(String question) + { + String answer = MessageBox.askForTextInput(question); + return answer; } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/ConcentricLoop.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/ConcentricLoop.java index 407e6774..9bcd67a2 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/ConcentricLoop.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/ConcentricLoop.java @@ -1,9 +1,12 @@ package org.teachingkidsprogramming.section03ifs; +import org.teachingextensions.logo.Tortoise; + public class ConcentricLoop { public static void main(String[] args) { + Tortoise.show(); // Set the tortoise x position to 150 --#4.1 // Set the tortoise y position to 200 --#4.2 // Set the tortoise speed to 10 --#4.3 @@ -15,7 +18,7 @@ public static void main(String[] args) // Move the tortoise 1 pixel --#5 // Turn the tortoise 1 degree --#6 // Change the width of the line that the tortoise draws to 1/100th of the current line --#9 - // Repeat --#8.2 - // Repeat --#3.2 + // End Repeat --#8.2 + // End Repeat --#3.2 } } \ No newline at end of file diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/DeepDive03Ifs.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/DeepDive03Ifs.java index 7fda1080..521135d6 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/DeepDive03Ifs.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/DeepDive03Ifs.java @@ -1,23 +1,19 @@ package org.teachingkidsprogramming.section03ifs; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; - @SuppressWarnings("unused") public class DeepDive03Ifs { - // How to do deep dive: - // Step 1: Select the method name (doesABear on line 20) Press the Run Button - // PC: Ctrl+F11 - // Mac: Command+fn+F11 - // Step 2: Read the name of the method that failed - // Step 3: Fill in the blank (___) to make it pass - // Step 4: Consider at least one thing you just learned - // Step 5: Advance to the next method - // Do not change anything except the blank (___) - // + // Step 1: SELECT the method name (doesABear on line 19), then click the Run Button + // Keyboard shortcut to run -> PC: Ctrl+F11 or Mac: Command+fn+F11 + // Step 2: READ the name of the method that failed + // Step 3: FILL IN the blank (___) to make that method pass + // Step 4: SAY at least one thing you just learned + // Step 5: GO to the next method + // IMPORTANT - Do NOT change anything except the blank (___)// + // @Test public void doesABear() throws Exception { diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/HiLow.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/HiLow.java index b9367286..ce7a6b71 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/HiLow.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/HiLow.java @@ -15,7 +15,7 @@ public static void main(String[] args) // Tell the end user that it is too high --#5 // Otherwise, if the guess is too low --#8 // Tell the end user that it is too low --#7 - // Repeat --#9.2 + // End Repeat --#9.2 // After 8 incorrect guesses tell the user they've lost --#11 } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/HiLowQuiz.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/HiLowQuiz.java index 5993a61b..534737c2 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/HiLowQuiz.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section03ifs/HiLowQuiz.java @@ -4,29 +4,29 @@ public class HiLowQuiz extends org.teachingkidsprogramming.recipes.quizzes.graders.HiLowQuiz { + @Override public void question1() { - // if the Y position of the tortoise is 115 - // - // turn the tortoise to the right 63 degrees + // If the Y position of the tortoise is 115 + // Turn the tortoise to the right 63 degrees } + @Override public void question2() { - // if the X position of tortoise is less than Y position of tortoise - // - // turn the tortoise 54 degrees to the left - // - // otherwise turn the tortoise 22 degrees to the right + // If the X position of tortoise is less than Y position of tortoise + // Turn the tortoise 54 degrees to the left + // Otherwise turn the tortoise 22 degrees to the right } + @Override public void question3() { - // display the message "elcomeway omehay!" + // Display the message "elcomeway omehay!" } + @Override public void question4() { - // if the Y position of tortoise is greater than 50 - // - // turn the tortoise 177 degrees to the left + // If the Y position of tortoise is greater than 50 + // Turn the tortoise 177 degrees to the left } public static void main(String[] args) { diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/BackgroundPhoto.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/BackgroundPhoto.java index 0c5a9a24..5105801b 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/BackgroundPhoto.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/BackgroundPhoto.java @@ -1,22 +1,26 @@ package org.teachingkidsprogramming.section04mastery; +import org.teachingextensions.logo.Tortoise; + public class BackgroundPhoto { + @SuppressWarnings("unused") public static void main(String[] args) { - // Make the tortoise go as fast as possible --#3 - // Set the current picture to this url "http://img2.timeinc.net/ew/dynamic/imgs/101110/sonny-cher_240.jpg" --#7.1 - // Set the background image to the current picture--#7.2 - // Set the current side to 2 pixels long --#4.1 - // Do the following 75 times --#2.1 - // Set the current pen color to crimson --#8.1 - // Use the current pen color for the line the tortoise draws --#8.2 - // Increase the length of a side by 1 pixel --#5 - // Move the tortoise the length of the current side --#4.2 - // Set the X position of the tortoise to 555 pixels --#4.3 - // Set the Y position of the tortoise to 65 pixels --#4.4 - // Turn the tortoise 1/3rd of 360 degrees to the right --#1 - // Turn the tortoise 1 more degree --#6 - // Repeat --#2.2 + // Set the current picture to this url "https://usatftw.files.wordpress.com/2017/05/spongebob.jpg?w=1000&h=600&crop=1" --#1.0 + // Set the background image to the current picture--#1.1 + Tortoise.show(); + Tortoise.setSpeed(10); + int side = 2; + // Do the following 75 times --#7.1 + // Set the current pen color to yellow --#6.1 + // Use the current pen color for the line the tortoise draws --#6.2 + // Increase the length of a side by 1 pixel --#3.0 + // Move the tortoise the length of the current side --#3.1 + // Set the X position of the tortoise to 555 pixels --#2.0 + // Set the Y position of the tortoise to 65 pixels --#2.1 + // Turn the tortoise 1/3rd of 360 degrees to the right --#4 + // Turn the tortoise 1 more degree --#5 + // End Repeat --#7.2 } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/DeepDive04Mastery.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/DeepDive04Mastery.java index 70afc096..04d36392 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/DeepDive04Mastery.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/DeepDive04Mastery.java @@ -1,24 +1,21 @@ package org.teachingkidsprogramming.section04mastery; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import you.need.to.fill.in.the.______; - +@SuppressWarnings("unused") public class DeepDive04Mastery { - // How to do deep dive: - // Step 1: Select the method name (theseNumbersCount on line 23) Press the Run Button - // PC: Ctrl+F11 - // Mac: Command+fn+F11 - // Step 2: Read the name of the method that failed - // Step 3: Fill in the blank (___) to make it pass - // Step 4: Consider at least one thing you just learned - // Step 5: Advance to the next method - // Do not change anything except the blank (___) - // + // Step 1: SELECT the method name (theseNumbersCount on line 21), then click the Run Button + // Keyboard shortcut to run -> PC: Ctrl+F11 or Mac: Command+fn+F11 + // Step 2: READ the name of the method that failed + // Step 3: FILL IN the blank (___) to make that method pass + // Step 4: SAY at least one thing you just learned + // Step 5: GO to the next method + // IMPORTANT - Do NOT change anything except the blank (___)// + // @Test public void theseNumbersCount() throws Exception { @@ -114,7 +111,7 @@ public void dividing() throws Exception { Number number = 1.0 / 5; Assert.assertEquals(number.getClass(), ______.class); - Assert.assertEquals(number, .2); + Assert.assertEquals(number, ___); } @Test public void dividingIntegers() throws Exception @@ -156,6 +153,7 @@ public void understandingDoubleNumbers() throws Exception public boolean ______ = true; public String ___ = "You need to fill in the blank ___"; public Integer ____ = null; + private Double _______; public String ___() { return ___; diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/DigiFlower.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/DigiFlower.java index 46f4e8cd..f3fe9fb2 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/DigiFlower.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/DigiFlower.java @@ -1,40 +1,44 @@ package org.teachingkidsprogramming.section04mastery; +import java.awt.Color; + +import org.teachingextensions.logo.utils.ColorUtils.ColorWheel; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; + public class DigiFlower { public static void main(String[] args) { // Show the tortoise --#1 - // Make the tortoise move as fast as possible --#7 - // Make the background silver --#8 - // Make the line the tortoise draws 3 pixels wide --#20 - // createColorPalette (recipe below) --#9.1 - // Do the following 15 times --#19.1 - // drawOctogon (recipe below) --#10.1 - // Turn the tortoise 1/15th of 360 degrees to the right --#18 - // Repeat --#19.2 - // ------------- Recipe for createColorPalette --#9.2 - // Pen Color 1 is red --#3 - // Pen Color 2 is dark orange --#11 - // Pen Color 3 is gold --#12 - // Pen Color 4 is yellow --#13 - // - // Add color 1 to the color wheel --#3.1 - // Add color 2 to the color wheel --#11.1 - // Add color 3 to the color wheel --#12.1 - // Add color 4 to the color wheel --#13.1 - // Add color 4 to the color wheel --#14 - // Add color 3 to the color wheel --#15 - // Add color 2 to the color wheel --#16 - // Add color 1 to the color wheel --#17 - // ------------- End of createColorPalette recipe --#9.3 + // Make the tortoise move as fast as possible --#6 + // Make the background silver --#7 + // Make the line the tortoise draws 3 pixels wide --#12 + // createColorPalette (recipe below) --#8.1 + // Do the following 15 times --#11.1 + // drawOctogon (recipe below) --#9.1 + // Turn the tortoise 1/15th of 360 degrees to the right --#10 + // End Repeat --#11.2 + // ------------- Recipe for createColorPalette --#8.2 + Color color1 = PenColors.Reds.Red; + Color color2 = PenColors.Oranges.DarkOrange; + Color color3 = PenColors.Yellows.Gold; + Color color4 = PenColors.Yellows.Yellow; + ColorWheel.addColor(color1); + ColorWheel.addColor(color2); + ColorWheel.addColor(color3); + ColorWheel.addColor(color4); + ColorWheel.addColor(color4); + ColorWheel.addColor(color3); + ColorWheel.addColor(color2); + ColorWheel.addColor(color1); + // ------------- End of createColorPalette recipe --#8.3 // - // ------------- Recipe for drawOctogon --#10.2 - // Do the following 8 times --#6.1 - // Change the pen color of the line the tortoise draws to the next color on the color wheel --#4 + // ------------- Recipe for drawOctogon --#9.2 + // Do the following 8 times --#5.1 + // Change the pen color of the line the tortoise draws to the next color on the color wheel --#3 // Move the tortoise 50 pixels --#2 - // Turn the tortoise 1/8th of 360 degrees to the right --#5 - // Repeat --#6.2 + // Turn the tortoise 1/8th of 360 degrees to the right --#4 + // End Repeat --#5.2 // ------------- End of drawOctogon recipe --#10.3 } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/KnottedRing.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/KnottedRing.java index e5579538..59879d6a 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/KnottedRing.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/KnottedRing.java @@ -1,33 +1,38 @@ package org.teachingkidsprogramming.section04mastery; +import org.teachingextensions.logo.Tortoise; +import org.teachingextensions.logo.utils.ColorUtils.ColorWheel; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; + public class KnottedRing { public static void main(String[] args) { + Tortoise.show(); // Make the tortoise move as fast as possible --#4 - // createColorPalette (recipe below) --#7.1 - // - // ------------- Recipe for createColorPalette --#7.2 - // Add hot pink to the color wheel --#6 - // Add red to the color wheel --#13 - // Add fuchsia to the color wheel --#14 - // Add orange red to the color wheel --#15 - // Add deep pink to the color wheel --#16 - // Add medium violet red to the color wheel --#17 - // Add crimson to the color wheel --#18 - // Add tomato to the color wheel --#19 - // ------------- End of createColorPalette recipe --#7.3 - // Do the following 30 times --#11.1 - // Change the pen color of the line the tortoise draws to a random color from the color wheel --#5 - // drawOctagonWithOverlap (recipe below) --#9 - // ------------- Recipe for drawOctagonWithOverlap --#8.1 + createColorPalette(); + // Do the following 30 times --#9.1 + // Change the pen color of the line the tortoise draws to the next color from the color wheel --#5 + // drawOctagonWithOverlap (recipe below) --#7.0 + // ------------- Recipe for drawOctagonWithOverlap --#6.1 // Do the following 8 + 1 times --#3.1 // Move the tortoise 110 pixels --#1 // Turn the tortoise 1/8th of 360 degrees to the right --#2 - // Repeat --#3.2 - // ------------- End of drawOctagonWithOverlap recipe --#8.2 - // Turn the tortoise 1/30th of 360 degrees to the right --#10 - // Turn the tortoise 5 more degrees to the right --#12 - // Repeat --#11.2 + // End Repeat --#3.2 + // ------------- End of drawOctagonWithOverlap recipe --#6.2 + // Turn the tortoise 1/30th of 360 degrees to the right --#8 + // Turn the tortoise 5 more degrees to the right --#10 + // End Repeat --#9.2 + } + private static void createColorPalette() + { + ColorWheel.addColor(PenColors.Pinks.HotPink); + ColorWheel.addColor(PenColors.Reds.Red); + ColorWheel.addColor(PenColors.Pinks.Fuchsia); + ColorWheel.addColor(PenColors.Reds.OrangeRed); + ColorWheel.addColor(PenColors.Pinks.DeepPink); + ColorWheel.addColor(PenColors.Reds.MediumVioletRed); + ColorWheel.addColor(PenColors.Reds.Crimson); + ColorWheel.addColor(PenColors.Reds.Tomato); } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/PentagonCrazy.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/PentagonCrazy.java index afb38d1b..09421e74 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/PentagonCrazy.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/PentagonCrazy.java @@ -1,9 +1,12 @@ package org.teachingkidsprogramming.section04mastery; +import org.teachingextensions.logo.Tortoise; + public class PentagonCrazy { public static void main(String[] args) { + Tortoise.show(); // Make the tortoise move as fast as possible --#3 // createColorPalette (recipe below) --#8.1 // @@ -24,15 +27,15 @@ public static void main(String[] args) // ------------- Recipe for adjustPen --#9.2 // Change the pen color of the line the tortoise draws to the next color on the color wheel --#6 // Increase the tortoises pen width by 1 --#15 - // If the tortoises pen width is greater than 4, then --#17 - // Reset it to 1 --#16 + // If the tortoise's pen width is greater than 4, then --#17 + // Reset the pen width to 1 --#16 // ------------- End of adjustPen recipe --#9.3 // // The current length of a side is the same as the number of the side you are about to draw ( 1st side = 1 pixel, 2nd side = 2 pixels, etc) --#4.2 // Move the tortoise the length of a side --#4.1 // Turn the tortoise 1/5th of 360 degrees --#1 // Turn the tortoise 1 more degree --#5 - // Repeat --#2.2 + // End Repeat --#2.2 // ------------- End of drawPentagon recipe --#10.3 } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/PentagonCrazyQuiz.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/PentagonCrazyQuiz.java index 658fa392..02f33971 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/PentagonCrazyQuiz.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section04mastery/PentagonCrazyQuiz.java @@ -7,25 +7,28 @@ public class PentagonCrazyQuiz extends PentagonQuizAdapter { public void question1() { - // Question 1 - // thread (recipe below) - // ------------- Recipe for thread - // that moves the tortoise 6 pixels - // ------------- End of thread recipe + // Question 1 + // createAStitch (recipe below) + // ------------- Recipe for createAStitch + // Move the tortoise 6 pixels + // ------------- End of createAStitch recipe } + @Override public void question2() { - // Do the following 76 times - // call stitch - // Repeat + // Do the following 76 times + // Call sewAStitch + // Repeat } + @Override public void question3() { - // Add lime to the color wheel + // Add lime to the color wheel } + @Override public void question4() { - // Add red to the color wheel + // Add red to the color wheel } public static void main(String[] args) { diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/DeepDive05Recursion.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/DeepDive05Recursion.java index f470dc6d..85f8a8a1 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/DeepDive05Recursion.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/DeepDive05Recursion.java @@ -7,23 +7,19 @@ import java.util.List; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; -import org.teachingextensions.logo.PenColors; import org.teachingextensions.logo.Tortoise; - +import org.teachingextensions.logo.utils.ColorUtils.PenColors; public class DeepDive05Recursion { - // How to do deep dive: - // Step 1: Select the method name (changeThePointerToAHand on line 29) Press the Run Button - // PC: Ctrl+F11 - // Mac: Command+fn+F11 - // Step 2: Read the name of the method that failed - // Step 3: Fill in the blank (___) to make it pass - // Step 4: Consider at least one thing you just learned - // Step 5: Advance to the next method - // Do not change anything except the blank (___) + // Step 1: SELECT the method name (changeThePointerToAHand on line 27), then click the Run Button + // Keyboard shortcut to run -> PC: Ctrl+F11 or Mac: Command+fn+F11 + // Step 2: READ the name of the method that failed + // Step 3: FILL IN the blank (___) to make that method pass + // Step 4: SAY at least one thing you just learned + // Step 5: GO to the next method + // IMPORTANT - Do NOT change anything except the blank (___)// // @Test public void changeThePointerToAHand() throws Exception @@ -110,16 +106,16 @@ public void putAFiftyCentPieceFirst() throws Exception } /** * Ignore the following, It's needed to run the deep dive - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * + * + * */ public boolean _____ = false; public boolean ______ = true; @@ -132,7 +128,6 @@ public String ___() } private Cursor getCursor() { - Cursor cursor = Tortoise.getBackgroundWindow().getCursor(); - return cursor; + return Tortoise.getBackgroundWindow().getCanvas().getCursor(); } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/RecursiveSquare.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/RecursiveSquare.java index cc34d136..48c055e8 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/RecursiveSquare.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/RecursiveSquare.java @@ -1,39 +1,40 @@ package org.teachingkidsprogramming.section05recursion; -import org.teachingextensions.logo.PenColors; import org.teachingextensions.logo.Tortoise; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; public class RecursiveSquare { public static void main(String[] args) throws Exception { + Tortoise.show(); Tortoise.getBackgroundWindow().setBackground(PenColors.Greens.DarkGreen); Tortoise.setPenColor(PenColors.Yellows.Gold); // - //Set the speed to the fastest --#8 - //Update the length to 100.0 --#1.1 + // Set the speed to the fastest --#8 + // Update the length to 100.0 --#1.1 double length = 50.0; - //MakeASquare with the current length(recipe below) --#11.4 + // MakeASquare with the current length(recipe below) --#11.4 // - //Create the makeASquare recipe --#11.1 - //If the current length is greater than 10 --#10.2 - // Run the recipe moveToTheSquareStart with the current length --#4.3 + // Create the makeASquare recipe --#11.1 + // If the current length is greater than 10 --#10.2 + // Run the recipe moveToTheSquareStart with the current length --#4.3 // - // Create the moveToTheSquareStart recipe --#4.1 - // Set the pen up for the tortoise --#1.2 - // Move the tortoise the current length divided by two --#1.3 - // Turn the tortoise 90 degrees to the left --#2.1 - // Move the tortoise the current length divided by two --#2.2 - // Turn the tortoise 180 degrees to the right --#3.1 - // Set the pen down for the tortoise --#3.2 - // End of moveToTheSquareStart recipe --#4.2 + // Create the moveToTheSquareStart recipe --#4.1 + // Set the pen up for the tortoise --#1.2 + // Move the tortoise the current length divided by two --#1.3 + // Turn the tortoise 90 degrees to the left --#2.1 + // Move the tortoise the current length divided by two --#2.2 + // Turn the tortoise 180 degrees to the right --#3.1 + // Set the pen down for the tortoise --#3.2 + // End of moveToTheSquareStart recipe --#4.2 // // Do the following 4 times --#7.1 // Move the Tortoise the current length --#6.2 // MakeASquare with the current length divided by 1.7 (recipe below)--#11.3 // If the current process count is less than 3 (HINT: use 'i') --#9 // Turn the tortoise 90 degrees to the right --#6.1 - // Repeat --#7.2 + // End Repeat --#7.2 // // MoveBackToCenter with the current length (recipe below)--#5.3 // Create the moveBackToCenter recipe --#5.1 @@ -50,6 +51,6 @@ public static void main(String[] args) throws Exception // // Set the current length to the current length times two --#10.1 // - //End of makeASquare recipe --#11.2 + // End of makeASquare recipe --#11.2 } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/SpiderWeb.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/SpiderWeb.java index fb3744e4..3db366e2 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/SpiderWeb.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/SpiderWeb.java @@ -1,9 +1,12 @@ package org.teachingkidsprogramming.section05recursion; +import org.teachingextensions.logo.Tortoise; + public class SpiderWeb { public static void main(String[] args) { + Tortoise.show(); // Make the tortoise go as fast as possible --#6 // Change the width of the line the tortoise draws to 1 pixel --#12 // Change the Tortoise to a Spider --#14 @@ -22,15 +25,15 @@ public static void main(String[] args) // Do the following 3 times --#3.1 // Move the tortoise the current length (of the line) --#1.1 // Turn the tortoise 1/3rd of 360 degrees --#2 - // Repeat --#3.2 + // End Repeat --#3.2 // ------------- End of drawTriangle recipe --#4.3 // // Turn the tortoise 1/6th of 360 degrees to the right --#7 // Increase the current length (of the line) by the current zoom --#8.1 - // Repeat --#5.2 + // End Repeat --#5.2 // ------------- End of weaveOneLayer recipe --#9.3 // // Change the current zoom so it is multiplied by 1.3 --#11 - // Repeat --#10.2 + // End Repeat --#10.2 } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/TurtleTree.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/TurtleTree.java index 6ebbc0c3..77b31274 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/TurtleTree.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/TurtleTree.java @@ -3,11 +3,14 @@ import java.awt.Color; import java.util.HashMap; +import org.teachingextensions.logo.Tortoise; + public class TurtleTree { @SuppressWarnings("unused") public static void main(String[] args) { + Tortoise.show(); // Make the tortoise go as fast as possible --#10 // Turn the background black --#21 // The current branch length = 60 --#1.2 diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibs.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibs.java index b3b8926a..65f70c38 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibs.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibs.java @@ -1,17 +1,16 @@ package org.teachingkidsprogramming.section06modelviewcontroller; - public class AdLibs { public static void main(String[] args) { - //Ask the user to enter an adverb, save it as currentAdverb --#2 - //Ask the user to enter a verb ending in '-ed', save it as currentEdVerb --#4 - //Ask the user to enter a body part, save it as currentBodyPart --#6 - //Set the value of the currentStory to the word "Today " --#1.2 - //Add the words "I woke " + currentAdverb + ". " to the currentStory --#3 - //Add the words '"Then I " + currentEdVerb + " " to the currentStory --#5 - //Add the words "my " + currentBodyPart + ". " to the current story --#7 - //Show the currentStory in a message box as a message --#1.1 + // Ask the user to enter an adverb, save it as currentAdverb --#2 + // Ask the user to enter a verb ending in '-ed', save it as currentEdVerb --#4 + // Ask the user to enter a body part, save it as currentBodyPart --#6 + // Set the value of the currentStory to the word "Today " --#1.2 + // Add the words "I woke " + currentAdverb + ". " to the currentStory --#3 + // Add the words '"Then I " + currentEdVerb + " " to the currentStory --#5 + // Add the words "my " + currentBodyPart + ". " to the current story --#7 + // Show the currentStory in a message box as a message --#1.1 } } \ No newline at end of file diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsQuiz.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsQuiz.java index 11769097..3bc77a19 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsQuiz.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsQuiz.java @@ -5,21 +5,25 @@ public class AdLibsQuiz extends AdLibsQuizAdapter { + @Override public void question1(String letter1, String letter3) { - //set current value of word1 to be letter1 + 'o' + letter3 + // Set current value of word1 to be letter1 + 'o' + letter3 } + @Override public void question2(String letter1) { - //add the letter1 to the end of word2 + // Add the letter1 to the end of word2 } + @Override public void question3(String templateText, Object model) { - //use the parser to combine the template and the model as word3 + // Use the parser to combine the template and the model as word3 } + @Override public void question4(Pieces pieces) { - //set template4 to the template which does'g' + pieces.middle + 'e' + // Set template4 to the template which does'g' + pieces.middle + 'e' } public static void main(String[] args) { diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsRtf.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsRtf.java new file mode 100644 index 00000000..cf0abe93 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/AdLibsRtf.java @@ -0,0 +1,16 @@ +package org.teachingkidsprogramming.section06modelviewcontroller; + + +public class AdLibsRtf +{ + public static void main(String[] args) + { + // Create a new 'word' container your story's words (uncomment line 10) --#1.1 + // Words word = new Words(); + // Ask the user to enter an adverb, save it as currentAdverb --#2 + // Ask the user to enter a verb ending in '-ed', save it as currentEdVerb --#3 + // Ask the user to enter a body part, save it as currentBodyPart --#4 + // Connect the words in the currentStory to an RTF file parser (use the Parser object) --#1.2 + // Display the currentStory in an RTF file (use the Viewer object) --#1.3 + } +} \ No newline at end of file diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/DeepDive06ModelViewController.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/DeepDive06ModelViewController.java index fe05e017..15046a95 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/DeepDive06ModelViewController.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/DeepDive06ModelViewController.java @@ -11,15 +11,13 @@ @SuppressWarnings("unused") public class DeepDive06ModelViewController { - // How to do deep dive: - // Step 1: Select the method name (stringsCanBeArrays on line 24) Press the Run Button - // PC: Ctrl+F11 - // Mac: Command+fn+F11 - // Step 2: Read the name of the method that failed - // Step 3: Fill in the blank (___) to make it pass - // Step 4: Consider at least one thing you just learned - // Step 5: Advance to the next method - // Do not change anything except the blank (___) + // Step 1: SELECT the method name (stringsCanBeArrays on line 24), then click the Run Button + // Keyboard shortcut to run -> PC: Ctrl+F11 or Mac: Command+fn+F11 + // Step 2: READ the name of the method that failed + // Step 3: FILL IN the blank (___) to make that method pass + // Step 4: SAY at least one thing you just learned + // Step 5: GO to the next method + // IMPORTANT - Do NOT change anything except the blank (___)// // @Test public void stringsCanBeArrays() throws Exception @@ -71,7 +69,7 @@ public void infiniteB() throws Exception String infinite = "B"; String analogy = "The " + ___ + " in " + ___ + "enoit " + ___ + ". Mandelbrot stands for " + ___ + "enoit " + ___ + ". Mandelbrot."; - Assert.assertEquals("The B in Benoit B. Mandelbrot stands for Benoît B. Mandelbrot.", analogy); + Assert.assertEquals("The B in Benoit B. Mandelbrot stands for Benoit B. Mandelbrot.", analogy); } @Test public void expectTheResult() throws Exception @@ -115,16 +113,16 @@ public void inYourOwnWords() throws Exception } /** * Ignore the following, It's needed to run the deep dive - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * + * + * */ public boolean _____ = false; public boolean ______ = true; @@ -138,7 +136,6 @@ public String ___() } private Cursor getCursor() { - Cursor cursor = Tortoise.getBackgroundWindow().getCursor(); - return cursor; + return Tortoise.getBackgroundWindow().getCanvas().getCursor(); } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/OneFishTwoFish.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/OneFishTwoFish.java new file mode 100644 index 00000000..74f0385d --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/OneFishTwoFish.java @@ -0,0 +1,36 @@ +package org.teachingkidsprogramming.section06modelviewcontroller; + +//*************This Lesson is In Development*****************************// +@SuppressWarnings("unused") +public class OneFishTwoFish +{ + // Create a Scanner to make a string --#1 + public static void main(String[] args) + { + makeAString(); + } + public static void makeAString() + { + final String input = "1 fish 2 fish red fish blue fish,black fish,blue fish,old fish,new fish "; + // Use your scanner with your input --#2 + // Display a new line and "We have: " and the input and then a new line --#3 + // Now, tell a story with a new Scanner instance (tellAStory recipe) --#8 + } + //-------recipe for tellAStory------------------------------------ + private static void tellAStory(final String input) + { + // Use 'fish' as the base text w/your scanner [story] HINT: useDelimeter --#5 + // Get the next number to use in your scanner [story] HINT: nextInt --#7 + // Get the next value to use in your scanner [story] HINT: next --#9 + // Iterate over each fish [string] HINT: Iterable --#10 + // Create a new string iterator --#11 + // Create a new scanner for your input --#12 + // Use a comma to separate the strings in your story HINT: useDelimeter --#13 + // Return the result --#6 + { + // Display "And then: " and the fish in the console --#14 + } + System.out.println(""); + //------end recipe tellAStory-------------------------------------- + } +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/ConnectTheDots.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/ConnectTheDots.java deleted file mode 100644 index 9541ce81..00000000 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/ConnectTheDots.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.teachingkidsprogramming.section07events; - -import org.teachingextensions.windows.MouseLeftClickListener; -import org.teachingextensions.windows.MouseRightClickListener; - -public class ConnectTheDots implements MouseRightClickListener, MouseLeftClickListener -{ - public static void main(String[] args) - { - // Create a new 'Connect The Dots' object. --#1.1 - } - public ConnectTheDots() - { - // Listen for right clicks on the window for the tortoise --#20.2 - // Listen for left clicks on the window for the tortoise --#1.2 - // Make the Tortoise go as fast as possible. --#4 - // clearTheScreen (recipe below) --#19.1 - // - // ------------- Recipe for clearTheScreen --#19.2 - // Clear the Tortoise --#20.1 - // Write "Right click to clear" on the screen at position 100, 100 --#18 - // ------------- End of clearTheScreen Recipe --#19.3 - // - // prepareColorPalette (recipe below) --#17.1 - // ------------- Recipe for prepareColorPalette --#17.2 - // Add red to the color wheel --#6 - // Add green to the color wheel --#12 - // Add blue to the color wheel --#13 - // Add purple to the color wheel --#14 - // Add pink to the color wheel --#15 - // Add teal to the color wheel --#16 - // ------------- End of prepareColorPalette Recipe --#17.3 - } - @Override - public void onRightMouseClick(int x, int y) - { - // clearTheScreen (recipe above) --#20.3 - } - @Override - public void onLeftMouseClick(int x, int y) - { - // addDot (recipe below) --#11.1 - // - // ------------- Recipe for addDot --#11.2 - // addACircle (recipe below) --#10.1 - // - // ------------- Recipe for addACircle --#10.2 - // Create a circle with a radius of 7 which is the same color as the next color on the color wheel --#5 - // Change the circle to be 40% opaque --#9 - // Move the circle so that it's center is at the current position of the mouse --#8 - // Place the circle on the tortoise's window. --#7 - // ------------- End of addACircle Recipe --#10.3 - // - // Move the tortoise to the current position of the mouse --#2 - // ------------- End of addDot Recipe --#11.3 - } -} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/TurtleObjects.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/TurtleObjects.java deleted file mode 100644 index f037baf1..00000000 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/TurtleObjects.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.teachingkidsprogramming.section07events; - -import org.teachingextensions.logo.MultiTurtleWindow; -import org.teachingextensions.logo.Turtle; -// -//NOTE: This recipe is in development and will be updated as it goes through our testing process -// - -public class TurtleObjects -{ - //Uncomment the line of code below to create a window for your turtles --#1 - public MultiTurtleWindow mtw = new MultiTurtleWindow(); - // - public static void main(String[] args) - { - new TurtleObjects(); - } - public TurtleObjects() - { - showSomeTurtles(); - } - // - private void showSomeTurtles() - { - makeSpeedyTurtle(); - makeSlowTurtle(); - makeCrazyTurtle(); - } - //Create this method and body --#2 - //Teacher to point out the mtw.addAndShowTurtle method - //Teacher to ask 'what are the steps of the drawTriangle method'? - private void makeSpeedyTurtle() - { - Turtle speedyTurtle = new Turtle(); - speedyTurtle.setSpeed(10); - mtw.addAndShowTurtle(speedyTurtle); - speedyTurtle.drawTriangle(100); - } - //Create this method and body --#3 - //Teacher to ask why this turtle is slower than the first one - //Teacher to ask why the two turtles start at the same spot - private void makeSlowTurtle() - { - Turtle slowTurtle = new Turtle(); - mtw.addAndShowTurtle(slowTurtle); - slowTurtle.drawTriangle(-50); - } - //Create this method and body --#4 - //Teacher to ask why is this turtle faster than the second one - //Teacher to ask why does this turtle 'start' in a different location - //Teacher to ask why does this turtle show up AFTER the other two HINT: mtw.addTurtle method - //Teacher to ask what does the drawLightning method do? - private void makeCrazyTurtle() - { - Turtle crazyTurtle = new Turtle(); - mtw.addTurtle(crazyTurtle); - crazyTurtle.drawLightning(55); - } -} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/MyTurtles.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/CloneTurtles.java similarity index 87% rename from TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/MyTurtles.java rename to TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/CloneTurtles.java index d9bdaf14..7c15f658 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/MyTurtles.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/CloneTurtles.java @@ -1,12 +1,12 @@ -package org.teachingkidsprogramming.section07events; +package org.teachingkidsprogramming.section07objects; -public class MyTurtles +public class CloneTurtles { // Uncomment the two lines of code below to create a container and a window for your turtles --#1 // public ArrayList turtles = new ArrayList(); // public MultiTurtleWindow mtw = new MultiTurtleWindow(); // - public MyTurtles() + public CloneTurtles() { showSomeTurtles(); } @@ -16,7 +16,7 @@ private void showSomeTurtles() // Use a FOR loop to add your three turtles --#4.1 // Create a turtle instance --#2.1 // Add your turtles to your turtle container --#2.2 - // Repeat --#4.2 + // End Repeat --#4.2 // // Create a variable to count the number of turtles in the container --#3.1 // Uncomment to Show the number of turtles in the container on the window --#3.2 @@ -24,22 +24,22 @@ private void showSomeTurtles() // // Use a FOREACH loop to add your turtles to your window --#5.1 // Add and Show your turtles on your window --#5.3 - // Repeat --#5.2 + // End Repeat --#5.2 // // Use a FOR loop to teleport all of your turtles around your window --#6.1 // Get your turtle's current position and then set the X position to i*100 + 350 --#6.3 // Get your turtle's current position and then set the Y position to i*100 + 100 --#6.4 - // Repeat --#6.2 + // End Repeat --#6.2 // // Use a FOREACH loop to set values for all of your turtles --#7.1 // Set the pen width to 10 pixels -- #7.3 // Set the turtle speed to 9 --#7.4 // Have each turtle draw a star with a side that is 100 pixels --#7.5 - // Repeat --#7.2 + // End Repeat --#7.2 } // public static void main(String[] args) { - new MyTurtles(); + new CloneTurtles(); } } diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/DeepDive07Events.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/DeepDive07Objects.java similarity index 80% rename from TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/DeepDive07Events.java rename to TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/DeepDive07Objects.java index 94a7fefd..c7030fd6 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/DeepDive07Events.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/DeepDive07Objects.java @@ -1,28 +1,26 @@ -package org.teachingkidsprogramming.section07events; +package org.teachingkidsprogramming.section07objects; import java.awt.Cursor; import org.junit.Assert; import org.junit.Test; -import org.teachingextensions.logo.Pizza; -import org.teachingextensions.logo.Topping; import org.teachingextensions.logo.Tortoise; import org.teachingextensions.logo.Turtle; import org.teachingextensions.logo.Turtle.Animals; +import org.teachingextensions.logo.utils.PizzaUtils.Pizza; +import org.teachingextensions.logo.utils.PizzaUtils.Topping; @SuppressWarnings("unused") -public class DeepDive07Events +public class DeepDive07Objects { - // How to do deep dive: - // Step 1: Select the method name (twoTortoises on line 30) Press the Run Button - // PC: Ctrl+F11 - // Mac: Command+fn+F11 - // Step 2: Read the name of the method that failed - // Step 3: Fill in the blank (___) to make it pass - // Step 4: Consider at least one thing you just learned - // Step 5: Advance to the next method - // Do not change anything except the blank (___) - // HINT: If you are stuck, look at the JavaDoc + // Step 1: SELECT the method name (twoTortoises on line 26), then click the Run Button + // Keyboard shortcut to run -> PC: Ctrl+F11 or Mac: Command+fn+F11 + // Step 2: READ the name of the method that failed + // Step 3: FILL IN the blank (___) to make that method pass + // Step 4: SAY at least one thing you just learned + // Step 5: GO to the next method + // IMPORTANT - Do NOT change anything except the blank (___)// + // @Test public void twoTortoises() throws Exception { @@ -48,7 +46,7 @@ public void twoTortoisesYetAgain() throws Exception boolean result = michelangelo.equals(anonymousNinja); Assert.assertEquals(true, result); } - //Turtle Leonardo belongs to "this" + //Turtle Leonardo belongs to "this" private Turtle leonardo; @Test public void fatTrailTurtle() throws Exception @@ -58,7 +56,7 @@ public void fatTrailTurtle() throws Exception ninja.setPenWidth(30); Assert.assertEquals(30, this.leonardo.getPenWidth()); } - //Turtle Donatello belongs to "this" + //Turtle Donatello belongs to "this" private Turtle donatello; @Test public void explodingTurtle() throws Exception @@ -133,16 +131,16 @@ public void feedAllTheNinjasAgain() throws Exception } /** * Ignore the following, It's needed to run the deep dive - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * + * + * */ private Tortoise[] throwPizzaParty() { @@ -150,8 +148,7 @@ private Tortoise[] throwPizzaParty() Tortoise cecil = new Tortoise(); Tortoise michealangelo = new Tortoise(); Tortoise fred = new Tortoise(); - Tortoise[] tortoises = {karai, cecil, michealangelo, fred}; - return tortoises; + return new Tortoise[]{karai, cecil, michealangelo, fred}; } private boolean gotASlice; public boolean _____ = false; @@ -167,10 +164,9 @@ public String ___() } private Cursor getCursor() { - Cursor cursor = Tortoise.getBackgroundWindow().getCursor(); - return cursor; + return Tortoise.getBackgroundWindow().getCanvas().getCursor(); } - public DeepDive07Events() + public DeepDive07Objects() { this.leonardo = new Turtle(); this.donatello = new Turtle(); diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/SpiderWebQuiz.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/SpiderWebQuiz.java new file mode 100644 index 00000000..c5cbf0c1 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/SpiderWebQuiz.java @@ -0,0 +1,42 @@ +package org.teachingkidsprogramming.section07objects; + +import org.teachingkidsprogramming.recipes.quizzes.graders.SpiderQuiz; +import org.teachingkidsprogramming.recipes.quizzes.graders.SpiderWebQuizGrader; + +public class SpiderWebQuiz extends SpiderQuiz +{ + @Override + public void question1() + { + // Do the following the current number of times HINT: "number" is a variable name + // Call circle() + // Repeat + } + public void question2() + { + // Create and then call a recipe called circleAround which + // Does the following 3 times + // Call adjust() + // Call question1 + // Repeat + } + public void question3() + { + // Create and then call a recipe called grow which + // Changes the current length so it is multiplied by 2.5 + } + public void question4() + { + // Create and then call a recipe called shrink which + // Decreases the current length by 9 pixels + } + public void question5() + { + // Create and then call a recipe called expand which + // Increases the current number by 12 + } + public static void main(String[] args) + { + new SpiderWebQuizGrader().grade(new SpiderWebQuiz()); + } +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/SuperTurtles.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/SuperTurtles.java new file mode 100644 index 00000000..bc5ab2c2 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/SuperTurtles.java @@ -0,0 +1,38 @@ +package org.teachingkidsprogramming.section07objects; + +import org.teachingextensions.WindowUtils.MultiTurtleWindow; + +public class SuperTurtles +{ + public MultiTurtleWindow mtw = new MultiTurtleWindow(); + public SuperTurtles() + { + showSomeTurtles(); + } + public static void main(String[] args) + { + new SuperTurtles(); + } + private void showSomeTurtles() + { + // makeSpeedyTurtle (recipe below) --#2.0 + // ------------- Recipe for makeSpeedyTurtle --#1.0 + // Create a new speedyTurtle instance + // Add your speedyTurtle to your MultiTurtleWindow + // Set the speed of your speedyTurtle to the fastest possible + // Have your speedyTurtle draw a triangle with 100 pixel sides + // ------------- End of makeSpeedyTurtle --#1.1 + // makeSlowTurtle (recipe below) --#4.0 + // ------------- Recipe for makeSlowTurtle --#3.0 + // Create a new slowTurtle instance + // Add your slowTurtle to your MultiTurtleWindow + // Have your slowTurtle draw a upside down triangle with 50 pixel sides + // ------------- End of makeSlowTurtle --#3.1 + // makeCrazyTurtle (recipe below) --#6.0 + // ------------- Recipe for makeCrazyTurtle --#5.1 + // Create a new crazyTurtle instance + // Add your crazyTurtle to your MultiTurtleWindow + // Have your crazyTurtle draw a 55 pixel long lightning bolt + // ------------- End of makeCrazyTurtle --#5.2 + } +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/WhichFish.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/WhichFish.java new file mode 100644 index 00000000..4ec25d05 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07objects/WhichFish.java @@ -0,0 +1,47 @@ +package org.teachingkidsprogramming.section07objects; + +//*************This Lesson is In Development*****************************// +public class WhichFish +{ + public static void main(String[] args) + { + // UNCOMMENT to create a variable called 'numberOfFish' to hold the result of the question "How many fishes?" -- #INFO + // Use the FancyMessageBox with a title of "Are fishes like wishes?" -- #INFO + // int numberOfFish = FancyMessageBox.askForNumericalInput("How many fishes?", "Are Fishes Like Wishes?"); --#1 + // Create recipe makeAFishyDecision using the numberOfFish (recipe below) --#2 + //----------recipe for makeAFishyDecision with the numberOfFish---------------------/ + // Use a switch...case on the numberOfFish --#3 + // When the numberOfFish is -1 --#4 + // UNCOMMENT to create a string of this image + // String image = "../TeachingKidsProgramming.Source.Java/src/main/resources/icons/thumb-up.png"; + // Create a new ImageIcon from your image + // UNCOMMENT to Show a message with the fancy message box this text, this title and this icon... + // FancyMessageBox.showMesage("Had a Fish", "Not hungry anymore...", icon); + // End + // When the numberOfFish is 0 --#4 + // UNCOMMENT to create a string of this image + // String image0 = "../TeachingKidsProgramming.Source.Java/src/main/resources/icons/information.png"; + // Create a new ImageIcon from your image + // Show a message with the fancy message box this text, this title and this icon... + // End + // When the numberOfFish is 1 --#5 + // UNCOMMENT to create a string of this image + // String image1 = "../TeachingKidsProgramming.Source.Java/src/main/resources/icons/star.png"; + // Create a new ImageIcon from your image + // Show a message with the fancy message box this text, this title and this icon... + // End + // When the numberOfFish is 2 --#6 + // UNCOMMENT to create a string of this image + // String image2 = "../TeachingKidsProgramming.Source.Java/src/main/resources/icons/github.png"; + // Create a new ImageIcon from your image + // Show a message with the fancy message box this text, this title and this icon... + // End + // Otherwise --#7 + // UNCOMMENT to create a string of this image + // String image4 = "../TeachingKidsProgramming.Source.Java/src/main/resources/icons/hint.png"; + // Create a new ImageIcon from your image + // Show a message with the fancy message box this text, this title and this icon... + // End + //--------end of recipe for makeAFishyDecision-------------------------------------/ + } +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/ConnectTheDots.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/ConnectTheDots.java new file mode 100644 index 00000000..67d7f371 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/ConnectTheDots.java @@ -0,0 +1,59 @@ +package org.teachingkidsprogramming.section08events; + +import org.teachingextensions.logo.Tortoise; +import org.teachingextensions.logo.utils.ColorUtils.ColorWheel; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; +import org.teachingextensions.logo.utils.EventUtils.MouseLeftClickListener; +import org.teachingextensions.logo.utils.EventUtils.MouseRightClickListener; + +public class ConnectTheDots implements MouseRightClickListener, MouseLeftClickListener +{ + public static void main(String[] args) + { + new ConnectTheDots(); + } + public ConnectTheDots() + { + setUpTheWindow(); + prepareColorPalette(); + // Listen for left clicks on the window for the tortoise --#1 + // Listen for right clicks on the window for the tortoise --#20.2 + } + @Override + public void onLeftMouseClick(int x, int y) + { + // addDot at x and y (recipe below) --#5 + // ------------- Recipe for addDot --#6 + // createCircle at x and y (recipe below) --#2 + // ------------- Recipe for createCircle --#3.0 (everything in this recipe) + // Create a new circle with a radius of 11 using the next color on the color wheel + // Change the circle to be 60% opaque + // Move the circle so that it's center is at the current position of the mouse (x,y) + // Place the circle on the tortoise's window + // ------------- End of createCircle Recipe --#3.1 + // Move the tortoise to the current position of the mouse (x,y) --#4 + // ------------- End of addDot Recipe + // Uncomment to write the text "Right click to clear the window" on the screen at position 100, 100 --#8 + // new Text("Right click to clear the window").setTopLeft(100, 100).addTo(Tortoise.getBackgroundWindow()); + } + @Override + public void onRightMouseClick(int x, int y) + { + // Clear everything from the window HINT: Use Tortoise --#7 + } + private static void prepareColorPalette() + { + ColorWheel.addColor(PenColors.Reds.Red); + ColorWheel.addColor(PenColors.Greens.Green); + ColorWheel.addColor(PenColors.Blues.Blue); + ColorWheel.addColor(PenColors.Purples.Purple); + ColorWheel.addColor(PenColors.Pinks.Pink); + ColorWheel.addColor(PenColors.Greens.Teal); + } + private void setUpTheWindow() + { + Tortoise.show(); + Tortoise.setSpeed(10); + Tortoise.hide(); + } +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/SimpleBubble.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubble.java similarity index 78% rename from TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/SimpleBubble.java rename to TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubble.java index 83fd4923..5742a749 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/SimpleBubble.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubble.java @@ -1,18 +1,20 @@ -package org.teachingkidsprogramming.section07events; +package org.teachingkidsprogramming.section08events; -import org.teachingextensions.windows.MouseLeftClickListener; +import org.teachingextensions.logo.utils.EventUtils.MouseLeftClickListener; public class SimpleBubble implements MouseLeftClickListener { public SimpleBubble() { - // Create a ProgramWindow titled Bubbles --#1 + // Create a ProgramWindow titled My Bubble --#1.1 + // Uncomment the line below -- #1.2 + // programWindow.setWindowVisible(true); // Have SimpleBubble listen for when the left mouse button is clicked in your program window --#2.2 // prepareColorPalette (recipe below) --#7.1 // // ------------- Recipe for prepareColorPalette --#7.2 // Add purple to the color wheel --#2.3 - // Add alice blue to the color wheel --#4 + // Add light steel blue to the color wheel --#4 // Add blue to the color wheel --#5 // Add dark blue to the color wheel --#6 // ------------- End of prepareColorPalette recipe --#7.3 diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/SimpleBubbleQuiz.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubbleQuiz.java similarity index 81% rename from TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/SimpleBubbleQuiz.java rename to TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubbleQuiz.java index b4fc6ef1..35b8ceda 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section07events/SimpleBubbleQuiz.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08events/SimpleBubbleQuiz.java @@ -1,10 +1,10 @@ -package org.teachingkidsprogramming.section07events; +package org.teachingkidsprogramming.section08events; -import org.teachingextensions.logo.PenColors; import org.teachingextensions.logo.Tortoise; -import org.teachingextensions.logo.shapes.Text; -import org.teachingextensions.windows.MouseLeftClickListener; -import org.teachingextensions.windows.MouseRightClickListener; +import org.teachingextensions.logo.utils.ColorUtils.PenColors; +import org.teachingextensions.logo.utils.EventUtils.MouseLeftClickListener; +import org.teachingextensions.logo.utils.EventUtils.MouseRightClickListener; +import org.teachingextensions.logo.utils.LineAndShapeUtils.Text; import org.teachingkidsprogramming.recipes.quizzes.graders.SimpleBubbleQuizAdapter; import org.teachingkidsprogramming.recipes.quizzes.graders.SimpleBubbleQuizGrader; @@ -13,20 +13,24 @@ public class SimpleBubbleQuiz extends SimpleBubbleQuizAdapter MouseLeftClickListener, MouseRightClickListener { + @Override public void question1() { //code: In the Tortoise background window, have this quiz listen for when the left mouse button is clicked //action: YOU must left click on the first base to pass this question } + @Override public void question2() { //code: Write "Single!" on the screen in yellow at position 155,135 } + @Override public void question3() { //code: In the Tortoise background window, have this quiz listen for when the right mouse button is clicked //action: YOU must right click on the home plate (4th base) to pass this question } + @Override public void question4() { //code: Write "Home Run!" on the screen in lime green at position 105,235 diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/DeepDive08TDD.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/DeepDive08TDD.java deleted file mode 100644 index 80728fac..00000000 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/DeepDive08TDD.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.teachingkidsprogramming.section08tdd; - -import java.awt.Cursor; - -import org.junit.Assert; -import org.junit.Test; -import org.teachingextensions.logo.Tortoise; - -//This deepdive is in progress! -@SuppressWarnings("unused") -public class DeepDive08TDD -{ - // How to do deep dive: - // Step 1: Select the method name (stringsCanBeArrays on line 27) Press the Run Button - // PC: Ctrl+F11 - // Mac: Command+fn+F11 - // Step 2: Read the name of the method that failed - // Step 3: Fill in the blank (___) to make it pass - // Step 4: Consider at least one thing you just learned - // Step 5: Advance to the next method - // Do not change anything except the blank (___) - // - @Test - public void stringsCanBeArrays() throws Exception - { - String[] words = {"happy ", ___}; - String result = words[0] + words[1]; - Assert.assertEquals("happy baby", result); - } - @Test - public void stringsCanBePartOfStringBuilder() throws Exception - { - StringBuilder sb = new StringBuilder(); - sb.append("happy"); - sb.append(" baby"); - String result = sb.toString(); - Assert.assertEquals("happy baby", ___); - } - @Test - public void stringsCanBePartOfStringBuilderAgain() throws Exception - { - StringBuilder sb = new StringBuilder(); - sb.append("very happy"); - sb.append(" lady"); - String result = sb.toString(); - Assert.assertEquals(___, result); - } - @Test - public void stringsCanBeReversedInStringBuilder() throws Exception - { - StringBuilder sb = new StringBuilder("very happy lady"); - sb.reverse(); - String result = sb.toString(); - Assert.assertEquals(___, result); - } - @Test - public void numbersCanBeStrings() throws Exception - { - StringBuilder sb = new StringBuilder(); - for (int i = 97; i <= 99; i++) - { - sb.append(convertArray(i)); - } - String result = sb.toString(); - Assert.assertEquals(___, result); - } - @Test - public void numbersCanBeStringsAgain() throws Exception - { - StringBuilder sb = new StringBuilder(); - for (int i = 99; i > ____; i--) - { - sb.append(convertArray(i)); - } - String result = sb.toString(); - Assert.assertEquals(" 99 98 97", result); - } - @Test - public void theLineEndsWhenItEnds() throws Exception - { - StringBuilder sb = new StringBuilder("one end "); - sb.append("\n"); - sb.append(" another end"); - String result = sb.toString(); - Assert.assertEquals(___, result); - } - @Test - public void theLineEndsReally() throws Exception - { - StringBuilder sb = new StringBuilder("one end "); - sb.append("\n"); - sb.append(" another end "); - sb.append(___); - String result = sb.toString(); - Assert.assertEquals("one end \n another end \n", result); - } - @Test - public void chainThoseMethods() throws Exception - { - StringBuilder sb = new StringBuilder("method"); - String result = sb.reverse().toString(); - Assert.assertEquals(___, result); - } - /** - * Ignore the following, It's needed to run the deep dive - * - * - * - * - * - * - * - * - * - * - */ - public boolean _____ = false; - public boolean ______ = true; - public Character _______; - public String ___ = "You need to fill in the blank ___"; - public int ____ = 0; - public String ___() - { - return ___; - } - private Cursor getCursor() - { - Cursor cursor = Tortoise.getBackgroundWindow().getCursor(); - return cursor; - } - public static String convertArray(int i) - { - return " " + i; - } -} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/FizzBuzz.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/FizzBuzz.java deleted file mode 100644 index ebb3e38b..00000000 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/FizzBuzz.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.teachingkidsprogramming.section08tdd; - -public class FizzBuzz -{ - // for the whole numbers from 1 to 100, print either that number, or, - // if that number is evenly divisible by 3, then print the word 'Fizz', - // if that number is evenly divisible by 5, then print the word 'Buzz', - // if that number is evenly divisible by either 3 or 5, then print the word 'FizzBuzz' - // - // NOTE: this is a kata (higher level instructions) - // part of the exercise is to translate into line-by-line English, THEN Java - // - // for more complete directions see this page - // https://www.penflip.com/lynnlangit/tkp-lesson-plans/blob/master/course09.txt -} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/FizzBuzzTDD.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/FizzBuzzTDD.java deleted file mode 100644 index e73bbfad..00000000 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/FizzBuzzTDD.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.teachingkidsprogramming.section08tdd; - -public class FizzBuzzTDD -{ - // for the numbers being tested, print out either that number, or, - // if that number is evenly divisible by 3, then print the word 'Fizz', - // if that number is evenly divisible by 5, then print the word 'Buzz', - // if that number is evenly divisible by either 3 or 5, then print the word 'FizzBuzz' - // - // write tests using the Assert object via the TDD style - // - // for more complete directions see this page - // https://www.penflip.com/lynnlangit/tkp-lesson-plans/blob/master/course09.txt -} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzz.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzz.java new file mode 100644 index 00000000..d1e6d9dd --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzz.java @@ -0,0 +1,15 @@ +package org.teachingkidsprogramming.section09final; + +public class FizzBuzz +{ + // For the whole numbers from 1 to 100, print either that number, or, + // If that number is divisible by 3, then print the word 'Fizz', + // If that number is divisible by 5, then print the word 'Buzz', + // If that number is divisible by 3 and 5, then print the word 'FizzBuzz' + // + // NOTE: this is a kata (higher level instructions) + // part of the exercise is to translate into line-by-line English, THEN Java + // + // For more complete directions see this page + // https://www.penflip.com/lynnlangit/tkp-lesson-plans/blob/master/course09.txt +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzzGoldenMaster.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzzGoldenMaster.java new file mode 100644 index 00000000..e8e51d00 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzzGoldenMaster.java @@ -0,0 +1,27 @@ +package org.teachingkidsprogramming.section09final; + +import org.junit.Test; +import org.teachingextensions.approvals.lite.Approvals; + +public class FizzBuzzGoldenMaster +{ + // Write a test using the GoldenMaster method via the TDD style for the convert method + // IMPORTANT - GoldenMaster testing requires the use a of file compare tool + // Download 'BeyondCompare' -- http://www.scootersoftware.com/download.php + @Test + public void testNumbers() throws Exception + { + // Arrange Create a list of numbers from 1-100 + // Act Call the convert method on the list + // Verify The list is a Golden Master (uses .received and .approved files) + Approvals.verify("1"); + } + public static String convert(int i) + { + // For the whole numbers from 1 to 100, print either that number, or, + // If that number is divisible by 3, then print the word 'Fizz', + // If that number is divisible by 5, then print the word 'Buzz', + // If that number is divisible by 3 and 5, then print the word 'FizzBuzz' + return ""; + } +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzzTDD.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzzTDD.java new file mode 100644 index 00000000..5aff1d66 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/FizzBuzzTDD.java @@ -0,0 +1,24 @@ +package org.teachingkidsprogramming.section09final; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class FizzBuzzTDD +{ + // For the numbers being tested, print out either that number, or, + // If that number is divisible by 3, then print the word 'Fizz', + // If that number is divisible by 5, then print the word 'Buzz', + // If that number is divisible by 3 and 5, then print the word 'FizzBuzz' + // + // Write tests using the Assert object via the TDD style + // + // For more complete directions see this page + // https://www.penflip.com/lynnlangit/tkp-lesson-plans/blob/master/course09.txt + @Test + public void test1Returns1() + { + //String result = FizzBuzzTDD.convert(1); + assertEquals(1, 0); + } +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/RectangleKata.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/RectangleKata.java new file mode 100644 index 00000000..3d1af3a0 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/RectangleKata.java @@ -0,0 +1,13 @@ +package org.teachingkidsprogramming.section09final; + +public class RectangleKata +{ + public static void main(String[] args) + { + // Draw a rectangle + // Write the steps to code your rectangle out in English + // Translate from English to Java one line at a time + // Run your code after each line of Java to make sure it works as expected + // XTRA CREDIT: After your code is working, re-factor to remove duplication + } +} diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/SimplePuzzle.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/SimplePuzzle.java similarity index 87% rename from TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/SimplePuzzle.java rename to TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/SimplePuzzle.java index fa7e7ced..1327c827 100644 --- a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/SimplePuzzle.java +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/SimplePuzzle.java @@ -1,4 +1,4 @@ -package org.teachingkidsprogramming.section08tdd; +package org.teachingkidsprogramming.section09final; import java.awt.EventQueue; import java.util.Arrays; @@ -7,10 +7,10 @@ import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; -import org.teachingextensions.logo.Puzzle; -import org.teachingextensions.logo.PuzzleAnimation; -import org.teachingextensions.logo.PuzzleBoard; -import org.teachingextensions.logo.PuzzleState; +import org.teachingextensions.logo.utils.PuzzleUtils.Puzzle; +import org.teachingextensions.logo.utils.PuzzleUtils.PuzzleAnimation; +import org.teachingextensions.logo.utils.PuzzleUtils.PuzzleBoard; +import org.teachingextensions.logo.utils.PuzzleUtils.PuzzleState; public class SimplePuzzle implements Runnable { @@ -41,6 +41,7 @@ public static int[] shuffled(int[] source) public void run() { this.setLookAndFeel(); + PuzzleState solution = null; // Do this until the player finds a solution --#6.1 // Create a Message Box that shows the message "Looking for puzzle solution..." --#4 // diff --git a/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/WheelKata.java b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/WheelKata.java new file mode 100644 index 00000000..8265f586 --- /dev/null +++ b/TeachingKidsProgramming/src/org/teachingkidsprogramming/section09final/WheelKata.java @@ -0,0 +1,10 @@ +package org.teachingkidsprogramming.section09final; + +public class WheelKata +{ + // Draw a wheel + // Write the steps to code your wheel out in English + // Translate from English to Java one line at a time + // Run your code after each line of Java to make sure it works as expected + // XTRA CREDIT: After your code is working, re-factor to remove duplication +} diff --git a/images/download zip.png b/images/download zip.png new file mode 100644 index 00000000..6e4a3ffe Binary files /dev/null and b/images/download zip.png differ diff --git a/images/download_zip.png b/images/download_zip.png new file mode 100644 index 00000000..6e4a3ffe Binary files /dev/null and b/images/download_zip.png differ diff --git a/install.sh b/install.sh new file mode 100644 index 00000000..a7db2843 --- /dev/null +++ b/install.sh @@ -0,0 +1,17 @@ +mkdir ~/TKPSource +cd ~/TKPSource +wget https://github.com/clockwisemusic/TeachingKidsProgramming.Java/archive/master.zip +unzip master.zip +rm master.zip +mv TeachingKidsProgramming.Java-master TeachingKidsProgramming.Java +cd TeachingKidsProgramming.Java +unzip eclipse_workspace.zip +cp tkp.desktop ~/Desktop +echo Exec=$HOME/eclipse/eclipse -data $HOME/TKPSource/TeachingKidsProgramming.Java >>~/Desktop/tkp.desktop +chmod +x ~/Desktop/tkp.desktop +cd ~/ +wget http://mirror.internode.on.net/pub/eclipse/technology/epp/downloads/release/luna/SR2/eclipse-java-luna-SR2-linux-gtk-x86_64.tar.gz +tar xzf eclipse-java-luna-SR2-linux-gtk-x86_64.tar.gz +rm eclipse-java-luna-SR2-linux-gtk-x86_64.tar.gz +~/eclipse/eclipse -data ~/TKPSource/TeachingKidsProgramming.Java +#sudo apt install gnome-color-chooser diff --git a/tkp.desktop b/tkp.desktop new file mode 100755 index 00000000..90f01d9b --- /dev/null +++ b/tkp.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Name=Teaching Kids Programming +Comment=Teaching Kids Programming In Java +Icon=eclipse +StartupNotify=true +Terminal=false +Type=Application