Makey Makey Balance Board Challenge

Makey Makey Balance Board Challenge:

In this challenge we were tasked with creating a program for a balance board game for the Middle School Banana Balance Board Club Presidents. We had to utilize the makey makey and the prototype to create two working codes that allowed a timer to count up once both ends of the balance  board was off the ground, and to stop counting when one side touched the floor. By using both Scratch and Python, I gained exposure to both block coding and more advanced coding with tKinter.

Two codes from Scratch and Python (details in video below):

A) Scratch

B) and Python.

2) Video (Both Scratch and Python)

The video shows that the program fits the requirements of the Middle School club presidents (the clients) because the as shown in the clip of the working prototype, the timer starts counting up when both sides of the balance board are off the ground, and stops counting when one side touches the floor.

3) Testing Documents (Scratch and Python)

4) References

Reference One: http://sebsauvage.net/python/gui/#import

Reference Two: https://stackoverflow.com/questions/44372046/tkinter-timer-to-start-at-0-on-button-click

Reference Three: https://wiki.scratch.mit.edu/wiki/Variables_Tutorial

Reference Four: https://stackoverflow.com/questions/20832909/how-to-bind-a-keypress-to-a-button-in-tkinter

Make Makey Balance Board Findings Update

Objectives:

   Client: Rachel and Rohan – presidents of Banana Balance Boards

   Goal: Design timer system for balance board game

   Client Requirements:

  • Timer that starts when the board is off the ground
  • Timer stops when the board touches the ground

 

Pseudocode:

Introduction to Game is displayed.

User inputs name.

   Person steps onto balance board.

   Once both edges of balance board leave the ground, timer starts counting up by seconds.

   When one edge of the balance board touches the ground, timer stops.

   Print out time stayed on the balance board.

Input user’s name and score into leaderboard.

 

Flowchart:
 
Reflection questions:
1. What worked?
The scratch file was easier to use after I go used to it, because of the way it was structured through block coding. I think the use of Scratch made the process a little easier because the debugging process didn’t include checking for things like spelling errors, punctuation errors, or indenting errors that would occur in Python. Also, specifically towards the code, I was able to make the timer count upwards and allow the time to be displayed on the screen by setting it as a variable. I was also able to use key controls to start and stop the timer, by starting the timer when ‘not space key’ is pressed, and stopping it when the ‘space key’ was pressed.
2. What didn’t work so well?
As for what didn’t work well, I think at first it was difficult getting used to using Scratch because I didn’t know what subcategories every command was placed under and it was hard at first figuring out where everything was and how to use it. Furthermore, the Makey Makey did not connect to the keys very well at first and it couldn’t really detect when ‘not space key’ was pressed or when both sides of the balance board were off the floor. Also, at first I couldn’t get the timer to work properly because the timer wouldn’t reset every time, and the time went up to 100,000s of seconds. I was able to fix that by setting the variable time to 0 at first.
3. Things to find out for next class?
Next class, I would need to do a few more test runs and figure out how to save scores on scratch so that they are displayed on the screen like a leaderboard. Currently, with our Makey Makey prototype, the user has to be holding one end of one of the wires in order for the Makey Makey to detect movement. Next class, I want to try and figure out how I can eliminate this so the game is less complicated and messy to operate.
4. What would you like to appear on the screen?
I would like
1) The timer counting up,
2) The player’s name and score, and
3) a leaderboard displayed on the screen in Scratch.
5. Time in (HH:MM:SS?)
I think time should be in minutes and seconds (MM:SS) because it is highly unlikely that a player would be able to stand balance, on the balance board for over and hour. I think this way by showing seconds, the user can see the timer going up quickly and it will increase the enjoyment of the game and competitive aspect of the game, making it more fun for the user.
6. Does the time count up or down?
Count up, because there is not limit to the time a user can theoretically stand balanced on the balance board.
7. Can the user input their name?
Not as of now, but that is something I should work on next class, so that there is more interaction with the user and so that the leaderboard can display the user’s name and score.
8. How does the timer stop and record each users time?
The timer stops when the space key is pressed, so when one of the ends of the balance board covered in foil touch the pieces of foil on the ground that are connected to the space button on the Makey Makey device. It records the users time, by displaying the the time elapsed (set as a variable) on the screen once the timer is stopped.
9. How can you record the users time to a text file?
Like we did in the Quiz Game, the users time can be saved to a text file to create a leaderboard by importing a text file and writing each user’s score and name onto the text file after each result.
Video of Temporary Results:

Python Quiz Game

Quiz Game: Geography Trivia

Flowchart:

https://drive.google.com/file/d/1INm_ip7_2ESuqE_YdZE2r8-DhOiknY4K/view

Pseudocode:

Start

Print ascii art of game name

Input: “What is your name?”, store as variable ‘username’

Print game instructions (“Hi username, welcome to Geography Trivia! Here you will aim to answer 15 geography questions correctly. There is an easier multiple choice version and a harder free response version.”

Input: “Which version would you like to play?”, store as variable ‘VersionChoice’

 

If VersionChoice.lower == “easy”

Print: “ Easy()”

 

Def Q1 = Print: “Q1: ……? 1)  2) 3) 4)”

   Answer1 = Int(input(“Please enter the number of your answer))

While True:

   If Q1 == Correct answer

   print(“Correct! Good Job”, Score”)

   Q2()

   break

   Elif Q1 == Incorrect answer

   print(“Sorry try again”)

   Q1()

  Break

  Else:

  print(“This is not a valid answer choice. Please enter ‘1, 2, 3, or 4’”)

  break

 

Def Q2 = same structure as def Q1. Repeat until Q15.

End of Q15:

Print: “Congratulations! You have completed the quiz. Your final score is ___”

End

 

Elif VersionChoice.lower == “hard”

Print: “ In this version you will be give 15 free response questions on geography. A correct answer will give you one point, and an incorrect answer will not give you any points. Press any key to continue”

 

Def Q1b = print: “Q1: ………?”

   Answer1b = input(“Please enter your answer”))

While True:

   If Answer1b.lower() == Correct answer

   print(“Correct! Good Job.” Score)

   Q2b()

   Break

   Else:

   print:(“Sorry, try again”)

   Q2b()

   Break

 

Def Q2b = same structure as def Q1b. Repeat until Q15b.

End of Q15b : Print: “Congratulations! You have completed the quiz. Your final score is ___”

End

 

Resources Used:

  1. Classmates – Joella
  2. http://opentechschool.github.io/python-data-intro/core/text-files.html
  3. https://stackoverflow.com/questions/6797984/how-to-convert-string-to-lowercase-in-python
  4. https://stackoverflow.com/questions/7025443/else-elif-statements-not-working-in-python

 

Link to testing document:

https://docs.google.com/a/hkis.edu.hk/spreadsheets/d/1w4qsNTMLX3kYsnJ0MS7zb3KjcOYV1tWDFO_AV3SSp7A/edit?usp=sharing

Link to Quiz Game Demo Video on Youtube: https://youtu.be/RAD_J9pZgEs

Python Lesson 6

Lesson objectives and reflection:

Today, our lesson was mainly about functions, and I learnt how to correctly use functions to simplify codes and how to set parameters for my function.

  • The benefits of using Functions
    • Using functions is very beneficial, because by using functions I can shorten my program and condense it so that it is more succinct, because shorter programs are easier to replicate and decrease the chance of errors. Furthermore, by using functions you can easily change the output of the function by changing the parameters, or changing the input of the function to a user input. Functions also provide better modularity for application and a higher degree of code reusing, improving efficiency and flexibility.
  • How Functions work: Passing parameters and calling functions
    • Functions work by first defining a function, and they use features like loops, if, elif, else, to further describe what the function does, and then at then end of the function, you can call the function and set parameters to create a working input and output to replace the variables of the function,

Python Lesson 5

 

 

 

 

Lesson objectives and reflection:

  • Create pseudo code and a flow chart for guess the word game.
    • We began with a pseudocode and a flowchart for the “Guess the Word Game” and I think this is especially useful while we are still getting used to applying our knowledge to solving harder challenges as it helps us to plan out our thinking beforehand. I think it is also helpful because when our program doesn’t run correctly we are able to use the pseudocode to figure out possible errors in our code.
  • Use variables, While loop, If, Elif, Else statements in your program.
    • Before, we learnt how to use variables, while loops, as well as if, elif, and else statements in our programs in previous challenges, but we mostly used them separately or, or in combinations of one or two of the above features. This time, for our “Guess the Word Game” challenge, we had to incorporate all of these features into one program, and I think it was more difficult because of that. Due to the fact that we had to use all of these features in one program, it was also harder to detect/locate sources of error, and I think I had to be more error of ‘punctuation’ mistakes as that could greatly affect the program as a whole.
  • Explain how you could extend your program to use a Function / Procedure / Method.
    • I think we could extend our program by using a function so that the game could become a two player game by using a function to replace certain lines of the program, so it can be repeated, and so the word that one player is supposed to guess can be inputed by the other player.
  • Explain the difference between Lists[] and Tuples()
    • [] (Lists): Can be edited
    • () (Tuples): Can work as lists, but can not be edited

