Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stevecalla/971d112c16a10cf2e3f8df105a484948 to your computer and use it in GitHub Desktop.
Save stevecalla/971d112c16a10cf2e3f8df105a484948 to your computer and use it in GitHub Desktop.
Mod 0 Session 1 Practice Tasks

Session 1 Practice Tasks

The assignments listed here should take you approximately 60 minutes.

To start this assignment, click the button in the upper right-hand corner that says Fork. This is now your copy of the document. Click the Edit button when you're ready to start adding your answers. To save your work, click the green button in the bottom right-hand corner. You can always come back and re-edit your gist.

1. Markdown (20 min)

Markdown is the format all of your homework gists are written in.

Using this markdown cheatsheet, create a new gist of your own by clicking the New Gist button in the upper right-hand corner of the screen. Create a "Beginners Guide to data types" documenting your data types knowledge so far using Markdown.

NOTE: Remember to add a .md file extension to filename of your new Gist. Otherwise it will not register as markdown.

Incorporate each of the following features into your Gist:

  • at least two headings of different sizes

  • at least one numbered list

  • at least one bullet point list

  • at least one bold word/phrase

  • at least one italic word/phrase

  • at least one code block

  • at least one inline code block (greyed text)

  • at least one image

  • Paste the link to your gist here: https://gist.github.com/stevecalla/a5bfa43dcf5e305822e7a98da0bc66fb

2. Documentation and Googling (20 min)

Documentation of a language, framework, or tool is the information that describes its functionality. For this part of the practice tasks, you're going to practice digging into documentation and other reference material.

NOTE: Remember to look for the docs! mdn for javascript and ruby-doc for ruby.

  • In your own words, what does the JavaScript/Ruby string split method do (pick based on your program)? As you're explaining, be sure to provide an example. Your answer: Splits string into an array of substrings; probably takes a string like "My name is Henry" and spits into an array of ["My","Name","is","Henry"]

  • What did you Google to help you with this task, and how did you pick your results? I googled "what does JavaScript string split method do". To select my results I reviewed a couple google response to both understand how this function works and to ensure consistency of definition.

  • In your own words, what does the JavaScript/Ruby array slice method do (pick based on your program)? As you're explaining, be sure to provide an example. Your answer: Returns selected items in an array as a new array. So takes an array like ["My","Name","is","Henry"] and returns the specified value. So if I specify to return the 4th item in the array it would return ["Henry"] as a new array (in this case with one item.

  • What did you Google to help you with this task, and how did you pick your results? I googled "what does JavaScript array slice method do". To select my results I followed the same process noted above. I did consider also conducting a coding text but I figure we'll get to it eventually.

3. Data Types and variable assignment (20 min)

Imagine that you're taking your favorite board game and turning it into a computer-based game.

  • Name of board game: Your game goes here CandyLand

  • Use the space below to categorize game data into each of the following data types. You should have a minimum of two variables assigned for each data type below. Feel free to break each variable declaration on to its own line. Pick either ruby or javascript based on your program (see examples below for how they should look)

  1. String data:
javascript example
var instructions = "This is how you play the game, blah, blah"; 
  //might not be necessary, but figured I'd make it a variable if we want to build in different rules options per user input
var gameVariation = 'Beginner';
  //the default will be the beginner version but allow user to select beginner or advanced level
  1. Integer and/or float data:
javascript example
var numberCards = 52; //will need to count card for each turn
var numberPlayers = 0; //will need to reassign at start of game
var totalSpaces = 134; //may or may not need
var currentSpacePlayer1 = 0;
  1. Boolean data: JS e.g. var
javascript example
var winner >= 134; 
  //player to 134 wins; assume a rule will exist to check if this is true or not against currentSpacePlayer1
  //winning rules vary; some play to land exactly on 134; others play 134 or greater; will decide how to build into game
var XXXX = 'XXXXX';
  1. Array data
javascript example
var cardColor = ['blue','red','green','yellow','orange','purple','pink']; 
  //array might be useful as a color will be chosen at random for each draw of a card
var blueSpaces = [1,10,20,30,40];
  //assign each space to an color a ; I've done this partially above; there are 134 spaces so figure out the number of spaces for each of the seven colors; might be useful to use an extension paired data type; would need to think thru it more
  1. OPTIONAL: Hash or Object data:
javascript example
var pinkSpaces = { 15: "Candy Cane Forest", 42: "Gumdrop Mountain", 77: "Queen Frostine" , 101: "Gramma Nutt" }
  //assign pink spaces to special names in pair; Candy Cane Forest, Gumdrop Mountain, Queen Frostine, Gramma Nutt.
var winningSpace = { 134: "Candy Castle" }

Reference: LINK Cool JS for Checkers: LINK More JS for Checkers(I'm not the author): LINK

4. Questions/Comments/Confusions

If you have any questions, comments, or confusions from the any of the readings that you would like an instructor to address, list them below:

  1. I probably made the board game assignment more complicated but I felt like I needed to think through how the game might work before I could start figuring out variables/data types. I clearly didn't get anywhere near that but I did see some pretty cool coding examples for checkers during my research.
@mschae16
Copy link

@stevecalla - Excellent work on this assignment, Steve! You did a good job explaining the split and slice methods and including examples, and it was really great to see such thorough responses for the Beginner's Guide to Data Types gist as well as your practice on variable assignment. Keep up the great work!

@stevecalla
Copy link
Author

@margoschaedel - Jeeze, as I review a number of typos. I'll need to watch / clean that up! Thanks for taking the time to review. Best, Steve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment