FINAL PROJECT

FINAL I2P PROJECT

Group Members: Chloe Li, Selina Li (Me)


Criterias:

  • Design Thinking Questionnaire – results
  • Design Thinking Sentence to summarise chosen idea
  • A list of equiptment needed for project
  • Flow chart
  • Algorithm and Pseudo Code
  • Code project with at least 3 references (sited)
  • Screenshot annotations and linked on Git Hub
  • Images / video introducing your project and a working prototype (Please include: titles, music/VO and upload to You Tube to share the video)
  • Testing Document – showing various tests over the project creation
  • Evaluation of final summative project and and your own reflection in I2P this semester


Brainstorming Stage:

In the beginning, we brainstormed many possible ideas for our project. We tried to pinpoint some of the areas in the HKIS community where students might be having trouble with and where we had the potential to solve. Some of the ideas include the following:

1. Choosing classes: A platform that would have quizzes that would ultimately narrow down class choices for users and help them decide which courses they should take in the following years

2. Class Reviews: A platform that has class reviews and everything the teacher wrote in class to help students who missed class

3.Book recommendations: When students borrow a book, this platform would tell the student similar books that he/she might be interested in

4. Overdue Books: Email sent when book is about to be overdue

5. Book reviews: A platform where students can submit book reviews for other students

6. Teacher’s schedules: A platform that students can access to see teacher’s meetings and schedule to know when to find them

7. Pre-ordering lunch: A platform that will allow students to pre-order lunch so they don’t have to queue up when they arrive in the cafeteria. 

8. Grades: A program that inputs the student’s grades and looks at trend, provides projected GPA and what they need to obtain a certain grade; colleges that fit your grade


 

Questionnaire Stage:

We conducted 2 surveys: the first one on a few ideas we came up with, and based on the answers of the first survey, we directed our focus onto one specific area. Out of all our brainstormed ideas, ideas #1, #2, and #8 stood out to us the most, and our questionnaire was mainly comprised of questions that could help us narrow down to one of our three choices.

After we conducted the survey, we found that most people were supportive of the idea of having a survey available to help students target course options that were suitable for their personal interests and passions. The results of the survey will lead students to more information on each of the classes with specific answers by respective teachers of common questions asked about the classes. The survey would be based on what the teachers thought of the course, and what kind of students they think would excel most in the school. The program will also give users a possible four year plan that they can develop upon. This is a link to the form for you to view the results of the survey: https://docs.google.com/a/hkis.edu.hk/forms/d/1zkSRT_eHrmcJczwF5BrvHZ-B3tf8LVFGq1cqbcl4fRc/edit#response=ACYDBNhepvjTHZozfKD0UdOXiTsQ55h3ySW987ITapY0smtucWZw70X2I4fzgg

We designed a separate questionnaire specifically on this idea, and we asked questions such as:

  • Are there any classes you are unfamiliar with?
  • If you answered yes to the first question: What department are those unfamiliar classes part of?
  • If you answered yes to the first question: Do you think your course selections would change if you were aware of all the available classes? Please explain
  • What do you consider when you chose your classes for this year?
  • Do you think it would be useful to have a survey designed to find courses that are most suited for your interest and passions? Please explain.
  • How often do you refer to the students handbook for information on available courses?
  • For people who chose 5 or less for the previous question, what is the reason why you don’t refer to it very often?

We found that large majority of the students admitted that there are courses HKIS provides that they are not familiar with.

The classes that students were unfamiliar with are mostly in the arts, religion and humanities departments.

Most students agreed that their course selection would have changed if they had been more informed on the course options, and that a survey designed to help students discover classes suited to their interests and passions would be very useful.

It is also very clear that the student’s handbook is not very commonly used among the students. Even though there is much information on all the courses in the handbook, students find it difficult to scroll through, and that it doesn’t really help them to decide whether or not classes are suitable for them. The information given is vague, and doesn’t apply personally.

Overall students expressed enthusiasm towards the idea of having a survey that recommends a targeted list of classes to each student. The link to the questionnaire is here: https://goo.gl/forms/rZFxAIg7bq6lvzxu2


Design Thinking Statement

Our HKIS students are having difficulty choosing the right courses for themselves because they rarely refer to the student handbook, so we are creating a short quiz that would help them narrow down their options and make their course selection process easier.


Downsizing Process

Interviewing stage: 

We soon discovered that despite our eagerness to make our plan become reality, the project was simply too big to complete within a week time. What we originally had in mind was to interview teachers of all classes to gain more insight into classes that they teach. We spent a class interviewing teachers, asking questions such as:

1.What are the common characteristics of students who take your class?

2.What personality leads to excellence in this class?

3.How would you describe this class?

4.What makes this class different from all other classes?

5.What do students take away from this class?

6.How heavy is the workload, and what do they mainly consist of?

I acted as the scribe during the interviews, while Chloe asked the majority of the questions. We interviewed 3 students within the first programming class. Although we were able to obtain very detailed responses from teachers, we found out that this process would simply take too long if we wanted it to do it for every class offered in HKIS, and it would be impossible to complete within a week. We decided that instead of creating a survey that would recommend courses of each topic, we would focus on the math department specifically. However, because we still wanted to gain more insight about each math course (on top of basic information provided in the student handbook), Chloe created a short survey for math teachers to fill in:

WhatsApp Image 2017-05-30 at 10.36.15

 

In doing so, the responses were standardized.We then spent the next class collecting responses in the Math Department, and by the end of class, we had collected approximately 12 survey responses. However, we realized that since we limited the choices of their answers to few multiple choice questions, we could not use them as determining factors of the student survey. We decided that instead of implementing them in the student survey, we would use it as data to introduce the different classes along with the information given in the student handbook to give students personal insight into each course.

Research:

We realized that like the rest of the student body, we did not know all there is to know about the math courses available in HKIS. Hence, we decided that before we created the student survey, we needed to read into each of the math courses. We studied the information of each class given in the student handbook on dragonnet, then referred to the teachers’ responses from the previous survey, and created an outline of each class:

WhatsApp Image 2017-05-30 at 10.34.13 WhatsApp Image 2017-05-30 at 10.34.14

WhatsApp Image 2017-05-30 at 10.34.18

We realized that we also needed to understand the general four-year curriculum of the high school math department, so we referred to the student handbook and drew a rough sketch of curriculum map:

WhatsApp Image 2017-05-30 at 10.33.40


Pseudo Code

Draft 1:  Our first attempt to writing the pseudocode for the program proved to be extremely difficult. There too many anomalies in the system, and the countless possibilities were unimaginable. We wanted the code to first eliminate all the courses that the student has taken in the past, eliminate the ones that are taking now, and then ask for their current grade in their math class. According to their grade, we then distribute them into 3 classes: the honors, the average, the in-between, and the electives. For the students that fall in the cracks between the honors course and the average curriculum, we ask them to rate the difficulty of their current class from 1 to 10. According to their response, we then place them into a more suitable math class. For students that have substantially low grades, we place them in the elective courses, where the classes include aspects of other subjects such as social science, science, and humanities. However, we were very confused as to where to place some of the additional questions we wanted to ask, such as their preferred workload, learning strategies, and assessment format. As shown below, I attempted to write out a detailed version of the pseudo code, but it was ultimately incomplete due to the countless anomalies that we could not place within the system. This led us to our second version of pseudo code.

WhatsApp Image 2017-05-30 at 10.32.51

Draft 2: 

Our second draft of the pseudo code was also quite complicated but easier to follow. The pseudo code is written below. The first part of the survey would ask whether or not the student is a rising freshman. If he/she is, then they would move to part 2, where their grades and their current grade 8 math class (8 regular or 8+) would determine which freshman math course they should take. There are anomalies within this section, because some 8th graders take a test to skip Honors Geometry and go directly to Honors Advanced Algebra in their freshman year. If the user is not a freshman, they are asked which current math class they take. If it is anything below Honors PreCalculus, they head to Part 1, where their grades determine whether they should take an Honors or Non Honors class next year. IF they are in Honors Pre Calculus, they would go to Part 3, where their grades determine whether they should go to AP Calculus AB or AP Calculus BC, and whether or not they should take AP Statistics on top of that. Finally, if they are in a class above Honors PreCalculus currently, then depending on whether or not they are interested in continuing math next year, we recommend Advanced Mathematical Topics and AP Statistics (unless they already took it).

As you can probably see, this pseudo code is more clear than the previous one and anyone could follow along, but we knew that it would be extremely difficult to program because there are so many possibilities and exceptions.

1 2

We created a google form to go with this pseudo code. We took into account all the different grade levels, workload, preferred assessment format, etc. Here is the google form link: https://docs.google.com/a/hkis.edu.hk/forms/d/e/1FAIpQLSeIyrJT9EXV9UdIKth6UybWbQzz0tKdj1XbfigUOarCrnwHFA/viewform.

Pictures of the google form are attached below:

a b c d

 

Although we were successful in creating a pseudo code and google form for the student survey,  we failed to program the google script for this complex plan. We seeked help from Ms. Mok and Mr. Lin, and decided in the end to downsize the program even more. We decided that instead of taking into account to all the anomalies and getting bogged down by the miniscule details, we should just focus on creating a rough prototype. This led us to our third and final draft of pseudo code.

Draft 3:

WhatsApp Image 2017-05-30 at 10.32.49 (2)

This is a pseudocode of our now very simplified plan. The first question that we would ask the user is whether or not they are currently taking an Honors Course. If they are, we would then ask for their current grade (semester grade). If the grade is a B+ or higher, we would send them an automated email that would give them all the Honors and AP courses available at HKIS. If the grade is a B or lower, then we would send them an automated email recommending them to non honors courses in HKIS. On the other hand, if they are currently not taking an honors courses, and they have an A, then we would send them an email saying that they might want to consider the possibility of moving up to an honors course. If they have a grade within the range of A- to C, then we would recommend that they stay in the normal curriculum. Finally, if they have a D or F, then we would recommend them to repeat their current course and consider taking a math elective if they are interested.

This is the flowchart that I made to go along with our pseudocode, using the different shapes to represent different functions.

WhatsApp Image 2017-05-31 at 11.08.22

 


Equipment that we used:

Unlike several other groups, the project that Chloe and I did really only required a computer and the Google Scripts program. We also used the student’s handbook along with responses from the math department to create our videos.

 


 

Program: 

We created a google form that were targeted to rising freshmen, sophomores and juniors. Because we have no previous experience on Google Scripts or Java Script, we decided to keep it relatively simple and go one step at a time. I will go through the function here portion by portion, but the youtube video at the end explains everything as well as an example of it running.

