# The Story of Math Academy’s Eurisko Sequence

*During its operation from 2020 to 2023, Eurisko was the most advanced high school math/CS sequence in the USA.*

**Note:** This is the preamble to the textbook Introduction to Algorithms and Machine Learning.

This book was written to support Eurisko, an advanced math and computer science elective course sequence within the Math Academy program at Pasadena High School. During its operation from 2020 to 2023, Eurisko was the most advanced high school math/CS sequence in the USA. (“Eurisko” is Greek for “I discover,” and is the namesake of an AI system from the 1980s that won a particular game competition twice in a row, even when the rules were changed in an attempt to handicap it.)

Eurisko’s courses were presented at a level of intensity comparable to those offered at elite technical universities, and students wrote all their code from scratch before they were allowed to import external libraries. This was possible because students had already learned a large amount of college-level math through Math Academy, including multivariable calculus, linear algebra, and differential equations by the end of 10th grade.

The first Eurisko course was inspired by MIT’s Introduction to Computer Science and went far beyond it. In addition to implementing canonical data structures and algorithms (sorting, searching, graph traversals), students wrote their own machine learning algorithms from scratch (polynomial and logistic regression, k-nearest neighbors, k-means clustering, parameter fitting via gradient descent).

In subsequent courses, students implemented more advanced machine learning algorithms such as decision trees and neural networks. They also reproduced academic research papers in artificial intelligence leading up to Blondie24, an AI computer program that taught itself to play checkers. At the same time, they worked together to implement Space Empires, an extremely complex board game that pushed their large-scale project skills (object-oriented design, version control, etc.) to the limit. The ultimate goal was to create artificially intelligent Space Empires players, drawing inspiration from techniques used in Blondie24.

This book would not have been written if the Eurisko program had not existed, and Eurisko would not have been possible without the collaboration of Jason Roberts, founder of Math Academy. Eurisko started in June 2020 when Jason asked me to teach his 15-year-old son Colby some serious computer science over the summer. He pulled in some of Colby’s classmates who had the necessary mathematical background, and we put together a summer computer science group that met three times a week with about 10 hours of problem sets each week.

All problem sets required students to write code individually, from scratch, in Python. They weren’t allowed to use external libraries. Instead, they had to build everything themselves. They were allowed to collaborate at a high level, discussing different approaches to solving the problems, but every student had to write up every problem set on their own.

To our surprise, the students progressed even faster than we could have possibly expected:

- At the start of June, they didn't know how to write helper functions. Even something as simple as checking if a string was a palindrome was not trivial to them.
- By the start of July, they had built a matrix class and a gradient descent optimizer from scratch. The matrix class included methods for matrix arithmetic as well as standard linear algebra procedures like row reduction, determinants, and inverses.
- By the start of August, they had built a regression library on top of their matrix class and gradient descent optimizer. The library included polynomial, logistic, and multiple linear regressors with interaction terms.
- On top of all this, they also implemented standard algorithms for sorting arrays and traversing graphs. And per Jason's suggestion, to get some systems programming experience, they also created a simple version of the Space Empires board game and played against each other by programming and submitting autonomous strategies.

At the end of the summer, Eurisko was fortunate to receive funding for an official high school class through a partnership with App Academy. Jason recruited a second cohort of incoming 10th graders, and – through an extreme feat of class management – I managed to continue supporting the first cohort while simultaneously launching the second cohort within the same class period.

The class setup during the 2020-21 year was incredibly tricky. School was fully remote due to the pandemic, and each cohort only had two hours of class time over a group video call each week. If a student got stuck, they had to ask for help by posting a message on Slack, and the message had to be descriptive enough that I or another classmate could quickly understand their question and respond briefly without burning much time. This setup would be a steep learning curve for any junior developer, much less a high school underclassman with little to no prior coding experience – but we made do, and those students who muscled through it emerged with an incredible amount of self-sufficiency and debugging ability. (Not to mention, we did all this on school-issued Chromebooks using free online development environments like Replit and Gitpod.)

Later years became significantly smoother as I refined the curriculum and school returned to in-person classes. During the 2021-22 year, most problem sets contained written tutorials descriptive enough that I only had to give a traditional lesson once per week. Over summer 2022 I further refined and organized these tutorials into book chapters, and during the 2022-23 year, the Eurisko classes were almost entirely self-service. Students read the assigned chapter on their own and completed practice problems. In class, instead of giving a traditional lesson, I answered questions and helped students debug their code.

In 2021, Jason shared a wild idea to have Eurisko students reproduce the Blondie24 research papers and use that as inspiration to create artificially intelligent Space Empires players. This became our vision for the ultimate capstone project. The first Eurisko cohort came within striking distance but ultimately ran out of time because they only had two full years of Eurisko instead of three. But the second cohort managed to reproduce one to two of the three papers in the Blondie24 research program and use this as inspiration for evolving combat strategies within Space Empires.

The second cohort’s final year (2022-23) also happened to be the final year of the Eurisko program due to my relocation. All together, there were 16 students who stayed for the duration of the program.

*Cohort 1 (Summer 2020 - Spring 2022):*David Gieselman, George Meza, Riley Paddock, Colby Roberts, Elijah Tarr*Cohort 2 (Fall 2020 - Spring 2023):*Maia Dimas, Justin Hong, Cayden Lau, Anton Perez, William Wallius, Charlie Weinberger*Cohort 3 (Fall 2021 - Spring 2023):*Celeste Acosta, Elias Gee, Benjamin Park, Jeffrey Smithwick*Cohort 4 (Fall 2022 - Spring 2023):*Matteo Paz

Finally, a sincere thank you to Sanjana Kulkarni for her thoughtful suggestions and diligent proofreading of this book.