Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 497701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:48:24+00:00 2026-05-13T05:48:24+00:00

Preface: I don’t have experience with rules engines, building rules, modeling rules, implementing data

  • 0

Preface: I don’t have experience with rules engines, building rules, modeling rules, implementing data structures for rules, or whatnot. Therefore, I don’t know what I’m doing or if what I attempted below is way off base.

I’m trying to figure out how to store and process the following hypothetical scenario. To simplify my problem, say that I have a type of game where a user purchases an object, where there could be 1000’s of possible objects, and the objects must be purchased in a specified sequence and only in certain groups. For example, say I’m the user and I want to purchase object F. Before I can purchase object F, I must have previously purchased object A OR (B AND C). I cannot buy F and A at the same time, nor F and B,C. They must be in the sequence the rule specifies. A first, then F later. Or, B,C first, then F later. I’m not concerned right now with the span of time between purchases, or any other characteristics of the user, just that they are the correct sequence for now.

What is the best way to store this information for potentially thousands of objects that allows me to read in the rules for the object being purchased, and then check it against the user’s previous purchase history?

I’ve attempted this, but I’m stuck at trying to implement the groupings such as A OR (B AND C). I would like to store the rules in a database where I have these tables:

 Objects
    (ID(int),Description(char)) 

ObjectPurchRules
    (ObjectID(int),ReqirementObjectID(int),OperatorRule(char),Sequence(int)) 

But obviously as you process through the results, without the grouping, you get the wrong answer. I would like to avoid excessive string parsing if possible :). One object could have an unknown number of previous required purchases. SQL or psuedocode snippets for processing the rules would be appreciated. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:48:25+00:00Added an answer on May 13, 2026 at 5:48 am

    It seems like your problem breaks down to testing whether a particular condition has been satisfied.

    You will have compound conditions.
    So given a table of items:

    ID_Item    Description
    ----------------------
    1          A         
    2          B         
    3          C         
    4          F         
    

    and given a table of possible actions:

    ID_Action  VerbID  ItemID    ConditionID
    ----------------------------------------
    1          BUY     4         1
    

    We construct a table of conditions:

    ID_Condition  VerbA  ObjectA_ID  Boolean  VerbB            ObjectB_ID
    ---------------------------------------------------------------------
    1             OWNS   1           OR       MEETS_CONDITION  2
    2             OWNS   2           AND      OWNS             3
    

    So OWNS means the id is a key to the Items table, and MEETS_CONDITION means that the id is a key to the Conditions table.

    This isn’t meant to restrict you. You can add other tables with quests or whatever, and add extra verbs to tell you where to look. Or, just put quests into your Items table when you complete them, and then interpret a completed quest as owning a particular badge. Then you can handle both items and quests with the same code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

let me preface this by saying I don't really know CSS at all. I'm
** Preface: I don't know much about networking. If i described the set up
To preface, I'm very new to Obj-C but I do have some OOP experience
Preface: I have two entities defined as a one-to-many relationship: A <<-------> B. B's
Preface: I am sure this is incredibly simple, but I have searched this site
Preface: I'm know that in most cases using a volatile field won't yield any
Preface: I don't understand what this does: o => o.ID, i => i.ID, (o,
Preface: If you don't care about the preface, skip down to the section marked
Preface: I am horrible with java, and worse with java ui components. I have
I'll preface this with the fact that I'm new to RoR. I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.