function main() {
  //opens the spreadsheet
  var ssId = "1h7PIAAgi8ZrdJdu2cqveEHbv9zHVTsKA399FHHd9n58";
  var ss = SpreadsheetApp.openById(ssId);
  //opens specific sheet which is named Form responses 1
var sheet = ss.getSheetByName("Form responses 1");
  ///Logger.log(sheet.getLastRow());
  var range = sheet.getRange(1, 1, sheet.getLastRow(), 4);
  var i = sheet.getLastRow()-1;
  var grade = range.getValues()[i][2];
  ///Logger.log(grade);
  var honor = range.getValues()[i][1];
  var email = range.getValues()[i][3];

This is the first portion of our code, which we named to be the function main(). The first thing that happens is the program opens the spreadsheet of the google form. Screenshots of our google form and the corresponding spreadsheet is attached below.

 

 

Screen Shot 2017-05-30 at 12.10.59 PM

 

Screen Shot 2017-05-30 at 10.55.09 AM

Therefore, the var ssID, var ss, and var sheet are all directing the program to the specific spreadsheet that contains all the responses. The range specifies which row the program should look at each time, and a variable i is introduced the program would always look at the last row. Then, we declared certain variables, assigning them to a specific cell.

  if (honor == 'Yes'){
     if (grade == 'A' || grade == 'A-'||grade == 'B+') {
        SendEmailHonors(email);
     }
     if (grade == 'B' || grade == 'C' ||grade == 'D' || grade == 'F') { 
        SendEmailNormal(email);
}
     }
  if (honor=='No') {
    if (grade == 'A') {
      SendBothEmail(email);
    }
    if (grade=='A-'||grade=='B+'||grade=='B'||grade=='C') {
      SendEmailNormal(email);
    }
    if (grade=='D'||grade=='F') {
      SendFailEmail(email);
    }
  }

After that, still within our main function, we set up some if statements that would lead to 4 possible automated emails. How this process works is already explained in our pseudo code, but there were definitely technical things that we struggled with, such as setting up the ‘or’ operator. These problems and how we overcame them is further explained in the table attached below. Each of the if statements lead to separate functions, which are different automated emails

function SendEmailHonors(email) {
  //var doc = DocumentApp.create('Recommended Courses for ' + email);
  //https://docs.google.com/document/d/1xCUPv0PgBHYcQhIKWcBYXo9kANYCp2SDQIlbfZR7YiA/edit
  //addEditor(user.email);
  //var body = doc.getBody();
  MailApp.sendEmail({
    to: email,
    subject: 'Course Recommendations',
    body: 'Thank you for doing our survey. Based on your results, we recommend you to take an Honors or AP course next year.The link attached has descriptions of all the honors and AP courses available at HKIS, but obviously some may not be applicable to you based on your grade level. Please look at this google doc for further information: https://docs.google.com/a/hkis.edu.hk/document/d/1xCUPv0PgBHYcQhIKWcBYXo9kANYCp2SDQIlbfZR7YiA/edit?usp=sharing',
    //attachments: doc,
  });
}
  }

This is the function that sends an email that recommends all the honors and AP courses of HKIS. At the end of the body line, we link it to a google document that has all the links to youtube videos that we created for each course. The document that is attached for this specific email looks like this:

Screen Shot 2017-05-30 at 11.07.14 AM

This is repeated for the rest of the code, sending an automated email based on their survey responses, and each linking to a different google doc that contains different links.

function SendEmailNormal(email) {
  MailApp.sendEmail({
    to:email,
    subject: 'Course Recommendations',
    body: 'Thank you for doing our survey. Based on your results, we recommend you to take a non Honors course next year. The link attached has descriptions of all the non Honors courses available at HKIS, but obviously some may not be applicable to you based on your grade level. Please look at this google doc for further information: https://docs.google.com/a/hkis.edu.hk/document/d/1DPucRJRTdSVnvJVHPyLU_Kjtbc5nWIehxRMv9Tf-yHQ/edit?usp=sharing',
  }); 
}

function SendBothEmail(email) {
  MailApp.sendEmail({
    to:email,
    subject: 'Course Recommendations',
    body: 'Thank you for doing our survey. Based on your results, we know that you are currently taking a non honours course, but we recommend you to consider the possibility of taking an honors or AP course next year. The link attached has descriptions of all these courses available at HKIS, but obviously some may not be applicable to you based on your grade level. Please look at this google doc for further information: https://docs.google.com/a/hkis.edu.hk/document/d/1E_kvzNGD_9o0rCJ4CvujoNxo31CB6G4gByCmTpBakJk/edit?usp=sharing ',
  }); 
}

function SendFailEmail(email) {
  MailApp.sendEmail({
    to:email,
    subject: 'Course Recommendations',
    body: 'Thank you for doing our survey. Based on your results, we recommend you to repeat your course next year. If you are passionate about math, we also recommend some math elextives for you to take next year. The link attached has descriptions of all the math elective courses available at HKIS that may be of interest to you, but obviously some may not be applicable to you based on your grade level. Please look at this google doc for further information: https://docs.google.com/a/hkis.edu.hk/document/d/16kdUrY4A1_T9l0ihEYZhOCR1Li47e7JqU2RgsGGdQQM/edit?usp=sharing ',
  }); 
}

These are the other google documents that a user might receive (some of the screenshots are part of a document, not the full one).

Screen Shot 2017-05-31 at 11.12.56 AMScreen Shot 2017-05-31 at 11.14.31 AMScreen Shot 2017-05-31 at 11.14.26 AM

 

An example of an email that a user might receive would look like this:

Screen Shot 2017-05-30 at 12.15.29 PM

The links of on the google doc take the recipient to youtube videos with details on their recommended course(s). We created a video for each of the math classes using the information on the student handbook, and the teacher’s’ responses. Since one of the biggest findings from our original questionnaire was that students dislike referring to the student handbook due to its inconvenience and great amounts of text, we created videos of us drawing key aspects of each course in forms of visual symbols and keywords. We then summarized the learning outcomes, curriculum, workload and prerequisites of each class in under 2 minutes.ounts of text, we created videos of us drawing key aspects of each course in forms of visual symbols and keywords. We then summarized the learning outcomes, curriculum, workload and prerequisites of each class in under 2 minutes. This is a link to the playlist which contains all the videos: https://www.youtube.com/playlist?list=PLNi1s36p6TtmvGeX5uaxD6EELNW0H8lw7    and below is an example of one of them.

This is a video where we talked through our program and coding process.


 

Problems that we encountered and how we overcame them:

 

