<commit_before>//
//  Page.swift
//  InteractiveStory
//
//  Created by <NAME> on 13.03.17.
//  Copyright © 2017 Closure One. All rights reserved.
//

import Foundation

class Page {
  let story: Story
  
  typealias Choice = (title: String, page: Page)
  
  var firstChoice: Choice?
  var secondChoice: Choice?
  
  init(xStory: Story) {
    story = xStory
  }
  
}

extension Page {
  
  func addChoiceWith(title: String, story: Story) -> Page {
    let page = Page(xStory: story)
    return addChoiceWith(title: title, page: page)
  }
  
  
  func addChoiceWith(title: String, page: Page) -> Page {
    
    switch(firstChoice, secondChoice) {
      case(.some, .some): return page
      case(.none, .none), (.none, .some): firstChoice = (title, page)
      case(.some, .none): secondChoice = (title, page)
    }
    
    return page
  }
  
  
}

struct Adventure {
  static var story: Page {
    let returnTrip = Page(xStory: .returnTrip)
    return returnTrip
  }
  <commit_msg>now page w/ two choices<commit_after>//
//  Page.swift
//  InteractiveStory
//
//  Created by <NAME> on 13.03.17.
//  Copyright © 2017 Closure One. All rights reserved.
//

import Foundation

class Page {
  let story: Story
  
  typealias Choice = (title: String, page: Page)
  
  var firstChoice: Choice?
  var secondChoice: Choice?
  
  init(xStory: Story) {
    story = xStory
  }
  
}

extension Page {
  
  func addChoiceWith(title: String, story: Story) -> Page {
    let page = Page(xStory: story)
    return addChoiceWith(title: title, page: page)
  }
  
  
  func addChoiceWith(title: String, page: Page) -> Page {
    
    switch(firstChoice, secondChoice) {
      case(.some, .some): return page
      case(.none, .none), (.none, .some): firstChoice = (title, page)
      case(.some, .none): secondChoice = (title, page)
    }
    
    return page
  }
  
  
}

struct Adventure {
  static var story: Page {
    let returnTrip = Page(xStory: .returnTrip)
    
    let touchdown = returnTrip.addChoiceWith(title: "Stop and Investigate", story: .touchDown)
    let homeward = returnTrip.addChoiceWith(title: "Continue home to earth", story: .homeward)
    
    return returnTrip
  }
  
{'fraction_non_alphanumeric': 0.11994485294117647, 'fraction_numerical': 0.009191176470588236, 'mean_word_length': 2.646566164154104, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '923406', 'n_tokens_mistral': 764, 'n_tokens_neox': 722, 'n_words': 209}