(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:db)
          op: Equal
          rhs: {(DQ (/usr/lib/games/state.capitals.txt))}
          spids: [10]
        )
      ]
      spids: [10]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(KW_Bang '!')} {(-r)} {(DQ ($ VSub_Name '$db'))} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (SimpleCommand
              words: [
                {(echo)}
                {(DQ ($ VSub_Number '$0') (": Can't open ") ($ VSub_Name '$db') (' for reading.'))}
              ]
              redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (SimpleCommand
              words: [
                {(echo)}
                {(DQ ('(get http://www.intuitive.com/wicked/examples/state.capitals.txt'))}
              ]
              redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (SimpleCommand
              words: [
                {(echo)}
                {(DQ ('save the file as ') ($ VSub_Name '$db') (" and you're ready to play!)"))}
              ]
              redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})]
            )
            (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(1)})
          ]
          spids: [16777215 35]
        )
      ]
      spids: [16777215 77]
    )
    (CommandList
      children: [
        (Sentence
          child: 
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:guesses) op:Equal rhs:{(0)} spids:[80])]
              spids: [80]
            )
          terminator: <Op_Semi ';'>
        )
        (Sentence
          child: 
            (Assignment
              keyword: Assign_None
              pairs: [(assign_pair lhs:(LhsName name:correct) op:Equal rhs:{(0)} spids:[84])]
              spids: [84]
            )
          terminator: <Op_Semi ';'>
        )
        (Assignment
          keyword: Assign_None
          pairs: [(assign_pair lhs:(LhsName name:total) op:Equal rhs:{(0)} spids:[88])]
          spids: [88]
        )
      ]
    )
    (WhileUntil
      keyword: <KW_While while>
      cond: [
        (Sentence
          child: 
            (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$guess'))} {(KW_Bang '!') (Lit_Other '=')} 
              {(DQ (quit))} {(Lit_Other ']')}
            )
          terminator: <Op_Semi ';'>
        )
      ]
      body: 
        (DoGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:thiskey)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [(C {(randomquote)} {($ VSub_Name '$db')})]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [118 122]
                        )
                      )
                    }
                  spids: [116]
                )
              ]
              spids: [116]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:state)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [
                                (Pipeline
                                  children: [
                                    (C {(echo)} {($ VSub_Name '$thiskey')})
                                    (C {(cut)} {(-d) (EscapedLiteralPart token:<Lit_EscapedChar '\\ '>)} 
                                      {(-f1)}
                                    )
                                    (C {(sed)} {(SQ <'s/-/ /g'>)})
                                  ]
                                  negated: F
                                )
                              ]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [139 160]
                        )
                      )
                    }
                  spids: [137]
                )
              ]
              spids: [137]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:city)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [
                                (Pipeline
                                  children: [
                                    (C {(echo)} {($ VSub_Name '$thiskey')})
                                    (C {(cut)} {(-d) (EscapedLiteralPart token:<Lit_EscapedChar '\\ '>)} 
                                      {(-f2)}
                                    )
                                    (C {(sed)} {(SQ <'s/-/ /g'>)})
                                  ]
                                  negated: F
                                )
                              ]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [166 187]
                        )
                      )
                    }
                  spids: [164]
                )
              ]
              spids: [164]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:match)
                  op: Equal
                  rhs: 
                    {
                      (DQ 
                        (CommandSubPart
                          command_list: 
                            (CommandList
                              children: [
                                (Pipeline
                                  children: [
                                    (C {(echo)} {($ VSub_Name '$city')})
                                    (C {(tr)} {(SQ <'[:upper:]'>)} {(SQ <'[:lower:]'>)})
                                  ]
                                  negated: F
                                )
                              ]
                            )
                          left_token: <Left_CommandSub '$('>
                          spids: [193 209]
                        )
                      )
                    }
                  spids: [191]
                )
              ]
              spids: [191]
            )
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:guess)
                      op: Equal
                      rhs: {(DQ ('??'))}
                      spids: [214]
                    )
                  ]
                  spids: [214]
                )
              terminator: <Op_Semi ';'>
            )
            (Sentence
              child: 
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:total)
                      op: Equal
                      rhs: 
                        {
                          (ArithSubPart
                            anode: 
                              (ArithBinary
                                op_id: Arith_Plus
                                left: (ArithWord w:{($ VSub_Name '$total')})
                                right: (ArithWord w:{(Lit_Digits 1)})
                              )
                            spids: [222 231]
                          )
                        }
                      spids: [221]
                    )
                  ]
                  spids: [221]
                )
              terminator: <Op_Semi ';'>
            )
            (C {(echo)} {(DQ )})
            (C {(echo)} {(DQ ('What city is the capital of ') ($ VSub_Name '$state') ('?'))})
            (WhileUntil
              keyword: <KW_While while>
              cond: [
                (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$guess'))} {(KW_Bang '!') (Lit_Other '=')} 
                  {(DQ ($ VSub_Name '$match'))} {(-a)} {(DQ ($ VSub_Name '$guess'))} {(KW_Bang '!') (Lit_Other '=')} {(DQ (next))} {(-a)} 
                  {(DQ ($ VSub_Name '$guess'))} {(KW_Bang '!') (Lit_Other '=')} {(DQ (quit))} {(Lit_Other ']')}
                )
              ]
              body: 
                (DoGroup
                  children: [
                    (C {(/bin/echo)} {(-n)} {(DQ ('Answer: '))})
                    (C {(read)} {(guess)})
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$guess'))} {(Lit_Other '=')} 
                                  {(DQ ($ VSub_Name '$match'))} {(-o)} {(DQ ($ VSub_Name '$guess'))} {(Lit_Other '=')} {(DQ ($ VSub_Name '$city'))} {(Lit_Other ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(echo)} {(DQ )})
                            (C {(echo)} {(DQ ('*** Absolutely correct!  Well done! ***'))})
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:correct)
                                  op: Equal
                                  rhs: 
                                    {
                                      (ArithSubPart
                                        anode: 
                                          (ArithBinary
                                            op_id: Arith_Plus
                                            left: (ArithWord w:{($ VSub_Name '$correct')})
                                            right: (ArithWord w:{(Lit_Digits 1)})
                                          )
                                        spids: [375 384]
                                      )
                                    }
                                  spids: [374]
                                )
                              ]
                              spids: [374]
                            )
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:guess)
                                  op: Equal
                                  rhs: {($ VSub_Name '$match')}
                                  spids: [387]
                                )
                              ]
                              spids: [387]
                            )
                          ]
                          spids: [16777215 358]
                        )
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$guess'))} {(Lit_Other '=')} 
                                  {(DQ (next))} {(-o)} {(DQ ($ VSub_Name '$guess'))} {(Lit_Other '=')} {(DQ (quit))} {(Lit_Other ']')}
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(echo)} {(DQ )})
                            (C {(echo)} 
                              {
                                (DQ ($ VSub_Name '$city') (' is the capital of ') 
                                  ($ VSub_Name '$state') (.)
                                )
                              }
                            )
                          ]
                          spids: [391 421]
                        )
                      ]
                      else_action: [(C {(echo)} {(DQ ("I'm afraid that's not correct."))})]
                      spids: [443 453]
                    )
                  ]
                  spids: [310 457]
                )
            )
          ]
          spids: [111 460]
        )
    )
    (C {(echo)} 
      {
        (DQ ('You got ') ($ VSub_Name '$correct') (' out of ') ($ VSub_Name '$total') (' presented.'))
      }
    )
    (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)})
  ]
)