Item to be Tested Expected outcome Actual Outcome Fixed Y/N How did we fix the error? Date fixed
Trigger We wanted our program to automatically run when a user submitted. We did research online, and found from source 1 that this could be done using onEdit(e). We added onEdit(e) to our program, but nothing happened automatically when a user submitted something. The program simply read onEdit() as a function with the name onEdit() rather than a trigger. Yes We learnt from source 2 that we had to manually add a trigger in google script by going to Edit>Current project’s trigger, and set up a trigger from there. Therefore, the function didn’t actually have to be called onEdit(), it could be called anything-and we kept our main function called main() and simply added a trigger for that. 25/5
Making the script apply to each new response We wanted our program to work for each new response. Our program only did it for the same response each time because we set the range to a specific row. Yes We changed our range from sheet.getRange(1,1,0,4) to sheet.getRange(1,1,sheet.getLastRow(),4) and we set up the variable ‘i’ that would change in accordance to how many responses we had. This way, it would work for each new response instead of repeating the program for the same response. 25/5
If statement We had many places where the if statement, and we wanted it to work just like it does in python. It would not work, there was an error. Yes We learnt from source 3 that if statements in java script is written differently. For instance, they are written in the form of: if (honor==’No’) {} 26/5
Compound statement We expected the program to run, and that the compound statement would run fine. We had an error, saying we were missing } in compound statement. Yes This was a relative easy fix. As we learnt from source 4, because we had a compound statement, we had to close it with an extra ‘}’ because it was essentially a syntax within a syntax. 27/5
Or function We wanted our if statements to work if either or of some criteria were met. For instance, we wanted our program to automatically send the ‘Honors’ email if a current honors student had grades of A, A-, or B+. We did not know how to write ‘or’ in google script, so obviously it was unable to work. Yes We learnt from source 5 that the or operator is different from python’s. In order to write ‘or’, we had to type ||. For instance, in our code, we now have:if (grade == ‘A’ || grade == ‘A-‘||grade == ‘B+’) {       SendEmailHonors(email,grade); } 27/5
Sending automated email function We wanted our program to automatically send an email to the user with their survey results and our recommendations. We were unable to program this part, and had to use online resources. Yes We learnt from source 6 how to add this automated email syntax, and to our pleasant surprise it was actually quite simple. All we had to do was write MailApp.sendEmail({ to: subject: body:{};In order to do this, we also had to add to our survey, asking for  the user’s email in the beginning. We did not consider this when we were doing our pseudo code and flow chart. 28/5
Sending automated email to the user’s email We wanted our form to collect the user’s email in the beginning, and the program should automatically send an email to that entered email. The program would not send an email, and the function SendEmail could not get the user’s email. Yes We found out that it could not get the user’s email because that was stored in the main function, not the sending email function. To fix this, at the end of the main function, when we directed the program to head onto the sending email function, we called the variable email so that the email function could refer to the user’s email and send an email accordingly. 28/5
Attaching a google document We wanted to attach a google doc in our automated email that would give the user a deeper insight to the courses that may be fitting to them in the upcoming year. We tried to use assign a variable doc that would create a document for the specific user each time (var doc = DocumentApp.create(‘Recommended Courses for ‘ + email);), but found that this could not work because we would have to write the entire document inside the google scripts (because it is a new document created for each user) Yes Instead of doing that, we decided to pre-create 4 google documents, where each response would land on either one of the 4. Then, we just attached the corresponding google document onto the automated email for the user to access. 29/5

 

Sources:

  1. https://developers.google.com/apps-script/guides/triggers/
  2. https://developers.google.com/apps-script/guides/triggers/installable
  3. https://stackoverflow.com/qustions/13894057/how-to-write-an-if-and-statement-in-google-apps-script
  1. https://github.com/FF-Remote-Control/FF-Remote-Control/issues/9
  2. https://stackoverflow.com/questions/19973134/boolean-operators-and-clienthandler
  3. https://developers.google.com/apps-script/articles/sending_emails

Final Product- The code!

function main() {
  //opens the spreadsheet
  var ssId = "1h7PIAAgi8ZrdJdu2cqveEHbv9zHVTsKA399FHHd9n58";
  var ss = SpreadsheetApp.openById(ssId);
  //opens specific sheet which is named Form responses 1
var sheet = ss.getSheetByName("Form responses 1");
  ///Logger.log(sheet.getLastRow());
  var range = sheet.getRange(1, 1, sheet.getLastRow(), 4);
  var i = sheet.getLastRow()-1;
  var grade = range.getValues()[i][2];
  ///Logger.log(grade);
  var honor = range.getValues()[i][1];
  var email = range.getValues()[i][3];
  if (honor == 'Yes'){
     if (grade == 'A' || grade == 'A-'||grade == 'B+') {
        SendEmailHonors(email);
     }
     if (grade == 'B' || grade == 'C' ||grade == 'D' || grade == 'F') { 
        SendEmailNormal(email);
}
     }
  if (honor=='No') {
    if (grade == 'A') {
      SendBothEmail(email);
    }
    if (grade=='A-'||grade=='B+'||grade=='B'||grade=='C') {
      SendEmailNormal(email);
    }
    if (grade=='D'||grade=='F') {
      SendFailEmail(email);
    }
  }

function SendEmailHonors(email) {
  //var doc = DocumentApp.create('Recommended Courses for ' + email);
  //https://docs.google.com/document/d/1xCUPv0PgBHYcQhIKWcBYXo9kANYCp2SDQIlbfZR7YiA/edit
  //addEditor(user.email);
  //var body = doc.getBody();
  MailApp.sendEmail({
    to: email,
    subject: 'Course Recommendations',
    body: 'Thank you for doing our survey. Based on your results, we recommend you to take an Honors or AP course next year.The link attached has descriptions of all the honors and AP courses available at HKIS, but obviously some may not be applicable to you based on your grade level. Please look at this google doc for further information: https://docs.google.com/a/hkis.edu.hk/document/d/1xCUPv0PgBHYcQhIKWcBYXo9kANYCp2SDQIlbfZR7YiA/edit?usp=sharing',
    //attachments: doc,
  });
}
  }
       
function SendEmailNormal(email) {
  MailApp.sendEmail({
    to:email,
    subject: 'Course Recommendations',
    body: 'Thank you for doing our survey. Based on your results, we recommend you to take a non Honors course next year. The link attached has descriptions of all the non Honors courses available at HKIS, but obviously some may not be applicable to you based on your grade level. Please look at this google doc for further information: https://docs.google.com/a/hkis.edu.hk/document/d/1DPucRJRTdSVnvJVHPyLU_Kjtbc5nWIehxRMv9Tf-yHQ/edit?usp=sharing',
  }); 
}

function SendBothEmail(email) {
  MailApp.sendEmail({
    to:email,
    subject: 'Course Recommendations',
    body: 'Thank you for doing our survey. Based on your results, we know that you are currently taking a non honours course, but we recommend you to consider the possibility of taking an honors or AP course next year. The link attached has descriptions of all these courses available at HKIS, but obviously some may not be applicable to you based on your grade level. Please look at this google doc for further information: https://docs.google.com/a/hkis.edu.hk/document/d/1E_kvzNGD_9o0rCJ4CvujoNxo31CB6G4gByCmTpBakJk/edit?usp=sharing ',
  }); 
}

function SendFailEmail(email) {
  MailApp.sendEmail({
    to:email,
    subject: 'Course Recommendations',
    body: 'Thank you for doing our survey. Based on your results, we recommend you to repeat your course next year. If you are passionate about math, we also recommend some math elextives for you to take next year. The link attached has descriptions of all the math elective courses available at HKIS that may be of interest to you, but obviously some may not be applicable to you based on your grade level. Please look at this google doc for further information: https://docs.google.com/a/hkis.edu.hk/document/d/16kdUrY4A1_T9l0ihEYZhOCR1Li47e7JqU2RgsGGdQQM/edit?usp=sharing ',
  }); 
}

Reflection: Through this entire journey, we really learned the process of Design Thinking. In the beginning, we had a grand idea that we wanted to execute, and we created complicated pseudo codes that we thought could work out perfectly fine, but we never really stopped and considered the fact that we were complete beginners and foreign to Google Script, meaning in reality it is impossible for us to produce a perfect product in one go.  I think one of most important lessons learnt that all great creations need to start somewhere, and nobody can create the perfect prototype in the first go. It is important to start small, and edit the errors and imperfections as you proceed. If one is so bogged down by miniscule details in the planning stages of the process, the program will never be completed.

Perhaps one other takeaway from this assignment is just how difficult programming can be. Although we know exactly what we want the program to do, we didn’t know how to turn our words into codes. Since we were only familiar with the python language, having to work with java and google script was very difficult. It was like being lost in a foreign land!

We also learned that online resources can be extremely helpful when we are trying to learn a new language. In the beginning, we were sometimes too determined to figure out everything by ourselves, but through the process of coding our program, we were constantly referring  to online resources for help.

Course Reflection:

I think that overall, this course has really helped me understand the Design Thinking Process, which provided a solution based approach to solving problems. Over the course, there have been multiple times where we had to tackle some complex problems (especially coming from a background with no experience on programming whatsoever), but these five steps of empathising, defining the problem, ideating, prototyping, and testing really helped me go through my problems and be successful in my final products. I think this was especially apparent in the last project, where this non linear design thinking process ultimately lead Chloe and I to be resilient and finally succeed. I think that this course also helped me have a good introduction into programming. I learnt a lot from different programs and tools: Scratch, Makey Makey, Python, Pygame, Arduino, and of course Google scripts. This would not have been possible without online resources, which really aided me and my peers in multiple aspects and helped us figure stuff out. I also found that blogging my progress in this class was very helpful in the long run. In the beginning, I honestly thought that blogging after each lesson would be kind of useless and really tedious. However, I realised that it was actually very useful in the sense that it could help me track my progress very easily, and to my surprise I actually found that I would occasionally refer back to my previous posts for guidance. Another thing that I learned to value through this class is teamwork. In the first few weeks of this class, I viewed programming to be completely individual, and often times I would spend the class working by myself despite sitting with friends, not really willing to work together. However, I learned that it is much easier to work together with other people and figure the code collaboratively. By working on pseudo codes, flowcharts, and the codes with other people, it was nice to listen to different ideas and then together stick with one idea that we all thought would work well.

 

Final Project

This post is a compilation of reflections throughout the journey of this project

 

MAY 20:          Progress from the first couple of days (Questionnaire):    

While brainstorming for ideas for this project, Chloe and I created a mindmap on the classroom whiteboards and came up with several ideas. We did not take a picture of the whiteboard, but below are some brief explanations of some ideas that we brainstormed.

1. Choosing classes: A platform that would have quizzes that would ultimately narrow down class choices for users and help them decide which courses they should take in the following years
2. Class Reviews: A platform that has class reviews and everything the teacher wrote in class to help students who missed class
3.Book recommendations: When students borrow a book, this platform would tell the student similar books that he/she might be interested in
4. Overdue Books: Email sent when book is about to be overdue
5. Book reviews: A platform where students can submit book reviews for other students
6. Teacher’s schedules: A platform that students can access to see teacher’s meetings and schedule to know when to find them
7. Pre-ordering lunch: A platform that will allow students to pre-order lunch so they don’t have to queue up when they arrive in the cafeteria. 
8. Grades: A program that inputs the student’s grades and looks at trend, provides projected GPA and what they need to obtain a certain grade; colleges that fit your grade

We narrowed it down to three main ideas that we liked the most, which were ideas #1, #2, #8, and created a questionnaire that would narrow down our options. Here are the questions and answers from this questionnaire:

Screen Shot 2017-05-21 at 10.59.42 AMScreen Shot 2017-05-21 at 10.59.49 AM345

67

Screen Shot 2017-05-21 at 11.21.28 AM Screen Shot 2017-05-21 at 11.21.34 AM Screen Shot 2017-05-21 at 11.21.38 AM

 

This is the link to the actual form if you would like to see the results in a less chaotic way:)

https://docs.google.com/a/hkis.edu.hk/forms/d/1zkSRT_eHrmcJczwF5BrvHZ-B3tf8LVFGq1cqbcl4fRc/edit#response=ACYDBNhepvjTHZozfKD0UdOXiTsQ55h3ySW987ITapY0smtucWZw70X2I4fzgg

However, after talking to Ms. Mok about our ideas, we found out that two of our ideas were probably not the best. One of them was the grading idea, because as Ms. Mok said, HKIS just changed its grading system to look at trend and there is still uncertainty and controversy around the issue. The other one was the class review idea because Ms. Mok pointed out that students could often get help from the teacher, other students, or schoology. Therefore, we made another questionnaire over the weekend and sent it to people to fill out, this time focusing on our remaining idea. Here are some screenshots of the results from that questionnaire:

1Screen Shot 2017-05-21 at 8.59.52 PM

 

 

3rd question (it is a little long so I copy and pasted the responses in a table here instead): If you answered yes to the first question: Do you think your course selections would change if you were aware of all the available classes? Please explain.

Yes, I think that if I was more aware of all the classes, I’d be able to choose my electives a little differently. However, I think the major classes would probably remain the same, as I am pretty clear on what classes are available for those.
I think it would, especially the classes a few years later for freshmen and sophomores, because we don’t really know what classes there are, and if we were more aware of all the choices, we could plan out our four years better.
Yes, there is a pretty high chance of that happening. In fact, it could have changed my courses this year. As a freshman last year, I took Honors Advanced Algebra, which meant that I could technically take AP Statistics this year along with Honors Precalculus. But, I was unfamiliar with AP Statistics as a freshman and did not know that I had already met the prerequisites to take that class, which means that now I am planning to take it in my Senior year. I was unaware of the AP Statistics class as an option for me, and this class is already quite common. So, I am quite sure that there are also other classes that I might be interested in that I am not fully aware of.
Not much, I think that the classes I take are pretty much the lead up of the classes I took last year. but again, I don’t know all the course options so I can’t say that my registration decisions were completely informed.
Maybe they would, because I choose my classes mainly on what my friends are choosing and what the typically student would be taking in that grade, but never focused really on what I would be most interested in.
Yes, I think there is a chance that I would change my course selections if I was aware of all the available classes. HKIS offers so many different classes, sometimes its hard to consider all of my options.
Yes, definitely. Many people know that I have a passion for art, but there are quite a lot of art classes in HKIS and although I’ve heard some remarks about the different courses, I am not fully aware about each and every one.
No, it wouldn’t change.
I think so, I am a science person, and I don’t know much about the classes outside of the science department. I think that if I knew more about the other classes, I’d be able to make better informed decisions.
Maybe. I am more interested in humanities, so I know a lot about the language and history classes, but I don’t know much about the other subjects. However, in order to stay a balanced student, I think it’s important to take classes from all different subjects, and I think that my choices may be changed if I had knew more about all the available classes.
Yes, I think that would change my course selections. I am an athlete so I miss school quite often; it would be nice to know which courses would be best suited for me personally and my schedule.
Probably yes. I quite like science but because there are so many options I feel like I never really get to understand all my choices before choosing courses for next year.
Yes, I think that as a freshmen there are many classes I don’t know about. I only know about the classes open to freshmen this year, but not much about the classes taken later on in high school. If I knew more about it, perhaps I could plan out my classes better, and change my selections for this year.
Yes. For instance, I have not fulfilled my art credit yet, and will have to fulfil it in the upcoming two years. But, even though I am a sophomore now, I still am unaware about all the art courses available (all I know is 2D, 3D, photography?).
Perhaps they would have. I am a senior now, but back then I mainly chose classes based on what my friends were taking, and didn’t focus much all the other options. I think that if I had been more informed about the other classes, I would have made better decisions and chose what was truly suitable for me instead of following the masses.
Yes, I don’t think I know all the courses well enough to make selections that I actually want in my schedule.
maybe for example if i didn’t know about Dr. Schmidts service class before regestration this year i may not have picked it
Yes, there are so many AP classes, online classes, summer classes that I don’t think I am fully aware of and that I might take if I was aware of them
I think it would, especially since I am a transfer student this year, and I don’t know that much about the course options at HKIS. When I chose my classes, I just chose what I think would be the next step from the classes I took in my old school. However, I wasn’t that aware of all the elective options.
No because there’s a reason as to why I’m not familiar with it: I don’t care about it.

4th question (also too many responses for screenshots): What do you consider when you chose your classes for this year? I have inserted 5 responses that represent the survey reponses (total 20 responses, but I don’t want this post to be extra long!)

I considered the homework load and the difficulty of the class. I also checked if it would enable me to meet all the graduation requirements. I think whether or not I’m interested in the class is also very important.
I consider whether it is something I am interested in, or something that I am thinking about pursuing in the future. I also think about whether or not it is something that I need to improve in, or a subject that I am not experienced in.
I just ask people who have taken the courses previously and find out what their opinion is on it, other than that I just choose whatever I feel suits my schedule and future.
I consider my extra curricular activities, and whether or not I would be very busy on other things. I try to balance my academics and other things, so I make sure I can handle the work load of all my classes. I also considered a lot on what my friends are taking, which wasn’t the wisest decision.
As I said, I was new this year, so I just chose the ones that seem to follow the courses I took previously. I thought about what I was interested in, and chose classes based on that too.

5th question: Do you think it would be useful to have a survey designed to find courses that are most suited for your interest and passions? Please explain. ( I selected 5 responses again, but most of them are pretty similar)

I think that a survey would be nice. In the past I’ve only went to talk to my counsellors whenever I have questions about courses, but often they don’t know the specifics of every course, so it’d be really nice if we can find the answers to many of the questions from respectable teachers
Yes, I think that would be a pretty cool idea if a quiz could tell me potential classes because a lot of the times, as I mentioned before, many students including I may be unfamiliar with certain courses that could be well suited for us.
I think that would be great, because as a science person, it would be great if the survey had actual information given by science teachers, and I would be able to see what kind of students they felt are best suited for the class, and what they expect in the class.
A survey would be nice, because I don’t really know what classes are available. Since I choose courses mainly on personal interests, I think it would be great if the survey narrowed down the list of classes and gave me the ones I’d be interested in so I can do more research on them. It would make things easier.
Yes, I think so. I think it would truly pinpoint the classes best suited for each student, and that would be a great area for them to start exploring with, instead of just being overwhelmed by all the options, and ending up doing the typical classes.

Screen Shot 2017-05-21 at 9.16.20 PM

 

Final Question: For people who chose 5 or less for the previous question, what is the reason why you don’t refer to it very often?

 

I don’t find it very useful, but I sometimes refer to it to see the rated work load of a class.
I don’t really look at it, because I don’t think it answers the questions I have about the courses I don’t know about.

 

it is hard to use, and scrolling through is really difficult. It also doesn’t really tell me that much about what type of students would be interested in the class and it doesn’t recommend classes to take after that.
I feel as though outside information is better and the descriptions of the courses aren’t very specific. It’s also very long and a bit difficult to find what your looking for.
Because I’m too lazy to. And also because it doesn’t really help in the sense that all the descriptions are promoting the course so it’s not very reliable to make a choice based on biased blurbs.

Link to all responses: https://docs.google.com/a/hkis.edu.hk/forms/d/1C_IijB1Lw58gbNlNHgKmoNGCMT19APn8poVuj29oJ7M/edit#responses

I think that the general feeling towards our survey idea is quite positive as many people are unfamiliar with certain classes in different departments, and I think from here, we can start going with this idea and brainstorm ways to actually create a program that would provide this service for HKIS students!

Finally, here is our Design thinking statement:

Our HKIS students are having difficulty choosing the right courses for themselves, so we are creating a quiz to help narrow down their options because this would make their course selection process easier.

 

MAY 23:

In the last class, Chloe and I decided that in order for us to make a successful survey, we would have to interview teachers for each respective classes to find out more in-depth details about them. From our survey, we could clearly see that a lot of the students did not use the student handbook because it was long to scroll through and the information given is often very general and vague. We decided that by talking to teachers, we could create a survey that would give accurate results of what classes the user should take. We generated a list of questions and went to the math department during class to interview Mr. Hamilton and Mr. Mccaughey. Our list of questions included (but during the interviews some questions lead to new questions):

  1. What are common characteristics of students who take your class?
  2. What personality leads to excellence in the class?
  3. How would you describe this class?
  4. What makes this class different from all the other classes?
  5. What do students generally take after completing this class?
  6. What do students take away from this class?
  7. What are some of the things students enjoy about this class?
  8. How heavy is the workload, and what do they mainly consist of?

Here is what we found out about several courses so far:

AP Capstone (Taught by Mr. Mccaughey):

-What is the point: To make a better writer out of you

-IB program: Centered around one course, which is theory of knowledge course; the AP shifts towards the model: centered around AP Capstone Seminar and Research

-Seminar: teaches about argumentation, persuasive about a particular issue, analyze, put forth own arguments, tackle issues  all about writing

-Research: produce research paper, continuation of AP seminar, whole year doing one project/product

-Students do not usually take both, but purpose is that vast majority move from seminar to research—but not the case in HKIS

-Many of our strongest students have not figured out the benefits of this yet; the one thing you’re gonna need in college is what you learn in this class

Honors Geometry (Taught by Mr. Hamilton):

-A group of very hard working students, students who would have been historically successful in algebra

-Connections to algebra

-Much more spatial in nature, proof based, paced fairly quickly

-Content itself would be good fit for students who are intrinsically quite interested in math

-Geometry:blends itself to a more problem solving nature—>often seen in contest math

-Hope that students take that away from the class

-Workload: Assigning work not as a requirement but as a reflective piece: listen some problems, if you feel comfortable, that’s great. If not, do more than assigned  20-30 minutes for a block

-There are certainly students who take no time and some who took hours in

-Larger range than other classes

-Self motivated learning is important to succeed in this class

AP Stats (Taught by Mr. Hamilton):

-Seniors mostly, several Juniors, typically students who are good at Math

-Components to being successfully: generally pretty small, AP Calc, Statistics generally atypical to that class, marketed towards students who aren’t traditionally “mathy” students

-Mostly analytical, focuses on ability to write, read interpretively–comfortable with language, generally passionate about social sciences, revolves around experimental design, not necessarily pure math

-Humanities had a baby with Mathematics, 75% is mathematical and theoretical, but a lot of it ties back to “what does this tell us? What does it mean?” drawing conclusions, everything looks back to context—different to traditional math class

-Enjoy: Different kind of math class, fundamentally tied to world

-We don’t have a lot of class options. If you’re passionate about Science, you could take Astronomy, Biology, Chem, Physics. But, for Math, its sequential, but once you get to the top, your options are limited–AP Stats and AP Calculus

-Blend itself to Computer Science as well, Certainly very important in the real world

AP Stats vs Regular Stats: Regular Stats is a semester, cover mostly what AP Stats cover in first semester, cover it in different pacing and in a more project-based format

-Non AP Course would be more real world relevant: more project centric way. Relevance of content stays the same

Workload: Students are given responsibility, not HW. Some students do readings, sample FRQs, on average 20-40 mins per block (reflection prep)

Advanced Mathematical Topics (Taught by Mr. Hamilton):

-It’s very different because it is not linear, no starting point or ending point (unlike other classes)

-If you imagine math as a treat, and each branch is a topic (Geometry, ALgebra etc) and they’re interconnected, ATM is like we take a short walk down as many branches as we can

-Unit on discrete math, non euclidean geometry etc

-Different way of teaching that class

-Treated more like modules, could be experienced in a new order with different levels of knowledge

-Introduction of college math—quite a slow paced class, pace according to class

-Other classes like AP Calc–have a limited time to cover a topic

-Flexible curriculum that follows the needs of the students

-Prerequisites: Finish AP Calc BC

-Students are very passionate about math, most dedicated if you want to go to math major

-AP Stats: if your field was or wasn’t math

-Workload: mostly entirely done in class

Semester project: required them to teach a class day: outside of class time needed

-Maybe 20 mins of work due tomorrow—abnormal (0-20 mins)

-Comfortable with topics coming in

EG: Discrete math, already

-Know that if you want to take the class and you have historically struggled in math, you might have to do more work to keep in pace with class

Summatives: 3 tests so far: Rest are projects and presentations: website, large scale presentation, two or three reflections

After Chloe and I had Humanities class, we also interviwed Mrs. Moreno, and she was able to give us some insight about different Humanitiies courses that she is currently teaching. Here is the informaiton that we obtained:

Hum 2

-Curiosity, willingness to go beyond to what is going on in class

-Interest in the world, interest in literature

-Every year, although the themes are the same, the topics are different

-Flexible curriculum, articles are different because revolves around CE

-Taking away: better understanding of what makes America the country and culture that it is today

-The great things, and the flaws and issues

-Enjoy: it’s never the same, always flexible, always different

-Interest in CE

-Look at things in a wide angle lens

 

Junior English

-Difference to Hums: just English credit

-Many people take Junior English: more because they want to take other courses like econ, works with their schedule

-Don’t delve into culture or history much

-Start with questions about ‘is knowing more better’, look at questions people ask throughout time, thinking about how this is relevant or why it is still a question people still ask

EG: -Satire—role of satire in the society

-Willing to take risk, to talk about what they’re reading—more interpretation

-Telephoto lens—more specific, need to be willing to think about different interpretations

-Need to be able to look critically at each issue, able to formulate opinion, different perspective, applies for different students not only strong English students

-Workload: probably around the same as Humanities 2: around 30 minutes, not too heavy

 

AP Lang:

-Only nonfiction

-Essays, memoirs, graphic novels

-Added to give kids more choices

 

As you can probably tell, we were able to obtain quite in-depth and detailed information from our teachers on that day. However, Chloe and I decided that there might be too many courses in HKIS for us to get such information for each course. We are currently deciding whether or not we should narrow down our choices (EG: only math department/only hum department) and create a prototype so our project is not such on a large scale.

Makey Makey with Balance Board Challenge (S)

Scratch Program: 

This is my program (it is a screenshot because our program was typed onto Chloe’s computer). There is also a picture of the cartoon that we created.

 unnamed-2 unnamed-1-1

I’m so sorry for the screenshot not being in its best quality. There will be a better quality during the video! Here, I will talk about our program and a general idea of how it worked. If you want to listen to it, please refer to the video! So, first of all, the first line indicates that when the Green Flag is clicked, the program initiates. The first thing that happens is the program asks what the user name is, and then adds the input to the high score-the leaderboard. Then, we have an introduction that explains the game to the user, with a 2 second pause between each line to make it easier to read. Then, we move into a different group of functions. We set the space bar to start this function. When the space bar is pressed, the scratch program tells the user to “Get on”, and the timer is set to 0. Then, we have a loop next. Since we placed aluminium foil on either side of the balance board that connects to up and down arrow for either side, we made the program to start the timer when neither is pressed-because that means the balance board is not touching either side of the ground. The timer works by changing the record by 0.1 seconds for every 0.1 second time frame. This itself is a loop, until either up or down key is pressed, because that means the user has fell off the balance board. One mistake that we made along the way was placing this if statement outside, which caused the program not to work properly because the timer has to start before it can stop. Once the user has fallen down, the time is added to the leaderboard, and the timer is set to 0 again. Then, the program asks whether the user wants to play it again. If the answer is yes, then we tell the use to click the flag to start again and essentially restart the program. We had a lot of trouble with this part, because we weren’t sure how to use the scratch program to make it go back to a function, so although this solution is kind of a partial one and requires the user to manually start again, we were still happy with it because it worked. And obviously, if the user’s input is no, then the program would just stop.

Here are some challenges that we faced, and how we overcame them:

Item to be Tested Expected outcome Actual Outcome Fixed Y/N How did I fix error? Date fixed
Timer Stopping the timer when aluminum foil was touched Came out weirdly, timer was not going up and stopping properly Y The if loop for stopping the timer had to be within the loop that started the timer, so that it would only enact after the timer had started! April 27 
Timer reset Timer would reset to 0 after one game was finished Did not do that Y Added the function “set timer to 0” after a fame was finished April 27
Play again function Ask whether the user wants to play again Could not figure out how to do so Y This was a partial solution, where we asked the user first a yes or no (whether they wanted or did not want to play again). If they answered no, the program would just stop. If they answered yes, we would tell them to click the flag to start again. However, this is a partial solution because they have to manually start it again, but it works! April 27

Here is the video that explains everything as well as showing a quick runthrough of our program:

 

Here are some references that we used that helped our program to be successful and definetely helped us make our job easier!:

1. http://www.instructables.com/id/How-to-use-Scratch/

2. https://scratch.mit.edu/help/videos/

3. https://scratch.mit.edu/discuss/topic/45568/

 

Pygame:

This is our program:

import pygame
BLACK=(0,0,0)
WHITE=(255,255,255)
RED=(255,0,0)
GREEN=(0,170,0)
LIGHTGREEN=(0,255,0)
BLUE=(0,0,255)
pygame.init()
size=[1024,768]
screen=pygame.display.set_mode(size)
font=pygame.font.SysFont(None,50)
font1=pygame.font.SysFont(None,20)

done=False   #Loop until the user clicks the close button
clock=pygame.time.Clock()   #Used to manage how fast the screen updates
lock=pygame.time.Clock()
frame_count=0
frame_rate=30
start_time=0
pygame.display.set_caption("My Game")
recordedTime=[]


while not done:
    screen.fill(WHITE)
    person = pygame.image.load('Board.png')
    screen.blit(person,(200,200))
    total_seconds=frame_count//frame_rate
    minutes=total_seconds//60
seconds=total_seconds%60
output_string="Time: {0:02}:{1:02}".format(minutes,seconds)
    welcome_msg="""Welcome to the Balance Board timer!"""
username=""
text=font1.render(output_string, True, BLACK)
    text1=font.render(welcome_msg,True,RED)

    #usertime=font.render(usertime,True,BLACK)
screen.blit(text1,[150,100])
    #screen.blit(usertime,[300,300])
screen.blit(text, [250,250])
    for event in pygame.event.get():
        if event.type==pygame.KEYDOWN:
            if event.key==pygame.K_SPACE:
                total_seconds=frame_count//frame_rate
                recordedTime.append(total_seconds)
    if len(recordedTime)>0:
        rTimeYCoordinate=200
for rtime in recordedTime:
            text2=font.render("You stayed on the board for:" +str(rtime) +"seconds", True, BLACK)
            screen.blit(text2,[200,200])
            break
#rTimeYCoordinate += 20
            #pygame.draw.rect(screen,GREEN,[100,100,100,50])
            #button=pygame.draw.Rect(25,25,25,25, True, LIGHTGREEN)
            #mouse_pos=pygame.mouse.get_pos()
            #if button.collidepoint(mouse_pos):
                #pygame.quit()
frame_count+=1
clock.tick(frame_rate)
    pygame.display.flip()
pygame.quit()

 

Once again, here, I will explain our code. If you would like to listen to it instead, please refer to the video embedded below.  I would just like to say that this program is in no way perfect. I am still missing a leaderboard, and a start again. However, I am honestly quite proud of my process. After missing a week of school, it was honestly a little bit hard to catch up and to grasp the idea of Pygame. I feel like I definitely learnt a lot through the process, and although I have not fully figured everything out, I believe that the end product is something that I am proud of and something that I can continue working on when I have time to complete it.  So, first of all, I typed import pygame to initiate the pygame. Then, I defined some colors,, using the Pygame RYB color scale. Then, I initiated pygame and set the screen size to be 1024 by 768. I also set two fonts, a bigger one and a smaller one. Then, there is a done=False that would cause the function to loop until the user clicks the close button. Then, I set some basic numbers to define how the seconds would count up and how fast the screen updates. One problem that I encountered was that the seconds were going up two times as slow as they were supposed to be. To fix that, I switched frame_rate=60 to frame_rate=30, which made it go 2 times quicker. This while not done is the main program of this pygame. I started off with making the background of the screen to be white. I also imported a picture of a cartoon on a balance board-the same picture used in the scratch program- and placed that in the screen too using the screen.blit function to make it more interesting. Then, I assigned some variables for the minutes and seconds and assigned to variable output_string to show the minutes and seconds on screen using the leading zeroes. That, alongside the welcome message, is blotted onto the screen in black and red respectively. Then, the code continues to explain what would happen when the spacebar is pressed, and the recorded Time would be appended and printed onto the screen. Here is where things got tacky for us. When the spacebar was pressed, it would correctly say how many seconds the person was on the balance board for. However, the function and the timer would not stop and if the spacebar is pressed again, the amount of seconds would be printed on top of what was already printed, creating an overlapping situation. I spent around an hour at home trying to find solutions to this, and was only able to settle upon a partial solution where I write break afterwards. This did not solve everything because although this prevented the overlapping situation, it did not stop the timer. The lines in hashtag here were my attempts to create a button that would ask the user whether they wanted to play again. This, unfortunately, I was unable to do after around 2 hours of research and referencing to various sources, and I concluded that I simply am not at that ability yet-which is perfectly fine because I learnt a lot through the process.  Then, I just have a little more code at the end to limit frames per second, and would also update the screen. At the end, there is a quit function so that the program will not hang upon exit. So, although this function did not do all the things I want it to do, it does work for a very basic balance board game! Please refer to the video for a runthrough of the program!!

Here are some challenges that we faced, and how we overcame them:

Item to be Tested Expected outcome Actual Outcome Fixed Y/N How did I fix error? Date fixed
Timer Seconds go up accurately Went up twice as slow Y Switched frame_rate=60 to frame_rate=30, which made it go 2 times quicker May 3
Blitting cartoon Cartoon showing up on top of white background in the pygame Cartoon did not show up, error Y Before importing picture into library, changed file from jpg to .png so that it becomes compatible with pycharm and pygame May 1
After game is finished pt 1 Cannot ‘end’ for a second time. Expected it to essentially ‘pause’ the program once the user has fallen off for the first time. Spacebar could be pressed multiple times, the user could ‘end’ multiple times Y Added ‘break’ so it would not allow the program to ‘end’ it again  May 5
After game is finished pt 2 Expected timer to stop Timer continued to go up N Could not figure this out, unfortunately  NA
Fonts, make the program look better Wanted there to be different sizes of fonts All fonts were the same size when blitted on to the screen Y I set two variables, font1 and font 2 and made font 1 a bigger size and font 2 the smaller size, so that the welcome message would be bigger while the other texts to be smaller  May 5
Button Have a button that would ask whether the user wanted to play again, and if clicked on, would restart the program. Did not work, error N Could not figure this out, unfortunately  NA

References:

Trying to figure out button (learnt a lot even though I did fail in the end):

1.https://www.youtube.com/watch?v=jh_m-Eytq0Q

2.https://www.youtube.com/watch?v=nh34GrYXbn4&t=454s

3. https://www.youtube.com/watch?v=8KB3mTwOFCw&t=5s

4.https://pythonprogramming.net/pygame-buttons-part-1-button-rectangle/

5. http://stackoverflow.com/questions/30744237/how-to-create-a-pause-button-in-pygame

Pygame fonts:

6. http://stackoverflow.com/questions/38001898/what-fonts-can-i-use-with-pygame-font-font

Pygame timer:

7. https://www.pygame.org/docs/ref/time.html

 

Balance Board findings so far

As I missed quite a lot of classes due to golf tournaments, to be honest, I was a little overwhelmed in the start of the class, as I was completely new to the scratch and makey makey programs. However, with the support of Chloe and Denise, I was able to grasp the idea of how these programs worked. See below for a picture of me trying makey makey for the first time! 🙂

8A6DAE45-C5B9-4F61-BC15-07D6029E7A9E

Chloe, Denise, and I worked together to figure out how to program the Balance Board on Scratch. Here are some screenshots of the program, as the program was on Chloe’s computer:

unnamed-1unnamed-2

During the class, everything went really smooth, but we did have a little trouble making the timer work properly. We had a tiny error, as we put parts of it outside of a loop so the timer did not continuously go up. However, other than that, everything else went okay and we figured it out together. We connected the makey makey on the aluminum foil on both sides of the balance board so that whenever the user stopped, the makey makey would send a signal to the computer that the user has stopped-and the timer would stop as well (also recording it on the scoreboard). Next class, we are planning on working on the pygame code!

I2P Quiz

 

I2P Quiz Blog Post

I am so sorry that this is so late due to some golf tournaments that caused me to miss the quiz!!

Before starting to program the quiz, I decided to do a flow chart, as seen directly below. Although this flowchart is really simple and shows only the minimum functions that I was going to include, it provided a useful, clear, and basic roadmap for me.

 2D35D009-9437-4B67-A711-D2553FA4C4E2

At the end, when I actually did my program, of course I tweaked certain things and added things such as ascii art and a function for the user to see the answers. Below I embedded a video in which I explained all the syntaxes I used, a detailed discussion about my program, as well as a quick runthrough of my program. Under the video, I also talked about the syntaxes in writing, so you could look at either one or both! 🙂 I also included my code below the video!

Explanation of my program in writing:

Here is my python code:

print("\ \      / /__| | ___ ___  _ __ ___   ___| | |\n"
      " \ \ /\ / / _ \ |/ __/ _ \| '_ ` _ \ / _ \ | |\n"
      "  \ V  V /  __/ | (_| (_) | | | | | |  __/_|_|\n"
      "   \_/\_/ \___|_|\___\___/|_| |_| |_|\___(_|_)\n")
import datetime   # for the scoreboard
today = datetime.date.today()


def introduction():
    global v_name
    #global wronganswers
wronganswers=0
v_name=input("What is your name?  ")
    print("Hello",v_name,", Welcome to the General Knowledge Quiz\n"
                         "The rules are very simple: You advance through the quiz; try to get very little answers wrong!\n"
                         "By the way, enter the letters (a or b or c or d) to input your answer ")
    question1(wronganswers)


def question1(wronganswers):
    while True:
        #wronganswers=0
answer1=input("\n1. Entomology is the science that studies:\n"
                  "a  Behavior of Human Beings\n"
                  "b  Insects\n"
                  "c  The origin and history of technical and scientific terms\n"
                  "d  The formation of rocks\n"
                      "Your answer:")
        if answer1 in {"a","c","d"}:
            wronganswers+=1    # if its wrong answer, add to wrong answer
print("Wrong. So far you have",int(wronganswers), "answer wrong")  # telling the user how many answers they have wrong so far
question2(wronganswers)
        elif answer1=="b":
            wronganswers+=0
print("Correct! So far you have",int(wronganswers), "answers wrong")
            question2(wronganswers)
        else:
            print("Please enter valid input. Only enter the letter of your answer")


def question2(wronganswers):
    while True:
        answer2=input("\n2. FFC stands for: \n"
                  "a  Foreign Finance Corporation\n"
                  "b  Federation of Football Council\n"
                  "c  Film Finance Corporation\n"
                  "d  None of the above\n"
                      "Your answer:")
        if answer2 in {"a","b","d"}:
            wronganswers+=1
print("Wrong. So far you have",int(wronganswers), "answers wrong")
            question3(wronganswers)
        elif answer2=="c":
            wronganswers+=0
print("Correct! So far you have",int(wronganswers), "answers wrong")
            question3(wronganswers)
        else:
            print("Please enter valid input. Only enter the letter of your answer.")


def question3(wronganswers):
    while True:
        answer3=input("\n3. Galileo was an Italian astronomer who:\n"
                      "a  developed the telescope\n"
                      "b  discovered four satellites of Jupiter\n"
                      "c  discovered that the movement of pendulum produces a regular time measurement\n"
                      "d  All of the above\n"
                      "Your answer:")
        if answer3 in {"a","b","c"}:
            wronganswers+=1
print("Wrong. So far you have",int(wronganswers), "answers wrong")
            question4(wronganswers)
        elif answer3=="d":
            wronganswers+=0
print("Correct! So far you have",int(wronganswers), "answers wrong")
            question4(wronganswers)
        else:
            print("Please enter valid input. Only enter the letter of your answer.")


def question4(wronganswers):
    while True:
        answer4=input("\n4. Exposure to sunlight helps a person improve his health because\n"
                      "a  the infrared light kills bacteria in the body\n"
                      "b  resistance power increases\n"
                      "c  the pigment cells in the skin get stimulated and produce a healthy tan\n"
                      "d  the ultraviolet rays convert skin oil into Vitamin D\n"
                      "Your answer:")
        if answer4 in {"a","b","c"}:
            wronganswers+=1
print("Wrong. So far you have",int(wronganswers), "answers wrong")
            question5(wronganswers)
        elif answer4=="d":
            wronganswers+=0
print("Correct! So far you have",int(wronganswers), "answers wrong")
            question5(wronganswers)
        else:
            print("Please enter valid input. Only enter the letter of your answer.")


def question5(wronganswers):
    while True:
        answer5=input("\n5. Golf player Vijay Singh belongs to which country?\n"
                      "a  USA\n"
                      "b  Fiji\n"
                      "c  India\n"
                      "d  UK\n"
                      "Your answer:")
        if answer5 in {"a","c","d"}:
            wronganswers+=1
print("Wrong. So far you have",int(wronganswers), "answers wrong")
            question6(wronganswers)
        elif answer5=="b":
            wronganswers+=0
print("Correct! So far you have",int(wronganswers), "answers wrong")
            question6(wronganswers)
        else:
            print("Please enter valid input. Only enter the letter of your answer")


def question6(wronganswers):
    while True:
        answer6=input("\n6. First Afghan War took place in\n"
                      "a  1839\n"
                      "b  1843\n"
                      "c  1833\n"
                      "d  1849\n"
                      "Your answer:")
        if answer6 in {"b","c","d"}:
            wronganswers+=1
print("Wrong. So far you have",int(wronganswers), "answers wrong")
            question7(wronganswers)
        elif answer6=="a":
            wronganswers+=0
print("Correct! So far you have",int(wronganswers), "answers wrong")
            question7(wronganswers)
        else:
            print("Please enter valid input. Only enter the letter of your answer")


def question7(wronganswers):
    while True:
        answer7=input("\n7. For the Olympics and World Tournaments, the dimensions of basketball court are\n"
                      "a  26 m x 14 m\n"
                      "b  28 m x 15 m\n"
                      "c  28 m x 16 m\n"
                      "d  27 m x 16 m\n"
                      "Your answer:")
        if answer7 in {"a","c","d"}:
            wronganswers+=1
print("Wrong. So far you have",int(wronganswers), "answers wrong")
            question8(wronganswers)
        elif answer7=="b":
            wronganswers+=0
print("Correct! So far you have",int(wronganswers), "answers wrong")
            question8(wronganswers)
        else:
            print("Please enter valid input. Only enter the letter of your answer")


def question8(wronganswers):
    while True:
        answer8=input("\n8. Friction can be reduced by changing from:\n"
                      "a  Sliding to rolling\n"
                      "b  Rolling to sliding\n"
                      "c  Potential energy to Kinetic energy\n"
                      "d  Dynamic to static\n"
                      "Your answer:")
        if answer8 in {"b","c","d"}:
            wronganswers+=1
print("Wrong. So far you have",int(wronganswers), "answers wrong")
            question9(wronganswers)
        elif answer8=="a":
            wronganswers+=0
print("Correct! So far you have",int(wronganswers), "answers wrong")
            question9(wronganswers)
        else:
            print("Please enter valid input. Only enter the letter of your answer")


def question9(wronganswers):
    while True:
        answer9=input("\n9. Fire temple is the place of worship of which of the following religion?\n"
                      "a  Toaism\n"
                      "b  Judaism\n"
                      "c  Zoroastrianism (Parsi Religion)\n"
                      "d  Shintoism\n"
                      "Your answer:")
        if answer9 in {"b","a","d"}:
            wronganswers+=1
print("Wrong. So far you have",int(wronganswers), "answers wrong")
            question10(wronganswers)
        elif answer9=="c":
            wronganswers+=0
print("Correct! So far you have",int(wronganswers), "answers wrong")
            question10(wronganswers)
        else:
            print("Please enter valid input. Only enter the letter of your answer")


def question10(wronganswers):
    while True:
        answer10=input("\n10. (Last Question!) Ecology deals with: \n"
                       "a  Birds\n"
                       "b  Cell Formation\n"
                       "c  Relation between organisms and their environment\n"
                       "d  Tissues\n"
                       "Your answer:")
        if answer10 in {"b","a","d"}:
            wronganswers+=1
print("Wrong.")
            end(wronganswers)
        elif answer10=="c":
            print("Correct!")
            wronganswers+=0
end(wronganswers)
        else:
            print("Please enter valid input. Only enter the letter of your answer")


def end(wronganswers):
    print("Congratulations! You have completed the game. You had a total of", str(wronganswers), "wrong answers")
    text_file = open("General Knowledge Quiz Scoreboard.txt", "a")
    text_file.writelines("Name:" + v_name + " Date played: "+ str(today)+ "  " + str(wronganswers)+ " wrong answers" +"\n")
    text_file.close()
    while True:
        again=input("Thank you for playing this game. Would you like to try again and try to do better? Please type y for yes or n for no")
        if again not in {"y","n"}:
            print("Please enter valid input")
        elif again =="y":
            return introduction()
        elif again =="n":
            while True:
                answers=input("Would you like to see the answers? Please type y for yes and n for no")
                if answers=="n":
                    print("★─▄█▀▀║░▄█▀▄║▄█▀▄║██▀▄║─★\n"
                          "★─██║▀█║██║█║██║█║██║█║─★\n"
                          "★─▀███▀║▀██▀║▀██▀║███▀║─★\n"
                          "★───────────────────────★\n"
                          "★───▐█▀▄─ ▀▄─▄▀ █▀▀──█───★\n"
                          "★───▐█▀▀▄ ──█── █▀▀──▀───★\n"
                          "★───▐█▄▄▀ ──▀── ▀▀▀──▄───★\n")
                    quit()
                elif answers=="y":
                    seeanswers()
                else:
                    print("Please enter valid input.")


def seeanswers():
    print("\nCorrect Answers:\n"
          "1. Entomology is the science that studies: b  Insects\n"
          "2. FFC stands for: c  Film Finance Corporation\n"
          "3. Galileo was an Italian astronomer who: d  All of the above\n"
          "4. Exposure to sunlight helps a person improve his health because: d  the ultraviolet rays convert skin oil into Vitamin D\n"
          "5. Golf player Vijay Singh belongs to which country? b  Fiji\n"
          "6. First Afghan War took place in:  a  1839\n"
          "7. For the Olympics and World Tournaments, the dimensions of basketball court are: b  28 m x 15 m\n"
          "8. Friction can be reduced by changing from: a  Sliding to rolling\n"
          "9. Fire temple is the place of worship of which of the following religion? c  Zoroastrianism (Parsi Religion)\n"
          "10. Ecology deals with: c  Relation between organisms and their environment\n ")

    print("★─▄█▀▀║░▄█▀▄║▄█▀▄║██▀▄║─★\n"
          "★─██║▀█║██║█║██║█║██║█║─★\n"
          "★─▀███▀║▀██▀║▀██▀║███▀║─★\n"
          "★───────────────────────★\n"
          "★───▐█▀▄─ ▀▄─▄▀ █▀▀──█───★\n"
          "★───▐█▀▀▄ ──█── █▀▀──▀───★\n"
          "★───▐█▄▄▀ ──▀── ▀▀▀──▄───★\n")
    exit()


introduction()    #starting the introduction and then it will go through the game by itself

In the very beginning, I used Ascii art to print Welcome—and I found this asci art on a website which turns any phrase or word into Ascii art. After that, I imported datetime, and defined the variable today. This will be used later on for recording the dates the players tried to quiz for the scoreboard. My code basically consists of function definitions for the introduction, each of the 10 questions, and the final ending. At the end, I start the introduction, and the game runs because each function leads to the next. In the function introduction, I asked the user to input their name, and explained how the game works. I set the input of their name as vname and made it global because there will be a reappearance of this variable for the scoreboard. At the end of this function, I tell the computer to go to question 1. In the function question 1, I actually referenced the variable wronganswers from introduction, which was set to 0. This reference is repeated for all of the questions, and each time the wrong answers would be cumulative. I initially used the global syntax, but unfortunately that did not work—there are more specifics in the Testing Document attached. Continuing on with this function, I then proceed to ask the user to input their answer for the question. If their answer is the wrong answer, in this case, a,c, or d, then the amount of wronganswers increases by 1, and the computer prints how many wrong answers the user has so far. If it is right, in this case choice b, the amount of wrong answers does not increase. Either way, the function continues on to question 2. However, I put this in a while loop because if the user inputs an invalid input, the computer would tell the user to print the answer again, and this function repeats again to ask the question again. This function basically repeats 10 more times for each question, with the wronganswers being referenced each time. After the tenth answer, the computer proceeds to the function end. It starts with telling the user how many total wrong answers they had. Then, the score is recorded in a text file with the person’s name, date, and amount of wrong answers. This is why the person’s name had to be a global function and also why I imported datetime in the beginning. After that, there is another while loop, asking the user whether or not they want to play again. If they enter yes, they would return to the function introduction, which would essentially reboot the entire program. If they answer no, there would be another while loop asking whether or not they would want to see the answers, which if they did, would lead to another function that displays all the answers. Either way, the program ends with another asci art saying Goodbye.

Here is a simple table that showed some of my obstacles that I fixed, as well as how I fixed them:

Item to be Tested Expected outcome Actual Outcome Fixed Y/N How did I fix error? Date fixed
global wronganswers As I used the variable wronganswers in multiple function definitions, this item should have supposedly allowed me to reference this variable in multiple areas. The expected outcome didn’t work, because the variable wronganswers changed every time it went to a different function as the number of wronganswers kept adding up. Y Instead of using the global function, what I did was reference the variable in each definition. In the introduction, I assigned wronganswers to be 0, and every time the program was entered into a new definition, this variable would be referenced and the number assigned to it would be remembered. For example, if the user had 4 wrong answers after question 4, I would make the program go into question 5 by saying question5(wronganswers), meaning it would remember that the number 4 is assigned to this variable and continue counting from 4. 23/4
Invalid inputs (not a/b/c/d for answer choices) If the user accidently answered with an invalid input (not a/b/c/d), the program would ask the user to reenter the value. The program would end without asking the user to reenter their input. I told the computer what would happen if the inputs were a/b/c/d (either add or don’t add to wronganswers, and move on to the next question), and even though I told the computer to print “Please enter valid input” if the user entered an invalid input, the program would end there and would not loop back to the question. Y I put my if/elif/else statements into a while loop. This way, if the inputs are valid, the answer would be recorded and the player would move on to the next question. If the input was invalid, the computer would print “Please enter valid input” and this question would be asked again until the user enters a valid input to continue with the quiz! 23/4
Making the program look pretty I wanted there to be spaces between questions to make the program look prettier and not as cluttered. Program was VERY cluttered Y Added the syntax \n when I wanted some space in between lines. 23/4
ASCII Art I wanted to program to print out GoodBye in Ascii art when it was the right time There was an error, saying “IndentationError: unindent does not match any outer indentation level”. Y This was a silly mistake, but it took me a while before I caught it. I simply had an extra space in front of print, causing the indentation to be weird. 23/4

 

Here are some references that I used for this programme:

1. Website I used for ascii art, turning phrases into ascii art: http://patorjk.com/software/taag/#p=display&f=Graffiti&t=Type%20Something%20

2. Website where I found the general knowledge quiz questions for my program: http://www.indiabix.com/general-knowledge/basic-general-knowledge/

3. How I learnt how to reference variables in different functions: http://stackoverflow.com/questions/27993832/in-python-how-do-i-reference-a-variable-that-was-defined-in-a-function-object-f

Everything else I basically used my previous knowledge! 🙂

Lesson 7 and 8

Lesson 7:

In this lesson, I learned the difference between a (,) list and a [,] list. (,) lists are for immutable objects, they cannot remove elements, and they can respond to * and + (repetition and concatenation). On the other hand,[,] lists are for mutable objects, and they can slice, index, append, delete. This class was focused on using these lists for different functions, including sorting, counting, extending, removing, reversing, calculating lengths etc (see below).

#Challenge 1: Create a fruit list with apple, orange, banana, grape, tomato, mango, print first item on the list, print second to last item
Fruits=["apple","orange","banana","grape","tomato","mango"]
print(Fruits[0])
print(Fruits[4])
##OR
print(Fruits[-2])  #Computer counts for user


#Challenge 2: From a number list 1-3, concatenate 2 numbers together, print this concatenation
NumList1=[1,2,3]
NumList2=[2,3,4]
NumList3=NumList1+NumList2
print(NumList3)

#Multiplication
numberlist=[1,2,3]
print(numberlist*3)

#Slicing
fruitlist=["apple","orange","banana","grape","tomato","mango"]
print(fruitlist[2:5])
print(fruitlist[:4])
print(fruitlist[5:])

#Editing a list: change values in a list
fruitlist=["apple","orange","banana","grape","tomato","mango"]
fruitlist[1]="kiwi"
print(fruitlist)

#List of lists
olympicList=[["London",2012],["Beijing",2008],["Athens",2004]]
print(olympicList)
print(olympicList[1])#print the first element in the list
print(olympicList[1][0])#print the second element in the list's first part

#Append
inventoryList=["sword","armour","shield","healing potion"]
print(inventoryList)
inventoryList.append("cabbage")
print(inventoryList)
#Insert()
inventoryList=["sword","armour","shield","healing potion"]
print(inventoryList)
inventoryList.insert(2,"cabbage")
print(inventoryList)

#Sort
inventoryList=["sword","armour","shield","healing potion"]
print(inventoryList)
inventoryList.sort()
print(inventoryList)

#List.count()
inventoryList=["sword","armour","shield","healing potion","sword"]
print(inventoryList)
print(inventoryList.count("sword"))

#List.extend()
inventoryList=["sword","armour","shield","healing potion","sword"]
fruitlist=["apple","orange","mango"]
print(inventoryList)
print(fruitlist)
inventoryList.extend(fruitlist)
print(inventoryList)
print(fruitlist)

#List.pop()
fruitlist=["apple","orange","mango"]
print(fruitlist)
v_fruit=fruitlist.pop()
print(fruitlist)
print(v_fruit)
v_fruit=fruitlist.pop(0)
print(fruitlist)
print(v_fruit)

#List.remove()
fruitlist=["apple","orange","mango"]
print(fruitlist)
fruitlist.remove("orange")   #remove first occurance of an element
print(fruitlist)

#List.reverse()
fruitlist=["apple","orange","mango"]
print(fruitlist)
fruitlist.reverse()
print(fruitlist)

#List.index()
fruitlist=["apple","orange","mango"]
print(fruitlist)
v_index=fruitlist.index("orange")    #position of banana in the list
print(v_index)

#Length
fruitlist=["apple","orange","mango"]
print(fruitlist)
print(len(fruitlist))

#in---either True or False
fruitlist=["apple","orange","mango"]
print("apple"in fruitlist)

#min and max---characters
fruitlist=["apple","orange","mango"]
print(fruitlist)
print(min(fruitlist))
print(max(fruitlist))

Lesson 8:

In this lesson, I learned how to input values in a string and also how strings should be formatted for the computer to consider a specific amount of characters and round to a certain amount of decimals. See below for the work I did.

brand="Apple"
exchangeRate=1.2886
message='The price of this %s laptop is %d USD and the exchange rate is %4.2f USD to 10HKD'%(brand,1299,exchangeRate)
print(message)
message1='The price of the laptop is {1:d} USD and the exchange rate is {2:4.2f} USD to 10 HKD'.format('Apple',1299,1.2886)
print(message1)
message3='{0} is easier than {1}'.format('Python','Java')
message4='{1} is easier than {0}'.format('Python','Java')
message5='{:10.2f} and {:d}'.format(1.2886,12)
message6='{}'.format(1.2886)

print(message3)
print(message4)
print(message5)
print(message6)

Adventure Game

Side Note: I am so sorry that this update is so late; I was away for a golf tournament in Thailand and really could not find a time to upload this. Once again, sorry!!

 

Chloe and I intended for this game to be relatively easy to program. We did not want to make a super complicated game, but rather a game with simple yes or no types of questions that would either lead to success or failure. We decided to start off with a fire in a house in the middle of nowhere, and the first question was whether the user wanted to stay or leave. If the user chose to stay, they would die. If they chose to leave, they would then be given a choice to escape to the town or the woods. The story would continue like this and there are only several paths in which the user would succeed. The full program is:

import datetime
today = datetime.date.today()
def home():
    global v_name
    v_name=input("What is your name?")
    print("Hi", v_name, "You live in the middle of nowhere")
    choiceA=input("One day, there is a hugeeee fire in your house. What do you do?"
          "\nOption A: Stay in the house"
          "\nOption B: Leave"
          "\nEnter a for Option A, and b for Option B")
    while True:
        if choiceA=="a":
            print("Sorry, you die")
            text_file = open("Scorekeeping.txt", "a")
            text_file.writelines("Name:" + v_name+ " Date played: "+ str(today)+  "  Fail"+"\n")
            text_file.close()
            again()
            #give them option to go back
elif choiceA=="b":
            exithome()
        else:
            print("Please enter valid input")
            home()
def exithome():
    choiceB=input("Would you like to escape to the woods or the town?"
                  "\nOption A: Woods"
                  "\nOption B: Leave"
                  "\nEnter a for Option A, and b for Option B")
    while True:
        if choiceB=="a":
            woods()
        elif choiceB=="b":
            town()
        else:
            print("Please enter valid input")
            exithome()
def woods():
    choiceC=input("Would you like to hunt or gather?"
                  "\nOption A: Gathering"
                  "\nOption B: Hunting"
                  "\nEnter a for Option A, and b for Option B")
    while True:
        if choiceC=="a":
            gathering()
        elif choiceC=="b":
            weapon()
        else:
            print("Please enter valid input")
            woods()
def gathering():
    choiceD=input("Choose your berry."
                  "\nOption A: holly berry"
                  "\nOption B: marigold berry"
                  "\nEnter a for Option A, and b for Option B")
    while True:
        if choiceD=="a":
            print("You were poisoned by the berry, and died in the woods. Game Over!")
            text_file = open("Scorekeeping.txt", "a")
            text_file.writelines("Name:" + v_name+ " Date played: "+ str(today)+ "  Fail"+"\n")
            text_file.close()
            again()
        elif choiceD=="b":
            print("That is the right berry! You surived the night in the woods, and returned to the town at sunrise.")
            successful()

        else:
            print("Please enter valid input")
            gathering()
def weapon():
    choiceE=input("You need to kill something for food. Choose your weapon"
                  "\nOption A: axe"
                  "\nOption B: slingshot"
                  "\nEnter a for Option A, and b for Option B")
    while True:
        if choiceE=="a":
            print("The axe was too heavy for you and you accidentally cut off your own foot. You bled to death.")
            text_file = open("Scorekeeping.txt", "a")
            text_file.writelines("Name:" + v_name+ " Date played: "+ str(today)+ "  Fail"+"\n")
            text_file.close()
            again()
        elif choiceE=="b":
            print("You chose the right weapon! Go hunting!")
            hunting()
        else:
            print("Please enter valid input")
            weapon()

def hunting():
    choiceF=input("You have your rock. Choose your prey."
                  "\nOption A: Deer"
                  "\nOption B: Bear"
                  "\nEnter a for Option A, and b for Option B")
    while True:
        if choiceF=="a":
            print("You missed your shot, and you were spotted by the deer. You were ran over by the deer's antelers. You died.")
            text_file = open("Scorekeeping.txt", "a")
            text_file.writelines("Name:" + v_name+ " Date played: "+ str(today)+ "  Fail" +"\n")
            text_file.close()
            again()
        elif choiceF=="b":
            print("The bear was the right choice! You shot the bear in the eye with your slingshot and you had a full dinner:)")
            print("YOU SUCCEEDED!")
            successful()
        else:
            print("Please enter valid input")
            hunting()
def town():
    choiceG=input("You have successfully arrived at the town. Choose your shelter"
                  "\nOption A: Street"
                  "\nOption B: Ask an old woman for shelter"
                  "\nEnter a for Option A, and b for Option B")
    while True:
        if choiceG=="a":
            print("The street was the correct choice!")
            job()
        elif choiceG=="b":
            print("Sorry. The old woman is a secret serial killer. You died.")
            text_file = open("Scorekeeping.txt", "a")
            text_file.writelines("Name:" + v_name+ " Date played: "+ str(today)+ "  Fail" +"\n")
            text_file.close()
            again()
def job():
    choiceH=input("You need money. Chooose your job"
                  "\nOption A: baker"
                  "\nOption B: firefighter"
                  "\nEnter a for Option A, and b for Option B")
    while True:
        if choiceH=="a":
            print("That was the right choice! You will open your new bakery tomorrow.")
            ingredients()
        elif choiceH=="b":
            print("That was a very brave choice, but unfortunately died in a fire. But not to fear, you saved the bird:)")
            again()
            text_file = open("Scorekeeping.txt", "a")
            text_file.writelines("Name:" + v_name+ " Date played: "+ str(today)+ "  Fail"+"\n")
            text_file.close()
        else:
            print("Please enter valid input")
            job()
def ingredients():
    choiceI=input("In order to sustain your newly opened bakery, you have to order more ingredients. Do you order baking soda or baking powder?"
                  "\nOption A: baking soda"
                  "\nOption B: baking powder"
                  "\nEnter a for Option A, and b for Option B")
    while True:
        if choiceI=="a":
            print("That is incorrect! Your new batch of bread was unsuccessful. You are broke, and starved to death")
            again()
        elif choiceI=="b":
            print("That is correct! Business is flourishing, and you have successful survived.")
            successful()
        else:
            print("Please enter valid input")
            ingredients()

def again():
    yeet=input("You have died. Would you like to try again? Enter y for yes and n for no")
    text_file = open("Scorekeeping.txt", "a")
    text_file.writelines("Name:" + v_name+ " Date played: "+ str(today)+ "  Fail"+"\n")
    text_file.close()
    while True:
        if yeet=="y":
            home()
        if yeet=="n":
            print("Thanks for playing this game. <3")
            exit()

def successful():
    text_file = open("Scorekeeping.txt", "a")
    text_file.writelines("Name:" + v_name+ " Date played: "+ str(today)+ "  Success"+"\n")
    text_file.close()
    yow=input("You have survived the fire. Would you like to try again? Enter y for yes and n  for no")
    while True:
        if yow=="y":
            home()
        if yow=="n":
            print("Thanks for playing this game. <3")
            exit()

home()


Example of game:

What is your name?Selina
Hi Selina You live in the middle of nowhere
One day, there is a hugeeee fire in your house. What do you do?
Option A: Stay in the house
Option B: Leave
Enter a for Option A, and b for Option Bb
Would you like to escape to the woods or the town?
Option A: Woods
Option B: Leave
Enter a for Option A, and b for Option Ba
Would you like to hunt or gather?
Option A: Gathering
Option B: Hunting
Enter a for Option A, and b for Option Ba
Choose your berry.
Option A: holly berry
Option B: marigold berry
Enter a for Option A, and b for Option Bb
That is the right berry! You surived the night in the woods, and returned to the town at sunrise.
You have survived the fire. Would you like to try again? Enter y for yes and n for no

 

I also decided to add a scorekeeping text file that would track the amount of successes and failures.

Name:Selina Date played: 2017-04-12  Fail
Name:Selina Date played: 2017-04-12  Fail
Name:Selina Date played: 2017-04-12  Fail
Name:Selina Date played: 2017-04-12  Success

I think if we could improve this game, it would be making it more complicated, like maybe have specific things the user would need to collect in order to win? We have a flowchart for this improvement, but we are still in the process of trying to figure it out completely. unnamedunnamed-1


					

Python Lesson 6 Reflection

In the beginning of the class, we experimented with some functions and passing parameters. This is what I did during the first portion of the class:

#Function
def f_sum(int1,int2):
    return int1+int2
#Main Program
vTotal=f_sum(10,15)
print("The total is:", vTotal)


def f_print_largest(inta,intb):
    if inta>intb:
        print("Integer A is larger")
    elif intb>inta:
        print("Integer B is larger")
    else:
        print("They are equal")

f_print_largest(10,15)

#Method 1
def f_largest(x,y,z):
    if x>y and x>z:
        print("x is largest")
    if z>y and z>x:
        print("z is largest")
    if y>x and y>z:
        print("y is largest")
f_largest(10,15,20)

#Method 2
def f_larger(int1,int2):
    if int1>=int2:
        return int1
    else:
        return int2
x=12
y=7
z=79
print(f_larger(f_larger(x,y),z))

This is what printed out:

The total is: 25
Integer B is larger
z is largest
79

Then, Chloe and I tried the Chocolate Machine Challenge. It took me some more time after class, but eventually, the code finally worked. What went wrong was that we used / instead of // when dividing, which meant the computer didn’t know to round down. I did some research and found out that in this case, //, also known as floor division, because this way, the result is the quotient in which the digits after the decimal points are removed. In this code, functions were used to make it more efficient. Here is my final code:

def choosing():
    bar=int(input("Hello! What would you like to buy? Chocolate Bar 1=$40.5, Chocolate Bar 2=$35.7, Chocolate 3=$17.6"))
    global price
    if bar==1:
        price= 40.5
return cash()
    if bar==2:
        price=35.7
return cash()
    if bar==3:
        price=17.6
return cash()
def cash():
    while True:
        cashh=int(input("Insert cash."))
        if cashh < price:
            print("That is not enough, please reenter.")
            return cash()
        else:
            change_due=float(int(cashh)-float(price))
            print("I will give you $",change_due)
            twenty=int((change_due/20))
            left=int(change_due-twenty*20)
            ten= int(left//10)
            left1=int(left-10*ten)
            two= left1//2
left2=int(left1-2*two)
            one= left2//1
left3=int(left2-1*one)
            quarter=left3//float(.25)
            left4=int(left3-.25*quarter)
            dime=left4//float(.10)
            left5=int(left4-.10*dime)
            cent=left5//float(.01)
            print("I will give you:", twenty, "twenties,", ten, "tens,", two, "twos,", one, "ones,", quarter, "quarters,", dime, "dimes, and ", cent, "cents")
            break
choosing()

# / vs //: // is floor division, where the result is the quotient in which the digits after the decimal point are removed

Here is what printed out:

Hello! What would you like to buy? Chocolate Bar 1=$40.5, Chocolate Bar 2=$35.7, Chocolate 3=$17.61
Insert cash.125.5
I will give you $ 85.0
I will give you: 4 twenties, 0 tens, 2 twos, 1 ones, 0.0 quarters, 0.0 dimes, and  0.0 cents

Python Lesson 5 Reflection

This time, instead of doing the guess your number game, I made a “guess your word” game. The essentials are pretty similar, but instead of guessing a number and the computer telling the user if it is too high or too low, this time they’re guessing a letter and is told whether or not the letter is in the word. My code allows the computer to choose a random word from a set each time, and gives the user the length of the word. I also created a new text file that would record whether the user won or lost each time (like last time). Here is my code:

import random
import datetime
today = datetime.date.today()

WORDS = ("stawberry","banana","kiwi", "apple","pear","guava","rasberry","blueberry","pineapple","mango","durian")

def v_game():
    v_name=input("Welcome to the word game! What is your name?  ")
    print("\nHi,", v_name, "I'm going to think of a word and you have to guess it! Hint: This word is a fruit!!")
    print("\nGuess which letters are in the word, then you have to guess the whole thing! You have 10 letter guesses before you have to input your final answer!")
    print("\nGood luck!")
    tries = 1
word = random.choice(WORDS)
    length = str(len(word))
    guess = input("The word is " + length + " letters long. Guess a letter!: ")
    while tries < 10:
        tries+=1
if guess not in word:
            print("Sorry, try again.")
            guess = input("The word is " + length + " letters long. Guess a letter!: ")

        else:
            print("Good job! Guess another!")
            guess = input("The word is " + length + " letters long. Guess a letter!: ")
    while tries == 10:
            if guess not in word:
                print ("Not in my word. That was your last guess. Make a guess for the final word now!")
            else:
                print("Good job! That was your last guess. Make a guess for the final word now!")
            final = input("Try to guess the word!: ")
            if final == word:
                print("Amazing! My word was ", word, "!")
                text_file = open("GAme Word", "a")
                text_file.writelines("Name:" + v_name+ " Date played: "+ str(today)+ " Success "+"\n")
                text_file.close()
                while True:
                    again = input("Thank you again for playing this game, would you like to try again? Please type y for yes or n for no-")
                    if again not in {"y","n"}:
                        print("Please enter valid input")
                    elif again == "n":
                        print("Thank you, bye!")
                        quit()
                    elif again == "y":
                        return v_game()
            else:
                print("Sorry. My word was ", word, ". Better luck next time!")
                text_file = open("GAme Word", "a")
                text_file.writelines("Name:" + v_name+ " Date played: "+ str(today)+ " Failed "+"\n")
                text_file.close()
                while True:
                    again = input("Thank you again for playing this game, would you like to try again? Please type y for yes or n for no-")
                    if again not in {"y","n"}:
                        print("Please enter valid input")
                    elif again == "n":
                        print("Thank you, bye!")
                        quit()
                    elif again == "y":
                        return v_game()
v_game()

Here is the text file that records wins/losses:

Name:Selina Date played: 2017-03-22 Failed 
Name:Selina Date played: 2017-03-22 Failed 
Name:Selina Date played: 2017-03-22 Failed 
Name:Selina Date played: 2017-03-22 Failed 
Name:selina Date played: 2017-03-22 Failed 
Name:Selina Date played: 2017-03-22 Success 
Name:Selina Date played: 2017-03-22 Success 
Name:Selina Date played: 2017-03-23 Success 
Name:Selina Date played: 2017-03-23 Failed 
Name:Selina Date played: 2017-03-23 Success

Additional Note:

#Differences between
    ##List = [content, snake] list of things...append, modify
    ##List= (cannot change)  tuples

Additional Note: Currently working on hangman.

Python Lesson 4 Reflection

This reflection is a reflection over the course of two classes. Over these two classes, I learned the importance of a pseudo code, which is basically using an informal language ‘for humans’ to create a roadmap and help programmers think about the process of their program. I also the learned the importance of a flowchart, which is similar to a pseudo code but uses a more standardized language and uses certain shapes to symbolize input/output, process, start/end etc. The first thing I did was create a short program that would ask for a user’s password, and would tell the user either “access denied” or “access granted”. Not only did I utilize pseudocode, I also learned how to use the “count” function. Screen Shot 2017-03-16 at 10.46.25 PM Screen Shot 2017-03-16 at 10.46.57 PM

Next, I experimented creating the guess your number game. The first time I did it there was no loop and it was a very simple program. (see below)

:Screen Shot 2017-03-16 at 10.46.31 PM Screen Shot 2017-03-16 at 10.46.37 PM

Next, I added a loop that would ask the user whether he/she wanted to play again (using ‘def’ function). After that was successful, I then added the function which would record all the users’ scores and dates played on a text document.Screen Shot 2017-03-18 at 9.09.10 PM Screen Shot 2017-03-18 at 9.09.16 PM