Skip to content

sf-wdi-44/kyrel

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kyrel

Kyrel is a simple browser-based game for learning about control flow and loops in javascript.

Example Problem

This codebase contains the following methods for traversing / transforming the row:

  • moveRight();
  • moveLeft();
  • useGreen();
  • useBlue();
  • draw();
  • erase();
  • onGreen();
  • onBlue();

Start:

Write a program which draws a green circle at the end of the row.

End:

  function main() {
    moveRight();
    moveRight();
    moveRight();
    moveRight();
    useGreen();
    draw();
  }

Instructions

Fork and git clone this repo (you now know how to do this!).

There are 3 problem sets:

You will write your code in play.js:

var initial_state = [ '.', '.', '.', '.', '.' ];

function main(n) {

  //////////////////////////////////
  ////                          ////
  //// v YOUR CODE BELOW HERE v ////
  ////                          ////
  //////////////////////////////////



  //////////////////////////////////
  ////                          ////
  //// ^ YOUR CODE ABOVE HERE ^ ////
  ////                          ////
  //////////////////////////////////

}
  • First, manually configure your initial_state to match the start state of the problem you're solving

    • var initial_state = ['.', 'b', '.', 'g', '.']
      • 'b' means blue
      • 'g' mean green
      • '.' (dot) means empty
  • Next, use the methods available to you (e.g. moveRight(), moveLeft(), etc.) inside the main function to get the problem's finish state

  • To execute your code in the main function, open index.html in your browser and press "Play"

    • Refresh the page whenever you make changes to your JavaScript
    • Always have your Chrome Developer Console open (Cmd + Opt + i) to check for error messages
  • When you've completed a problem, save your work! Create a file that matches your problem name, e.g. all-blue.js, and copy-paste your play.js into that new file. Then, go back to play.js and clear out your main function, so you can start fresh again.

Inspiration

Adapted from Kyrel.

Slides

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 84.4%
  • HTML 8.2%
  • CSS 7.4%