The Tech Behind Thyme

Today, me and my partner at Educationally Designed released the fruit of over a month of development on Thyme. Thyme is an educational game to assist teenagers in time management and tracking, created as our final project for a grade 12 computer science class.

The premise behind Thyme is that the player will be given tasks to do, and for every task, they will need to estimate how long it would take them to do it. They then do said tasks and the game scores them based on how long it actually took them to do the task compared to how long they estimated it would take them.

There is a lot to be said about the philosophy behind our game, but today I will only be talking about the technical aspects of our development.

The GUI

We decided to use LibGDX’s Scene2d as our main GUI. This turned ou...

Read more.

Recursion

The core idea behind recursion is that to arrive at the final solution, a method calls itself. This might be confusing at first, so lets first give a simple example and work our way up to more complicated problems.

Before we get started, lets first talk about the basic rules for normal recursion:

  1. There must be a base case. A base case is the case where the function stops calling itself. If there is no base case (or the base case is never met), the function will continue to call itself until it will eventually throw a StackOverFlow error (which is what the famous website is named after).

  2. There must be a base case. A base case is the case where the function stops calling itself. If there is no base case (or the base case is never met), the function will continue to call i...

Read more.

Array Algorithms (Sorting & Searching)

What is Sorting?

Sorting is the process of which a group of data is ordered in a specific way. There are many ways to sort data, one of the most common ways to do this (with numbers) is to sort in ascending order. For example {1, 9, 2, 5} would sort to {1, 2, 5, 9}. Arrays, being a collection of data, are very commonly the subject of sorting in Java.

Algorithm

There are many algorithms that allow you to sort an array. One of the simplest sorting algorithms is bubble sort, which sorts by repeatedly swapping adjacent elements in the array. For every pair of elements in the array, if the first element is larger than the second, swap them. The product of this swapping is that after x iterations, the last x elements will be guaranteed to be sorted. If you think about it logically, it is easy...

Read more.

Arrays and ArrayLists in Java.

Arrays are a very powerful data structure used for a variety of purposes. The main purpose of an array is store a collection of information in a single place. For example, you might store a list of people to represent students in a classroom.

Specific items in an array can be retrieved by an index value, starting at 0. Each element of an array must be of the same type.

Declaring Arrays

In Java, there are two main ways to declare an array. The first way is to declare an array with a specific set of values.

String[] strArr = {"hello", "this", "is", "a", "predefined", "array"};

Another way to declare arrays is to declare an array with a length and a set of empty values.

int[] intArr = new int[5];

This would declare an array of length 5, with all values being 0.1

Accessing Indexes

In ...

Read more.

OOP in Java Part 2

In my previous tutorial, I described the basics of Object Orientated Programming (OOP) in Java. In this tutorial, I’ll go through some other Java OOP concepts: inheritance, class variables/methods, abstraction and polymorphism.

Inheritance

Inheritance is the concept that some objects are specialized versions of other objects. For example, a graduate student is a type of student. We can thus say that a graduate student extends a student, or a graduate student is-a student. There are other types of students too, like high school students or undergraduate students.

For this tutorial, I will start by implementing a general Student class.

When implementing a class that is intended to be extended, you must first think of the attributes that all types of that class have. In our case, all stud...

Read more.

Object Orientated Programming in Java

Java is the most popular programming language in the world, it is also very heavily object orientated (OO). It is recommended that you read my previous tutorial that introduces the concept of object orientated programming (OOP).

This tutorial assumes basic programming knowledge in any language, including ideas like variables and basic C-like syntax.

You must also have the Java Development Kit installed.

Hello, World!

The first thing to do when learning any language is making a “Hello, World!” program. In Java, this can be done as follows:

1. Declare a Class

Java classes can be declared using the class keyword as follows: public class {Class Name}. It is convention in Java that classes must be in title case, meaning that each word must be appended and the first letter must be capitali...

Read more.

Introduction to Object Orientated Programming

Object orientated programming, or OOP is one the most popular modern programming paradigms. OOP is used today in programming languages like Java, Python, C++ and JavaScript to create code that is simple to write and understand.

Since its inception in the late 1960s, it has been nearly impossible to find a programming language that hasn’t been influenced by OOP.

What is an object anyway?

An object can be simply thought of as anything with properties and or behaviors. For a more illustrative example, we can look at basketballs.

Basketballs have many properties, like their size, number of bounces, color, and location. They also have behaviors, like bounce, inflate and deflate. This is a good candidate for an object, since it is a “thing” that has properties that can be different.

Objects...

Read more.

Don't Fear the OOP!

By Peter Lin, Theodore Preduta, Larry Yuan

Please note: This assignment was originally written in HTML instead of Markdown. Due to color requirements, none of the code can be syntax highlighted.

This tutorial is based on the concepts discussed in the original Don’t Fear the OOP by the late Johannes Claerbout. Unfortunately, the original is not very family friendly and therefore cannot be taught in schools. My group has re-written the original in a more PG manner by using a different example: Minecraft Villages.

In this tutorial, as with the original, there will be three colors of text indicating different levels. Green text gives a pure English understanding of the code, yellow text gives a closer to code explanation and red text gives Java code that implements the concept.

Minecraft ...

Read more.