I am starting work on a project I have wanted to undertake for some time. It will involve writing an application that connects to an Arduino thru bluetooth to retrieve playing cards that have been selected either manually or thru the randomizing feature of this app.
The main database will house all the “Kingdom” cards of the game Dominion, currently about 350 unique cards. This will include which expansion set the card is from, the cost of the card, card type, etc. In the settings I will be able to set the parameters of the randomized set such as “only select cards from these sets”, “select zero Attack cards”, etc. Most of the parameters I am thinking about can be found in many Dominion Randomizing apps such as Jack of all Dominion and Dominion Picker. The major addition to this app will be once the randomized kingdom is displayed I can press a “Deploy Kingdom”. This will send the needed coordinates to the Arduino to retrieve the selected cards or to restore them at the end of play.
The main elements I want the app to perform is a highly customizable randomization of cards as well as the ability to store a displayed Kingdom for use later.
The purpose of this post is to find out if this level of data handling and storage can be achieved with App Inventor or if I will need to code in Android Studio. If this can be accomplished in App Invertor are there tutorial/examples I can use as a jumping off point?
So with no parameters set the app can randomly select any 10 cards from all 350. But if the use wants to play with a set built from 3 selected sets, then the app would still pull 10 cards but from a smaller pool of cards (cards from those sets). Or the user may want to build a Kingdom with 2 attack cards, 3 duration cards, and then 5 randomly selected cards.
Can I use queries to create the limited group of qualifying cards for the app to randomly pull from?
How would I handle when one card belongs in multiple lists? For example Militia would be in the Base Set list and the Attack list. Would the block know to not select duplicate cards from different lists?
Yes. If you have not coded with App Inventor 2 before, the following might be helpful
Here are some resources to help you learn to use the AI2 tools A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
Thank you very much for the useful feedback and pointing me to the tutorials and research information. Let me dig into these and see how much I can figure out and then when I run into a roadblock hopefully I can phrase my question(s) much more specifically.
Ok, so I was able to do a little building and have data moving from one place to another. My main data source is a Google Sheet with all of the cards named, the set they are from, and some other details. For now I am focusing on getting the cards to appear as I would like and trying to narrow my selection. Here is the link to the Google Sheet.
So right now I have got things set to where I can press a button and I get a random list of 10 cards from the entire list in the Google sheet. So my first tasks are these…
The list that is generated has a open bracket at the first card, a closed bracket at the last card, and each individual card are in quotes. I’d like to get the random cards to display without the brackets or quotes.
At times I’ve seen duplicates in the list. So I need to figure out how to make sure the random set of 10 contain no duplicates
This is my real challenge at this point. I want to be able to set parameters so I could say I’m only wanting cards from Prosperity and Dark Ages and my random set of 10 will only pull cards from those sets based on the Google Sheet.
I’m not sure how to share, or if it is possible, to share my AI2 project with the forum to see my structure so far. I may be doing this in the worst possible way.
Just export your project to an aia then drag it in to a post here.
Brackets - sounds like you are putting the return from google sheets into a label. Put it into a list then output the list contents.
Duplicates - When building the list, test if the item you are about to add is in the list (don’t add it if it is) Are you building the lists in the google sheet or on the app?
Specials - this should be just a matter of specifying what you want and from where (vague, I know) but you have them in the list on the google sheet so it is just a matter of either filtering on the sheet or filtering and selecting in the app.
Brackets - I’m putting the results into a list called random. I’ve noticed if I just put one random item from the Global Set I get just the name of the card, which is what I want. But because I need 10 cards I need to make a list and that is where I get the brackets and quotation marks.
I’ll need to figure out the duplicate thing you are recommending.
I’m going over the process in the Build your Own Database that was linked earlier. It looks like that is a process that would work, but I’ll need to wrap my mind around that procedure.
Your sheet would load from a Media text file just fine, and save a lot of web downloads.
See attached.
Also see the duplicate avoidance articles in FAQ Section: Lists