Welcome to the WiCS Web Applications workshop! We'll be going through basic HTML, CSS, and Javascript so that you'll be able to to code your own working Tic Tac Toe web app.
- Download the starter files using the links to the right.
- You're given the function (.check) that determines whether a Board is currently in a winning, losing, or draw state. This function should be called after each turn.
- Change the callback function (.handleClick) so that the correct letter (an X or an O) is drawn in the clicked cell. Also change the status box to a helpful message.
- Add a function that pops up the appropriate alert depending on whether the player has lost or won or if the game was a tie. Call the function in the .check function.
- Write a function called .clearBoard that sets all of the board's cells to empty. Call the function at the end of the game.
- Create a button that allows you to restart the game and calles .clearBoard.
Useful JQuery functions:
- $ → gets an element by the appropriate selector (# for IDs or . for classes)
- .html → changes the inner HTML of an object
- console.log(message) → brings up a message in the console
- .click(function(){...}); → handles click on object by calling the passed in function
- Go to afs.stanford.edu.
- Click on the afs.stanford.edu link on the left-hand side.
- Click on the WWW folder.
- On the left, click Upload File(s).
- Upload your files!
- Your webpage will be found at stanford.edu/~SUNetID/filename, where SUNetID is your ID, and filename is the name of the file you want to view.
- Empty website template: https://html5boilerplate.com
- CSS functionality: http://getbootstrap.com
- More on JavaScript/JQuery:
- CS 42: http://callbackjs.me