To start Project 4 and learn...
project4
folderproject3
, copy the following files and folders to your project4
folder:
css
copy the entire foler including all the .css filesjs
copy the entire folder including all the .js filesfunctions.php
functions_database.php
functions.php
, locate the make_buttom
function, and add the following script
tag
as the last tag before the closing body
tag:<script src="js/connect4.js"></script>
project4
folder, create a new file called connect4.php
and add the following code:js
folder, create a new file called connect4.js
and add the following code:project4
folder to the server and navigate to connect4.php
on the serverconnect4.js
remotely on the serverconnect.js
on the remote server as we will make changes.connect4.js
on the remote server and refresh your browser});
. Then save connect4.js
on the remote server and reload the page in the browser:doIt
function so that it updates the grid based on each player's click.var stacks = new Array(M).fill(0); // Array of M zeros
doIt
function, add the following code before changing the current player:isWinner
function must check for N-in-a-row in each stack, across each column, and in two diagonal directions.
The code below, show how we can check each stack:isWinner
to check for N-in-a-row across each column. Hint: you just have to swap c and s, i.e., the inner loop and outer loop.
While it is OK to help other students with concepts and general trouble-shooting, you should not share code. It is expected that each individual project will be unique.