<commit_before>//
//  ViewController.swift
//  SlotMachine
//
//  Created by <NAME> on 12/30/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

  var firstContainer: UIView!
  var secondContainer: UIView!
  var thirdContainer: UIView!
  var fourthContainer: UIView!
  
  var titleLabel: UILabel!
  
  // Information labels
  var creditsLabel: UILabel!
  var betLabel: UILabel!
  var winnerPaidLabel: UILabel!
  var creditsTitleLabel: UILabel!
  var betTitleLabel: UILabel!
  var winnerPaidTitleLabel: UILabel!
  
  // Buttons in fourth container
  var resetButton: UIButton!
  var betOneButton: UIButton!
  var betMaxButton: UIButton!
  var spinButton: UIButton!
  
  let kMarginForView: CGFloat = 10.0
  let kMarginForSlot:CGFloat = 2.0
  
  let kSixth: CGFloat = 1.0/6.0
  let kThird:CGFloat = 1.0 / 3.0
  let kHalf: CGFloat = 1.0/2.0
  let kEighth: CGFloat = 1.0/8.0
  
  let kNumberOfContainers = 3
  let kNumberOfSlots = 3

  
  override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    self.setupContainerViews()
  }

  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
  }
  
  // IBActions
  func resetButtonPressed(button: UIButton) {
    println("resetButtonPressed")
  }
  
  func setupContainerViews() {
    let viewWidth = self.view.bounds.width - (kMarginForView * 2)
    let viewHeight = self.view.bounds.height * kSixth
    let viewX = self.view.bounds.origin.x + kMarginForView
    var viewY = self.view.bounds.origin.y
    
    self.firstContainer = UIView(frame: CGRect(x: viewX, y: viewY, width: viewWidth, height: viewHeight))
    self.firstContainer.backgroundColor = UIColor.redColor()
    self.view.addSubview(self.firstContainer)
    
    viewY += firstContainer.frame.height
    
    self.secondContainer = UIView(frame: CGRect(x: viewX, y: viewY, width: viewWidth, height: viewHeight * 3))
    self.secondContainer.backgroundColor = UIColor.blackColor()
    self.view.addSubview(self.secondContainer)
    
    viewY += secondContainer.frame.height
    
    self.thirdContainer = UIView(frame: CGRect(x: viewX, y: viewY, width: viewWidth, height: viewHeight))
    self.thirdContainer.backgroundColor = UIColor.lightGrayColor()
    self.view.addSubview(self.thirdContainer)
    
    viewY += thirdContainer.frame.height
    
    self.fourthContainer = UIView(frame: CGRect(x: viewX, y: viewY, width: viewWidth, height: viewHeight))
    self.fourthContainer.backgroundColor = UIColor.blackColor()
    self.view.addSubview(self.fourthContainer)
    
    // Setup Containers
    self.setupFirstContainer(self.firstContainer)
    self.setupSecondContainer(self.secondContainer)
    self.setupThirdContainer(self.thirdContainer)
    self.setupFourthContainer(self.fourthContainer)
  }
  
  func setupFirstContainer(containerView: UIView) {
    self.titleLabel = UILabel()
    self.titleLabel.text = "Super Slots"
    self.titleLabel.textColor = UIColor.yellowColor()
    self.titleLabel.font = UIFont(name: "MarkerFelt-Wide", size: 40)
    self.titleLabel.sizeToFit()
    self.titleLabel.center = CGPoint(x: containerView.frame.width * 0.5, y: containerView.frame.height * 0.5)
    containerView.addSubview(self.titleLabel)
  }
  
  func setupSecondContainer(containerView: UIView) {
    for var containerNumber = 0; containerNumber < kNumberOfContainers; ++containerNumber {
      for var slotNumber = 0; slotNumber < kNumberOfSlots; ++slotNumber {
        var slotImageView = UIImageView()
        
        slotImageView.backgroundColor = UIColor.yellowColor()
        
//        slotImageView.frame = CGRect(x: containerView.bounds.origin.x + (containerView.bounds.size.width * CGFloat(containerNumber) * kThird), y: containerView.bounds.origin.y + (containerView.bounds.size.height * CGFloat(slotNumber) * kThird), width: containerView.bounds.width * kThird - kMarginForSlot, height: containerView.bounds.height * kThird - kMarginForSlot)
    
        slotImageView.frame = CGRect(x: containerView.bounds.origin.x + kMarginForSlot + ((containerView.bounds.size.width - kMarginForSlot) * CGFloat(containerNumber) / CGFloat(kNumberOfContainers)), y: containerView.bounds.origin.y + kMarginForSlot + ((containerView.bounds.size.height - kMarginForSlot) * CGFloat(slotNumber) / CGFloat(kNumberOfSlots)), width: (containerView.bounds.width - kMarginForSlot) / CGFloat(kNumberOfContainers) - kMarginForSlot, height: (containerView.bounds.height - kMarginForSlot) / CGFloat(kNumberOfSlots) - kMarginForSlot)
        
        containerView.addSubview(slotImageView)
      }
    }
  }
  
  func setupThirdContainer(containerView: UIView) {
    
    func setupLabel(label: UILabel, position: Int, size: Int) {
      var zeros = ""
      label.text = zeros.stringByPaddingToLength(size, withString: "0", startingAtIndex: 0)
      label.textColor = UIColor.redColor()
      label.font = UIFont(name: "Menlo-Bold", size: 16)
      label.sizeToFit()
      label.center = CGPoint(x: containerView.frame.width * kSixth * CGFloat(position * 2+1), y: containerView.frame.height * kThird)
      label.textAlignment = .Center
      label.backgroundColor = UIColor.darkGrayColor()
      containerView.addSubview(label)
    }
  
    func setupStaticLabel(label: UILabel, text: String, position: Int) {
      label.text = text
      label.textColor = UIColor.blackColor()
      label.font = UIFont(name: "AmericanTypewriter", size: 14)
      label.sizeToFit()
      label.center = CGPoint(x: containerView.frame.width * kSixth * CGFloat(position * 2+1), y: containerView.frame.height * kThird * 2)
      containerView.addSubview(label)
    }
    
    self.creditsLabel = UILabel()
    self.betLabel = UILabel()
    self.winnerPaidLabel = UILabel()
    
    setupLabel(self.creditsLabel, 0, 6)
    setupLabel(self.betLabel, 1, 4)
    setupLabel(self.winnerPaidLabel, 2, 6)
    
    self.creditsTitleLabel = UILabel()
    self.betTitleLabel = UILabel()
    self.winnerPaidTitleLabel = UILabel()
    
    setupStaticLabel(self.creditsTitleLabel, "Credits", 0)
    setupStaticLabel(self.betTitleLabel, "Bet", 1)
    setupStaticLabel(self.winnerPaidTitleLabel, "Winner Paid", 2)
    
  }
  
  func setupFourthContainer (containerView: UIView) {
    self.resetButton = UIButton()
    self.resetButton.setTitle("Reset", forState: .Normal)
    self.resetButton.setTitleColor(UIColor.blueColor(), forState: .Normal)
    self.resetButton.titleLabel?.font = UIFont(name: "Superclarendon-Bold", size: 12)
    self.resetButton.backgroundColor = UIColor.lightGrayColor()
    self.resetButton.sizeToFit()
    self.resetButton.center = CGPoint(x: containerView.frame.width * kEighth, y: containerView.frame.height * kHalf)
    self.resetButton.addTarget(self, action: "resetButtonPressed:", forControlEvents: .TouchUpInside)
    containerView.addSubview(self.resetButton)
  }
}
<commit_msg>Added betOneButton<commit_after>//
//  ViewController.swift
//  SlotMachine
//
//  Created by <NAME> on 12/30/14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

  var firstContainer: UIView!
  var secondContainer: UIView!
  var thirdContainer: UIView!
  var fourthContainer: UIView!
  
  var titleLabel: UILabel!
  
  // Information labels
  var creditsLabel: UILabel!
  var betLabel: UILabel!
  var winnerPaidLabel: UILabel!
  var creditsTitleLabel: UILabel!
  var betTitleLabel: UILabel!
  var winnerPaidTitleLabel: UILabel!
  
  // Buttons in fourth container
  var resetButton: UIButton!
  var betOneButton: UIButton!
  var betMaxButton: UIButton!
  var spinButton: UIButton!
  
  let kMarginForView: CGFloat = 10.0
  let kMarginForSlot:CGFloat = 2.0
  
  let kSixth: CGFloat = 1.0/6.0
  let kThird:CGFloat = 1.0 / 3.0
  let kHalf: CGFloat = 1.0/2.0
  let kEighth: CGFloat = 1.0/8.0
  
  let kNumberOfContainers = 3
  let kNumberOfSlots = 3

  
  override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    self.setupContainerViews()
  }

  override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
  }
  
  // IBActions
  func resetButtonPressed(button: UIButton) {
    println("resetButtonPressed")
  }
  
  func betOneButtonPressed (button: UIButton) {
    println(button)
  }
  
  func setupContainerViews() {
    let viewWidth = self.view.bounds.width - (kMarginForView * 2)
    let viewHeight = self.view.bounds.height * kSixth
    let viewX = self.view.bounds.origin.x + kMarginForView
    var viewY = self.view.bounds.origin.y
    
    self.firstContainer = UIView(frame: CGRect(x: viewX, y: viewY, width: viewWidth, height: viewHeight))
    self.firstContainer.backgroundColor = UIColor.redColor()
    self.view.addSubview(self.firstContainer)
    
    viewY += firstContainer.frame.height
    
    self.secondContainer = UIView(frame: CGRect(x: viewX, y: viewY, width: viewWidth, height: viewHeight * 3))
    self.secondContainer.backgroundColor = UIColor.blackColor()
    self.view.addSubview(self.secondContainer)
    
    viewY += secondContainer.frame.height
    
    self.thirdContainer = UIView(frame: CGRect(x: viewX, y: viewY, width: viewWidth, height: viewHeight))
    self.thirdContainer.backgroundColor = UIColor.lightGrayColor()
    self.view.addSubview(self.thirdContainer)
    
    viewY += thirdContainer.frame.height
    
    self.fourthContainer = UIView(frame: CGRect(x: viewX, y: viewY, width: viewWidth, height: viewHeight))
    self.fourthContainer.backgroundColor = UIColor.blackColor()
    self.view.addSubview(self.fourthContainer)
    
    // Setup Containers
    self.setupFirstContainer(self.firstContainer)
    self.setupSecondContainer(self.secondContainer)
    self.setupThirdContainer(self.thirdContainer)
    self.setupFourthContainer(self.fourthContainer)
  }
  
  func setupFirstContainer(containerView: UIView) {
    self.titleLabel = UILabel()
    self.titleLabel.text = "Super Slots"
    self.titleLabel.textColor = UIColor.yellowColor()
    self.titleLabel.font = UIFont(name: "MarkerFelt-Wide", size: 40)
    self.titleLabel.sizeToFit()
    self.titleLabel.center = CGPoint(x: containerView.frame.width * 0.5, y: containerView.frame.height * 0.5)
    containerView.addSubview(self.titleLabel)
  }
  
  func setupSecondContainer(containerView: UIView) {
    for var containerNumber = 0; containerNumber < kNumberOfContainers; ++containerNumber {
      for var slotNumber = 0; slotNumber < kNumberOfSlots; ++slotNumber {
        var slotImageView = UIImageView()
        
        slotImageView.backgroundColor = UIColor.yellowColor()
        
//        slotImageView.frame = CGRect(x: containerView.bounds.origin.x + (containerView.bounds.size.width * CGFloat(containerNumber) * kThird), y: containerView.bounds.origin.y + (containerView.bounds.size.height * CGFloat(slotNumber) * kThird), width: containerView.bounds.width * kThird - kMarginForSlot, height: containerView.bounds.height * kThird - kMarginForSlot)
    
        slotImageView.frame = CGRect(x: containerView.bounds.origin.x + kMarginForSlot + ((containerView.bounds.size.width - kMarginForSlot) * CGFloat(containerNumber) / CGFloat(kNumberOfContainers)), y: containerView.bounds.origin.y + kMarginForSlot + ((containerView.bounds.size.height - kMarginForSlot) * CGFloat(slotNumber) / CGFloat(kNumberOfSlots)), width: (containerView.bounds.width - kMarginForSlot) / CGFloat(kNumberOfContainers) - kMarginForSlot, height: (containerView.bounds.height - kMarginForSlot) / CGFloat(kNumberOfSlots) - kMarginForSlot)
        
        containerView.addSubview(slotImageView)
      }
    }
  }
  
  func setupThirdContainer(containerView: UIView) {
    
    func setupLabel(label: UILabel, position: Int, size: Int) {
      var zeros = ""
      label.text = zeros.stringByPaddingToLength(size, withString: "0", startingAtIndex: 0)
      label.textColor = UIColor.redColor()
      label.font = UIFont(name: "Menlo-Bold", size: 16)
      label.sizeToFit()
      label.center = CGPoint(x: containerView.frame.width * kSixth * CGFloat(position * 2+1), y: containerView.frame.height * kThird)
      label.textAlignment = .Center
      label.backgroundColor = UIColor.darkGrayColor()
      containerView.addSubview(label)
    }
  
    func setupStaticLabel(label: UILabel, text: String, position: Int) {
      label.text = text
      label.textColor = UIColor.blackColor()
      label.font = UIFont(name: "AmericanTypewriter", size: 14)
      label.sizeToFit()
      label.center = CGPoint(x: containerView.frame.width * kSixth * CGFloat(position * 2+1), y: containerView.frame.height * kThird * 2)
      containerView.addSubview(label)
    }
    
    self.creditsLabel = UILabel()
    self.betLabel = UILabel()
    self.winnerPaidLabel = UILabel()
    
    setupLabel(self.creditsLabel, 0, 6)
    setupLabel(self.betLabel, 1, 4)
    setupLabel(self.winnerPaidLabel, 2, 6)
    
    self.creditsTitleLabel = UILabel()
    self.betTitleLabel = UILabel()
    self.winnerPaidTitleLabel = UILabel()
    
    setupStaticLabel(self.creditsTitleLabel, "Credits", 0)
    setupStaticLabel(self.betTitleLabel, "Bet", 1)
    setupStaticLabel(self.winnerPaidTitleLabel, "Winner Paid", 2)
    
  }
  
  func setupFourthContainer (containerView: UIView) {
    self.resetButton = UIButton()
    self.resetButton.setTitle("Reset", forState: .Normal)
    self.resetButton.setTitleColor(UIColor.blueColor(), forState: .Normal)
    self.resetButton.titleLabel?.font = UIFont(name: "Superclarendon-Bold", size: 12)
    self.resetButton.backgroundColor = UIColor.lightGrayColor()
    self.resetButton.sizeToFit()
    self.resetButton.center = CGPoint(x: containerView.frame.width * kEighth, y: containerView.frame.height * kHalf)
    self.resetButton.addTarget(self, action: "resetButtonPressed:", forControlEvents: .TouchUpInside)
    containerView.addSubview(self.resetButton)
    
    self.betOneButton = UIButton()
    self.betOneButton.setTitle("Bet One", forState: UIControlState.Normal)
    self.betOneButton.setTitleColor(UIColor.blueColor(), forState: UIControlState.Normal)
    self.betOneButton.titleLabel?.font = UIFont(name: "Superclarendon-Bold", size: 12)
    self.betOneButton.backgroundColor = UIColor.greenColor()
    self.betOneButton.sizeToFit()
    self.betOneButton.center = CGPoint(x: containerView.frame.width * 3 * kEighth, y: containerView.frame.height * kHalf)
    self.betOneButton.addTarget(self, action: "betOneButtonPressed:", forControlEvents: UIControlEvents.TouchUpInside)
    containerView.addSubview(self.betOneButton)
  }
}

{'fraction_non_alphanumeric': 0.10802385470317159, 'fraction_numerical': 0.009013282732447819, 'mean_word_length': 3.830441898527005, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '103548', 'n_tokens_mistral': 4914, 'n_tokens_neox': 4747, 'n_words': 917}