Please enable JavaScript to use CodeHS

West Virginia Discovering Computer Science

Description

In this lesson, students will be introduced to Karel the dog and commands Karel uses to navigate and interact with Karel’s world. This introductory lesson can be used as a review of concepts introduced in Karel Adventures modules.

Objective

Students will be able to:

  • Identify basic syntax used in JavaScript and Karel programs
  • Use basic commands to train or program Karel the dog
  • Debug basic code by identifying common syntax errors
Description

In this lesson, students learn more about Karel and Karel’s world. Students learn about walls/shelves in Karel’s world, the directions Karel can face, and how to identify a location in Karel’s world using rows and columns. Students will also begin solving more difficult Karel problems and situations.

Objective

Students will be able to…

  • Identify the direction that Karel is facing
  • Predict what direction Karel will be facing after executing a series of commands
  • Create basic programs to solve situations or problems in Karel’s world
Description

In this lesson, students will learn how they can create their own commands for Karel by calling and defining functions. Functions allow programmers to create and reuse new commands that make code more readable and scalable.

Objective

Students will be able to:

  • Define a function, and successfully implement functions in their code.
  • Create functions to teach Karel new commands
Description

In this lesson, students learn in more detail about functions and how to use functions to break down their programs into smaller pieces. Students will also learn about using the main function and commenting code to make it easier to understand.

Objective

Students will be able to:

  • Explain the difference between defining and calling a function
  • Utilize functions to write higher level Karel programs
  • Break a large problem down into smaller, simpler problems
  • Create clear and readable comments in their code that help the reader understand the code
Description

In this lesson, students learn how to use for loops in their programs. The for loop allows students to repeat a specific part of code a fixed number of times.

For loops are written like this:

for(let i = 0; i < 4; i++)
{
    // Code to be repeated 4 times
}
Objective

Students will be able to:

  • Create for loops to repeat code a fixed number of times
  • Explain when a for loop should be a used
  • Utilize for loops to write programs that would be difficult / impossible without loops
Description

In this lesson, students learn about the conditional statement “if”. Code within an “if statement” will only execute IF the condition is true.

if (frontIsClear()) {
    // Code to be executed only if front is clear
}
Objective

Students will be able to:

  • Use conditions to gather information about Karel’s world (is the front clear, is Karel facing north, etc)
  • Create if statements that only execute code if a certain condition is true
Description

In this lesson, students learn about an additional control structure, if/else statements. If/else statements let students do one thing if a condition is true, and something else otherwise.

if/else statements are written like this:

if (frontIsClear()) {
      // code to execute if front is clear
 } else {
      // code to execute otherwise
}
Objective

Students will be able to:

  • Explain the purpose of an If/Else statement
  • Create If/Else statements to solve new types of problems
  • Identify when it is appropriate to use an If/Else statement
Description

In this lesson, students are introduced a new type of loop: while loops. While loops allow Karel to repeat code while a certain condition is true. While loops allow students to create general solutions to problems that will work on multiple Karel worlds, rather than just one.

Objective

Students will be able to:

  • Explain the purpose of a while loop
  • Create while loops to repeat code while a condition is true
  • Utilize while loops to solve new types of problems
  • Test their solutions on different Karel worlds
Description

In this lesson, students will synthesize all of the skills and concepts learned in the Karel module to solve increasingly challenging Karel puzzles.

Objective

Students will be able to:

  • Define a problem in their own words and plan out a solution to the problem
  • Break a large problem down into smaller pieces and solve each of the pieces, then use these solutions as building blocks to solve the larger problem
  • Utilize the proper control structures to create general solutions that solve multiple Karel worlds
  • Write clear and readable code using control structures, functions, decomposition, and comments
Description

In this lesson, students review the module’s content with a 15 question Unit Quiz.

Objective

Students will be able to:

  • Prove their knowledge of basic coding concepts with Karel through a multiple choice quiz