Lesson 59 — War!

We’re starting a new project, the card game war, just a simple version to learn and practice some more javascript.

What are the first things you need to do to start a new project?

  1. Start a new project folder. You can do this by going into your computer’s documents folder, or you can use your Git Bash command line to create what you need.
  2. Create a folder called war. Add a new folder or use cd to change directory into your projects folder and then mkdir war to make a directory called war. Always make sure you are in the directory you expect to be in before you create a file or folder.
  3. Create a file called index.html or use touch index.html.
  4. Create a folder called css and one called js or use mkdir.
  5. In the css directory create a file called style.css or use cd css and then touch style.css.
  6. In js directory create a file called script.js or use cd ../js and then touch script.js. The ../js moves out of the current directory up one level in the file system and then finds the js directory and opens that folder.

Next, make a plan. What do you need your program to do and what do you want it to look like? Think about it before you read my description.

We’ll want a title War! We’ll want a first and second player. We’re not going to mess with images of cards at this point. We’ll just have it show 9 of Clubs and such. So we’ll need a place on the page to show each card and a spot to show the winner of each round.

We’ll need 52 cards. We’ll need them split into two hands, one for each player. The cards played will need to go into the “back” of winner’s deck. Eventually we’ll have to figure out when there is tie, but that’s not a thing we need in place in the beginning.

Today you can create the head of your HTML file. Create the body and add in your script links as well. Use your last project to get that done.

You can watch this lesson as a video and see how I am setting up the game to see what it looks like.