2048 in Python!
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.
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.
An example of what the completed project might look like can be found at this link.
Video Introductions: link
Specification for this assignment (with videos): link
- Starter Files: GitHub Repo
Staff Solution: GitHub Repo
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.
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.
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.
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.
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)
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!
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.