(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:wordlib) op: Equal rhs: {(DQ (/usr/lib/games/long-words.txt))} spids: [10] ) ] spids: [10] ) (FuncDef name: scrambleword body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:match) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(randomquote)} {($ VSub_Name '$wordlib')})] ) left_token: <Left_CommandSub '$('> spids: [34 38] ) ) } spids: [32] ) ] spids: [32] ) (C {(echo)} {(DQ ('Picked out a word!'))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:len) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$match')}) (C {(wc)} {(-c)}) (C {(sed)} {(SQ <'s/[^[:digit:]]//g'>)}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [52 70] ) } spids: [51] ) ] spids: [51] ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:scrambled) op:Equal rhs:{(DQ )} spids:[73])] spids: [73] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:lastval) op:Equal rhs:{(1)} spids:[78])] spids: [78] ) (ForExpr init: (BinaryAssign op_id: Arith_Equal left: (LhsName name:val) right: (ArithWord w:{(Lit_Digits 1)}) ) cond: (ArithBinary op_id: Arith_Less left: (ArithWord w:{($ VSub_Name '$val')}) right: (ArithWord w:{($ VSub_Name '$len')}) ) body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} { (ArithSubPart anode: (ArithBinary op_id: Arith_Percent left: (ArithWord w:{($ VSub_Name '$RANDOM')}) right: (ArithWord w:{(Lit_Digits 2)}) ) spids: [112 119] ) } {(-eq)} {(1)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scrambled) op: Equal rhs: {($ VSub_Name '$scrambled') (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$match')}) (C {(cut)} {(-c) ($ VSub_Name '$val')}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [134 145] ) } spids: [132] ) ] spids: [132] ) ] spids: [16777215 129] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:scrambled) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$match')}) (C {(cut)} {(-c) ($ VSub_Name '$val')}) ] negated: F ) ] ) left_token: <Left_CommandSub '$('> spids: [152 163] ) ($ VSub_Name '$scrambled') } spids: [151] ) ] spids: [151] ) ] spids: [148 167] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:val) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name '$val')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [171 180] ) } spids: [170] ) ] spids: [170] ) ] spids: [105 183] ) ) ] spids: [20] ) spids: [16 19] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-r)} {($ VSub_Name '$wordlib')} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} {(DQ ($ VSub_Number '$0') (': Missing word library ') ($ VSub_Name '$wordlib'))} ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (SimpleCommand words: [ {(echo)} {(DQ ('(online: http://www.intuitive.com/wicked/examples/long-words.txt'))} ] redirects: [(Redir op:<Redir_GreatAnd '>&'> fd:16777215 arg_word:{(2)})] ) (SimpleCommand words: [ {(echo)} {(DQ ('save the file as ') ($ VSub_Name '$wordlib') (" 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 202] ) ] spids: [16777215 243] ) (CommandList children: [ (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:newgame) op:Equal rhs:{(DQ )} spids:[246])] spids: [246] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:guesses) op:Equal rhs:{(0)} spids:[251])] spids: [251] ) terminator: <Op_Semi ';'> ) (Sentence child: (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:correct) op:Equal rhs:{(0)} spids:[255])] spids: [255] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:total) op:Equal rhs:{(0)} spids:[259])] spids: [259] ) ] ) (WhileUntil keyword: <KW_Until until> cond: [ (Sentence child: (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$guess'))} {(Lit_Other '=')} {(DQ (quit))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (C {(scrambleword)}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('You need to unscramble: ') ($ VSub_Name '$scrambled'))}) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:guess) op: Equal rhs: {(DQ ('??'))} spids: [305] ) ] spids: [305] ) terminator: <Op_Semi ';'> ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:guesses) op:Equal rhs:{(0)} spids:[312])] spids: [312] ) (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: [317 326] ) } spids: [316] ) ] spids: [316] ) (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 (quit))} {(-a)} {(DQ ($ VSub_Name '$guess'))} {(KW_Bang '!') (Lit_Other '=')} {(DQ (next))} {(Lit_Other ']')} ) ] body: (DoGroup children: [ (C {(echo)} {(DQ )}) (C {(/bin/echo)} {(-n)} {(DQ ('Your guess (quit|next) : '))}) (C {(read)} {(guess)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$guess'))} {(Lit_Other '=')} {(DQ ($ VSub_Name '$match'))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:guesses) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name '$guesses')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [422 431] ) } spids: [421] ) ] spids: [421] ) (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ('*** You got it with tries = ') (${ VSub_Name guesses) ('! Well done!! ***') ) } ) (C {(echo)} {(DQ )}) (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: [459 468] ) } spids: [458] ) ] spids: [458] ) ] spids: [16777215 418] ) (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 ('The unscrambled word was ') (EscapedLiteralPart token: <Lit_EscapedChar '\\"'> ) ($ VSub_Name '$match') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ('. Your tries: ') ($ VSub_Name '$guesses') ) } ) ] spids: [471 501] ) ] else_action: [ (C {(echo)} {(DQ ("Nope. That's not the unscrambled word. Try again."))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:guesses) op: Equal rhs: { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name '$guesses')}) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [527 536] ) } spids: [526] ) ] spids: [526] ) ] spids: [516 539] ) ] spids: [375 542] ) ) ] spids: [282 544] ) ) (C {(echo)} { (DQ ('Done. You correctly figured out ') ($ VSub_Name '$correct') (' out of ') ($ VSub_Name '$total') (' scrambled words.') ) } ) (ControlFlow token:<ControlFlow_Exit exit> arg_word:{(0)}) ] )