2048 Game Screenshots

Overview

In this assignment, students have the opportunity to create a version of 2048, the popular mobile app, in python. Since this project is targeted towards CS0 and CS1 students, this project includes skeleton code, helper functions, "Targeted Help," and even Video Introductions to guide the students along the way.

Example Methods

Here are a few examples of the type of methods the students would be responsible for understanding or implementing:

  • make_board: creates a new, empty square board of N x N dimension
  • get_piece: gets the piece from the given board at the given (x,y) coordinates or returns None if the position is invalid
  • place_piece: places the given piece on the given board at the given (x,y) coordinates and returns True or returns False if the position is invalid
  • swipe_right: simulates a right swipe on the argument board
  • have_lost: responsible for determining if the game has been lost yet (no moves remain)

Abstraction Reference Guide

Since this may be one of the first times students are exposed to a larger project, one of the main objectives of this project is to emphasize functional abstraction to manage complexity. This project includes an “Abstraction Reference Guide” which contains all provided and student-implemented functions. This reinforces the idea of creating abstraction barriers and allows the students to focus on the problem at hand, rather than be overwhelmed by the entire project.

Example Project

An example of what the completed project might look like can be found at this link.

Assignment Materials

Student Resources

Worksheets

  • Introductory Worksheets: link

  • Worksheet Solutions: link

Meta Information

Summary

2048 in Python! -- Build the popular smartphone game "2048" using Python and a variety of key Computer Science concepts.

Topics: various levels of exposure to large projects and abstraction, understanding/modeling/maintaining existing code, variables, loops, conditionals, functional programming, multidimensional arrays/lists, randomness and distributions, and terminal GUIs.

Audience CS0, CS1
Difficulty

This is a relatively straightforward assignment, taking 4-10 hours for a CS0 student and 2-5 hours for a CS1 student.

An optional challenge or extra credit problem, however, is designed to take a student who finishes early or is advanced, relative to their peers, and challenge them heavily, with appropriate guidance.

Strengths

Specifically designed with complete beginners in mind, this project includes "Targeted Help" sections for struggling students who have a tendency to get stuck and video Introductions for students with shorter attention spans.

When tested among HS students first learning Computer Science, the project was reviewed very well for its teaching components and "cool factor" -- the final product at the end of the project is a full baked smartphone game on their computers.

One final strength is the customizability of the project to fit a particular skill level -- the specification and starter code can be modified quite easily to artificially increase the difficulty of the project by providing less "handholding".

A comprehensive autograder and printable Python prep worksheets (with solutions) for concepts that show up in the project are included as well.

Weaknesses

The project is relatively linear, though the level of synthesis required of students can be adapted. Specification is rather long, though video introductions are available. Installation of non-standard Python3 dependencies is highly recommended, though project will run without them.

Students can be confused by distributions without help and/or prior preparation. Minimal discussion of OOP. A lot of the things students are responsible for implementing is highly abstracted away, though for many CS0 students that's not necessarily a weakness.

Dependencies

Assumed knowledge of Python syntax and introductory concepts (print statements, comments, variables, data types, operators, conditionals, loops, functions, and optionally objects), but without mastery or even comfortability with them. Tested with students that had ~20 hours of lecture/lab/homework who started as complete beginners coming into this project Non-standard Python3 library modules: getch, termcolor (instructions for installation via pip included within Specification as part of a "Workspace Setup" doc)

Variants

Can flex difficulty for CS1 students by removing Targeted Help and/or starter code from spec. Advanced students can add on to this version of 2048 by allowing swaps at the press of a button -- extremely useful for getting out of tight situations!

Contact Us

If you have any questions, feel free to email us at P.ShiftEducation@gmail.com.

To learn more about what we've been working on, check us out here.