Guided Questioning iOS App

I’m making an iPad app that will display a few choices and based on your choice will display a series of questions with each question triggering a different set of questions. I was wondering if there was a name for this or any open-source library that someone has made for this kind of app.

If not, would it be best to hard code all the questions and responses into the app, or to read them from a file?

3

This is a tree.

Your nodes are the questions, and each question has as many children as there are answers to it. Your session context contains the current question, and it leaps forward by asking a new one.

We could also say that this tree is a directed bipartite graph with each question node connecting to multiple answers, and each answer node connecting to exactly one question node.

A good storage would be, for example, XML:

<questions>
<question id='3'>
   How are you?
   <answers>
      <answer next_question_id='4'>Fine, thx</answer>
      <answer next_question_id='5'>Badly</answer>
   </answers>
</question>
<question id='4'>
   Boy or girl?
   <answers>
      <answer next_question_id='8'>Boy</answer>
      <answer next_question_id='9'>Girl</answer>
   </answers>
</question>
<!-- ...-->
</questions>

Or, if you want to keep the tree visualized, you could try YAML:

root:
    title: How are you?
    answers: [
       {
          text: Fine, thx
          next_question: 
               title: Boy or girl?
               answers: [
                   {
                   }
               ]
        }
        {
          text: Badly
        }
    ]

A session might look the following:

So, how it is implemented MVC-wise is a different matter.

You have similar things in adventure games (infocom games) btw, but that’s much more advanced.

Edit: this thing is called a Dialog Tree, and you can find answers on StackExchange as well.

What kind of framework do you really need? A few view controllers, some nicely-laid-out views, and a sensible way to represent the data: you’re done. If you’re having trouble seeing how to write such a thing, I’d suggest that you start by deciding how to organize the data:

  • What’s a question?
  • Are questions organized into groups?
  • How does the answer to one question affect the question that the program asks next?

“Twenty questions”-like programs have been around for decades. Here’s some ancient BASIC source code for Animals. And here’s output, thanks to Jeff Atwood’s article on a similar theme. Back when personal computers were very new, question-and-answer games were some of the first programs that were used widely in classrooms.

Also very old are text-based adventure games where the player is presented with a situation and a number of options. These kinds of programs aren’t very different from the kind of thing you’re describing.

So, all this is to say that the structure of your program is probably going to be pretty simple — I doubt you’ll need a framework to get you there.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật