Coding a Game of Two Truths & A Lie

Coding a Game of Two Truths & A Lie

Hello world!

Welcome back to another school year! In this activity we are going to code an app for students to play “2 Truths and a Lie.” In the game, the programmer populates a list (array) containing three “facts” but one of the fact will be false. In my example, I use the second fact as my false statement.

The user of the game will select 1, 2 or 3 on the keyboard to guess which statements are true and which are false. In my example, if the user enters 1 or 3, the game returns “Nope that is true!” If the user enters #2, which is my false statement, the game says “Correct!”

Check this out! Coding a Game of Two Truths and A Lie #CSForAll #CodeBreaker Click To Tweet

Here is the tutorial video. Feel free to share this with students!

Here is a sample of my game:

Here is the project page:

Possible Extensions:

This game could be extended using Makey Makey. Students can build circuits connected to objects on their desk. Rather than using the keyboard (1, 2 or 3), users can program “up, left, or down” on Makey Makey to be the corresponding inputs. Use Play D’oh, use bananas or use pie plates as inputs! If you teach electricity or circuits, this is the perfect extension!

For more lessons, activities and ideas, grab a copy of my book, Code Breaker, on Amazon here!


(Visited 977 times, 1 visits today)

Leave a Reply

Email *