Please enable JavaScript to use CodeHS

Demos

Introduction to Magpie


Meet Magpie, our very own chat bot! As you'll see, Magpie is pretty simple. There are only a few keywords and keyphrases that Magpie responds to, and if it's confused, it just returns a random response that might not make sense. **Start** Get to know Magpie by Running the code and inputting the following statements: 1. My mother and I talked last night. 2. There are no cool movies out right now. 3. The weather is nice. 4. Do you know my brother? **Exploration** Look at the code in `Magpie.java`. Specifically, see how the `if` statements assign a value to a `response` variable and then return the response. The `getRandomResponse` method picks a random response if one of the `if` statements wasn't able to decide on a better response.

While Loop Time


Finalizing Tic Tac Toe


In this exercise, we are going to complete the Tic Tac Toe game. In the `TicTacToeTester` class, use the methods that you created in the `TicTacToe` class to implement your own version of Tic Tac Toe. Your game should take user input to determine which index the user would like to place their X's and O's, and check to see if there is a winner after every turn that is taken. If the user inputs an invalid space, they should be notified, and asked to input another index. Utilize loops to implement this effectively! Your game should indicate which player won, and notify the users if there is a tie at the end. Take advantage of all the methods that you created in the previous exercise, and feel free to make alterations to the game to make it your own! If you are feeling proud of your finished program, consider submitting it to CodeHS [here](https://forms.gle/QmLz4MnQg8jEiA219) for a chance to get you and your program recognized on CodeHS's Twitter account!