Python Lesson 4

Today we started off with a few review challenges, utilizing the skills we learnt in the past few lessons (see pic below):

A new concept we learnt today was the concept of pseudocode. I learnt the pseudocode is a simplified version of programming in the sense that it is applicable to all different sorts of programming such as Java, HTML, Python and more. As a universally applicable language pseudocode is usually written in verbal form in English describing steps explicitly through words and sentences.

We practice this concept with a flowchart based on the inquiry questions: “Is the pet at home?”, using a flowchart to map out different options and choices based on choices to have a visual representation of the choice available, so that we could transform that into a flowchart into sentences. These sentences would then become our pseudocode in the repeated form of:

Question?

If yes: _______

If no: ________

We learned how to apply pseudocodes and flowcharts to the classic number game as well by generating a flowchart (see pic below):

Python Lesson 3

Today through the experimentation with 3 challenges we learnt mainly how to use the three functions if, elif, and else. I learnt that after setting an input, we can use if to define and create a variety of results so that the output would vary depending on different conditions of the input. We can also use a nested if which would be indented an used as a sub-definer of a already defined question, limiting inputs further based on a certain condition.I also learnt that elif is short for else if and is used after an if function meaning that a certain output would results for all remaining inputs if ___ condition is met. Lastly I learnt that else can be used after an if function or after both an if and elif function and creates an output for all remaining inputs not defined by the if function used earlier. By manipulating these three main functions I learnt how to create slightly more complex “games” where the program would be able to read and give different outputs based on different inputs.

 

12P Python Lesson 2

Today we used PyCharm to experiment with different code challenges, using problem solving to figure out correct codes based on what we’ve already learnt. We learnt how to set variables to decrease the number of steps needed to complete a challenge. We also learned about slicing and length to split words or chains of letters into desired lengths, and using the length function to count words. Throughout the process of trial and error, I also learnt a lot about error handling and how to learn from my mistakes and build upon my knowledge from each past challenge completed. Furthermore, as I practiced more I realized a lot of the mistakes I made were simple mistakes, like forgetting quotations, forgetting parentheses, spelling errors, and other sources of errors that could be fixed easily.

Design Thinking Questionnaire

Today we worked on brainstorming issues with HKIS, and developing a questionnaire based on a brainstormed issue. I learnt that we had to develop both yes/no questions as well as more open-ended questions to get a more wholistic idea the individual’s opinion on a topic. Thus, we developed yes/no questions, questions with a number response, short answer questions, and long answer questions, trying to make sure the survey captured a wide variety of ideas and opinions. I also learnt that the questions we develop should not be misleading or designed to sway and individual a certain way, meaning that questions should not include opinionated or biased terms.

The topic we chose was environmental friendliness, and while we did develop quite a few questions, I think we could’ve improved our survey by including questions like “Please rate the eco-friendliness of HKIS” rather than specific scenario based questions.

Some pictures of our survey questions and results:

Backpack Prototype and Reflections

 
Empathy Statement: The school community needs a way to improve their backpacks for the student body because the current supply of backpacks do not satisfy all of their needs and wants for comfort, user-friendliness, and aesthetics.
Reflection:
•Who, problem, action,project/idea and why?
Who: Student body
Problem: Current backpacks do not satisfy the needs and wants of students
Action: Make a backpack more suitable for current students
Project/Idea: http://blog.hkis.edu.hk/wp/190215/2017/08/24/backpack-design/
Why?: To provide better backpacks that are both comfortable and aesthetically pleasing for students.
•Build EMPATHY
Throughout the survey process, the design process, and the build process, we had to constantly revise our design so that it was suitable for the needs of the average student. We developed empathy because we had to constantly brainstorm what ideas would fellow students like and we had to cater our design towards the needs and wants of the average student.
•What are your partners needs?
Different members of our group have different strengths and weaknesses. Some of us were better at designing and providing creative suggestions, whilst some were better at the more practical building aspect of the backpack making process. I learnt that we had to utilize the strengths of all our group members in order to make the process run smoother and ensure that all of us were able to enjoy the process. We also had to make sure we made clarifications and answered each other’s questions so everyone knew what they were doing.