---
title: "Tutoring"
year: "2020"
motto: "Algorithm and Programming Practices"
description: "Several practices carried out as an advisor for Algorithms and Programming I of the course taught at UCAB."
stack: ["pascal"]
website: "https://github.com/RolandoAndrade/asesorias-algoritmos1-202115"
url: "https://rolandoandrade.me/projects/tutoring/"
author: "Rolando Andrade"
---

# Tutoring

> Algorithm and Programming Practices

Several practices carried out as an advisor for Algorithms and Programming I of the course taught at UCAB.

Year: 2020. Stack: pascal. Website: https://github.com/RolandoAndrade/asesorias-algoritmos1-202115

Repositories:

- [github](https://github.com/RolandoAndrade/asesorias-algoritmos1-202115)
- [gitlab](https://gitlab.com/RolandoAndrade/asesorias-algoritmos1-202115)

In the first semester of Computer Science, syntax errors and logic bugs can feel impossible to beat. At UCAB, the Algorithms and Programming I course teaches with Pascal. Students struggle to connect what they hear in class with code that actually runs.

I was a tutoring advisor for this course. My goal was simple. Write exercises that connect the lectures to the exams. Every week brought new topics, and students needed hands on examples that made abstract ideas concrete.

This repository collects eight weeks of programming exercises. Each one trains a skill students need for workshops, tests and projects.

## From setup to 2048

The materials cover the whole first semester. Topics go from basic syntax to complex data structures.

**Week 2** sets up the tools. Students learn to configure SublimeText to compile and run Pascal.

**Week 3** solves Sudoku. I gave two solutions. One uses procedures and functions. The other puts everything in the main block. Students compare both and see why modular code is easier to maintain.

**Week 4** offers small reusable patterns: swapping variables, working with strings, checking if a number is odd or even. These building blocks show up again and again in bigger projects.

**Week 6** mixes number systems with dates. A Roman numeral converter turns MCLXVI into 1166. A calendar program finds the day of the week for any date with formulas similar to Zeller's.

**Week 7** introduces structured data. Sets, enumerated types and matrices give students new ways to organize information.

**Week 8** is the 2048 game. It is a complete version that shows grid handling, user input and game state.

**Week 9** works with matrices. Deleting rows and columns from a two dimensional array needs careful index handling.

## How the exercises teach

### Two Sudokus, side by side

The Sudoku exercise shows the teaching idea best. Students get two versions of the same solution. The monolithic version runs for hundreds of lines in one block. The modular version splits the problem into small procedures.

The monolithic code works, but it is almost impossible to debug. Students see the same patterns repeat. They notice copied logic that could be one function. Seeing both versions makes the value of modular code obvious.

### 2048 is one move

The 2048 version breaks a game that looks complex into simple steps. Every move (up, down, left or right) follows the same pattern:

1. Take out a row or column
2. Push all non zero values toward one end
3. Merge neighbors with equal values
4. Push again to close the gaps
5. Put the row or column back

Vertical moves are treated as horizontal moves on a rotated grid. So the same pushing code works in all four directions. Students learn that many problems get simpler once you find the right way to look at them.

### Math inside a calendar

The calendar exercise connects programming to math. Finding the weekday of January 1st, 2020 needs:

- Century adjustments for the Gregorian calendar
- Year calculations that account for leap years
- Month factors based on how days are spread
- Modular arithmetic to cycle through the weekdays

Students see formulas turn straight into code. The leap year check combines several conditions. A year must divide by 4, but not by 100, unless it also divides by 400.

### Rows stored as strings

The Sudoku solver stores rows as strings instead of arrays. This unusual choice shows students that the way you store data shapes the algorithm. Finding duplicates becomes a string search. Checking a zone needs careful index math to find which 3x3 block holds each cell.

## Where it got hard

### Not ahead of class

Students could not use some language features until later weeks. A comment in the Sudoku code says the solution uses techniques beyond what students knew so far. That stopped students from handing in the example as their own work. It still showed them the level they would reach.

### Deep, but not overwhelming

Each exercise needed enough depth to teach something without overwhelming beginners. The 2048 game sits at the top of what a first semester can handle. It needs matrices, user input, random numbers and careful state handling. Simpler exercises, like the Roman numeral converter, focus on one idea.

### Pascal's old limits

Pascal is not a modern language. It lacks the comforts of Python or JavaScript. But that forces students to understand memory, types and control flow at a basic level. Working inside Pascal's limits helps them value the features they will meet later.

## Teaching taught me too

Explaining why code works takes deeper knowledge than writing code that works. Every exercise went through several drafts as I guessed what students would ask.

Modular code proved itself again and again. Small pieces you can test made debugging easier for students and for me. The 2048 game started as a tangled mess. Refactoring showed the simple pattern underneath.

Teaching materials need documentation too. Clear comments and a steady order help students find their way through new code. The comments in these exercises explain what the code does and also why it does it that way.

[Book a call with Rolando](https://rolandoandrade.me/pricing/)
