Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
This season’s Mathcad Community Challenge is an open-ended creative challenge: design and implement a game within PTC Mathcad Prime! I’ll be hosting this challenge.
Mathcad Community Challenge Summer 2024: Game Gallery
For our purpose, a game is defined as an interactive, structured experience with an achievable goal that has a beginning state, then allows for user input that can advance the state as the user tackles a challenge or solvable problem, followed by an advanced (intermediate or ending) state.
As a good example, see my first reply to this challenge below.
This challenge will be quite lenient on what a game is and the production values you put into it, though you should test it and make sure it works as intended before submitting it.
Games take a long time to concept and execute, and for that reason, this challenge’s submission period will last until the end of September (September 30, 2024)! Expect the blog write-up on Mathcad.com to come out sometime in October. Your regularly scheduled engineering problem challenges will resume with the November challenge.
You don’t need to use PTC Mathcad Prime 10’s Advanced Controls to do this challenge, but they would greatly help. (It is possible to creatively make non-control workarounds depending on what you’re trying to do.) PTC happens to be hosting a training webcast on August 20 to help you learn how to use the controls, but you should also take the initiative for yourself and try to learn them independently if you want to incorporate them.
Unique for this challenge, in addition to the blog write-up, I will record my “playthroughs” of each submission and publish them on the PTC Mathcad YouTube channel.
In addition to the existing Mathcad Community Challenge Guidelines, I’d like to stress not to submit anything that would violate others’ copyrights, trademarks, or intellectual property rights per the PTC Community’s Terms of Service. If you don’t want to try to make your own game concept from scratch, it’s considered fair use to take inspiration from games that have existed throughout human history and/or the market (or submitted in this challenge), but not using commercial brands. You're also free (and encouraged) to directly collaborate with one another on a project.
Have fun!
MOO, also known as Bulls and Cows, is a code-breaking game where you use deductive reasoning to decipher a code based on the feedback you get from your guesses. It’s now available and recreated on PTC Mathcad Prime.
The goal is to guess the correct four-digit hidden number, and its Mathcad Prime depiction does that by comparing your guesses with the hidden number and delivering feedback. Using a variety of scripted Advanced Controls, Mathcad Prime both takes in your guess inputs and delivers the feedback outputs.
Have fun by downloading the attached PTC Mathcad Prime 10 file.
Nice!
In your sheet you write that opening the protected area is considered cheating. You should also add that evaluating variables First is cheating too 😉
The advanced controls sure need an option to get protected from viewing their inputs and editing.
At the time being the only solution I could think of is the usage of an evaluating function placed in the protected area. But unfortunately it would have to be called in a separate region (maybe a second collapsed area) after the user input was done as it could not be called from within a scripted control.
EDIT: But it may be possible to use the function call as input of a scripted control. That way we would not have to use an extra region. Haven't tried but I guess this should work.
I guess someone will get inspired and come up with a Mastermind or a Wordle variant. I am not sure but I think that quite some time back someone even posted a Wordle implementation here in the forum - can't remember if it was Mathcad or Prime. Given that at that time Prime had no scripted controls I suspect it was written in Mathcad.
EDIT: Found the thread. Was already Prime, but not the implementation of the game itself -> Wordle - PTC Community
So you won't know the variables used unless you click on the controls and then look at their input variables, and by that point you should intuitively know you're a cheater.
Because Prime doesn't have area labels (hopefully it will one day), I thought that I'd put a note on what this protected area was so people don't think it's part of the game that they need to look into it.
I actually plan to develop another game before the submission deadline, and that will use very extensive use of protected areas, including putting controls in (sometimes expanded) protected areas. You can't globally define advanced controls, which would have been a big help for this use case and also Bulls and Cows and would help with the some of the cheating problems, which is why I came up with the workaround with pressing the confirmation buttons.
It's not a community challenge if you didn't have to come up with some fun workarounds. 😛
Ah yes! Putting the output text component in a not-collapsed protected area should solve the problem much easier!
Which we could put a button there, too, which could still be operated.
Whats really needed are true global variables and not global constants as we have now.
I tried to create a simple TicTacToe made out of 9 buttons, but I would need a method to make sure that the upper left button also gets the information when the lower left is pressed.
Only workaround I can think of is to let the buttons read from and write to a local file. But thats pretty inefficient and it not nice to create files (possibly without the user knowing ut), you my run into troubles when the sheet is on a write protected device and its not possible to clean up delete the file from within Prime.
The option to make the input in one place and show the game below it is not really convincing and satisfactory.
I fear that Prime is not (yet?) at a level where it could be used to create reasonably good and user-friendly games.
Some features missing for that sure would also be very handy at more serious worksheets.
Here's another workaround that would work for tic-tac-toe specifically, but wouldn't work for something like Three Men's Morris.
Tic-tac-toe specifically can be laid out linearly and without iterating on the same board because you know there is a maximum of nine turns it can take. What you can do is have a definition for each of the nine spots on the board, and have the user input which spot they want their letter on. You have an output after each turn that visually represents the state of the board, for a total of nine outputs. That way it's also a satisfactory game experience because you're offering the player(s) a "game state history". So turn 1 the board has one letter, turn 2 is below that and will have two letters because you define each turn's choice individually and just have the player select which they want. Have some kind of check in place so players can't place their letter on an already-picked spot. I think radio buttons would be the best advanced control for this because you can have "add button" only add buttons for not-already-selected spots on the board.
I figured out from MOO that Mathcad is not good at iterating off stored knowledge, because Mathcad will overwrite what happened before every time you iterate. One of the things I wanted to do was have Mathcad spit out a table of your guess history and the bull/cow/nil feedback, but I couldn't get it to work. I think there IS a way for it to work, but it probably requires external files and/or using the API, and I wasn't prepared to put in the effort to learn how to do that. Instead I made it a "tip" for people to track that manually with a text region, which I don't think is a bad solution and it might even enrich the game experience by helping players better internalise their results and actually take proper notes of their deductions.
The point is that in game design, there are three ways to get through a hurdle. One is to figure it out; another is to do a workaround; and a third is to change the design of what you're doing to make the hurdle more of a moot point.
Mathcad Prime should be relatively good at games that you can represent linearly as opposed to iteratively because of its top-to-bottom nature. That still leaves plenty of reasonably good games that can be designed. If I didn't think so, I wouldn't open up this challenge... and for three months at that.
Edit: I'm not gonna make that tic-tac-toe game myself but I totally could. If someone else wants to then please feel free and I'd be happy to accept it in the gallery.
Thanks for the detailed answer.
What I had in mind when I was talking about TicTacToe was to arrange nine buttons scaled to squares which form the game board. The user could press a button and its initially empty display changes to the users symbol (X or O). Then the opponent (either human or a Prime algorithm) would make its draw. But all using the very same game board.
Doing the input in one place and seeing the result in another I consider not acceptable for a game of this type. Also having to press an extra button to go on with the next move is not user-friendly (that a drawback of the bulls and cows).
It may be possible to do the TicTacToe as outlined before using an external file (we can delete the file from within a JScript script at the end), but the buttons in Prime ever so often "blow up" when pressed (showing the + sign for their inputs or showing the left hand output side when clicked somewhere at their border) hard to make it small again so its a quite ugly experience and the game board is destroyed when this happens..
The aim must be for the program to be user-friendly and intuitive to use and not somehow cumbersome, because that's no fun.
The tedious operation of a program is perhaps accepted when it comes to a calculation sheet in the engineering field (you have no choice), but not in a game. And the improvements that would be necessary in Prime to make games work properly would be so desirable for serious applications as well.
Soooo what happened to "I actually plan to develop another game before the submission deadline"?
Well, I would like to release it by tomorrow because the Advanced Controls Crash Course (airing tomorrow) will bring some people to this thread.
But I don't think I'll be able to do that because while I'm done developing the game (as of last night), I need to... take some time beta-testing it (and finding willing PTC employees willing to test it too). That's particularly important because the game I've made is an escape room, so while I know the logic behind all of the puzzles because I made them, if no one else could possibly figure it out, then all is lost.
Two months left for the Game Gallery!
I made a gameplay video for MOO aka Bulls and Cows for the Mathcad YouTube channel. It's a long video because I play it twice (one for non-duplicate mode and one for duplicate mode).
Unlike my game, it should take less than a month to make gameplay videos for future non-mine entrants.
I'm excited to transform the Mathcad YouTube channel into a gaming channel.