Configurations Plus FeatureScript Equals Simplicity
Fellow software engineers could look at the rules of the game and figure out pretty quickly that it’s fairly straightforward to program. For me, the game’s logic was probably the simplest thing to make, and something that Onshape’s programming language, FeatureScript, is very capable of accomplishing.
The tricky part was figuring out a way to create a simple interface and a model in Onshape that communicates the results to the user.
This was done using a series of global variables and setting up the guess inputs as configuration parameters. Each configuration parameter corresponds with an individual Wordle custom feature, which checks the guess and updates the board with the results.
Doing it this way allowed me to use Onshape’s link sharing, giving people access to the Document and the ability to play the game even without an Onshape account.
I also chose to use sketches as a way to communicate the words guessed and to show what letters the user can still use. At the end of the Document, there is a custom feature that takes all of the results of each guess and creates a sketch with text using that information.
More Than a CAD System
At Premier Custom-Built, where I work as a software engineer, we design custom cabinetry for recognized and respected designers. We are challenged daily with keeping information up to date and customizable. Onshape made it possible for us to keep a single source of truth for our information in a format that our engineers can easily access and understand.
Configured Part Studios gives us the power to fully define a product and several use cases of that product, with custom features allowing us to apply those configurations in a quick and robust manner.
Using similar practices to what was used in the Wordle game, we are able to combine Onshape’s custom features and configurations to create malleable, yet parametric models. Over the years, we have developed 70-plus custom features for our cabinets and furniture, with plenty more in the works.
Because Onshape lets us get under the hood, we are able to design a CAD system that feels like it was made specifically for Premier Custom-Built. Find out more about our journey in this Onshape case study.
The Premier Custom-Built Team.
Barely Scratched the Surface
As for Wordle (the Onshape tribute version), there are still plenty of improvements that can be made.
Onshape has an API that can send information to and from Documents. By using this, it would be possible to create a new level each day by grabbing the Wordle word of the day and creating a Part Studio, completely automated.
That being said, maybe the next challenge for me is to create another game. Crossword puzzles, Sudoku, board games – the possibilities are endless in Onshape!