Giter Site home page Giter Site logo

acftcalculator's Introduction

ACFTCalculator

codecov

ACFTCalculator is a tool, written in Swift, for calculating Army Combat Fitness Test scores.

Installation

Swift Package Manager

Swift Package Manager is built into the Swift toolchain and is the preferred way of integrating.

For Swift package projects, simply add the following line to your Package.swift file in the dependencies section:

dependencies: [
  .package(url: "https://github.com/khaptonstall/ACFTCalculator", .upToNextMajor(from: "<version>")),
]

For app projects, simply follow the Apple documentation on adding package dependencies to your app.

Usage

Each ACFT event is represented by the ACFTEvent enum, where each case has a single associated value representing the value (meters, pounds, repetitions, etc.) recorded for that individual event.

After capturing a value for an individual event, you just need to create an instance of ACFTCalculator and use the calculatePoints(event:) method to obtain the number of points earned.

do {
    let calculator = try ACFTCalculator()
    
    // 3 Repetition Maxium Deadlift (MDL)
    _ = calculator.calculatePoints(for: .threeRepetitionMaximumDeadlift(pounds: 340))
    
    // Standing Power Throw (SPT)
    _ = calculator.calculatePoints(for: .standingPowerThrow(meters: 12.5))
    
    // Hand Release Push-Up - Arm Extension (HRP)
    _ = calculator.calculatePoints(for: .handReleasePushUp(repetitions: 60))
    
    // Sprint-Drag-Carry (SDC)
    _ = calculator.calculatePoints(for: .sprintDragCarry(time: RecordedTime(seconds: 93)))
    
    // Leg Tuck (LTK)
    _ = calculator.calculatePoints(for: .legTuck(repetitions: 20))
    
    // Plank (PLK)
    _ = calculator.calculatePoints(for: .plank(time: RecordedTime(seconds: 260)))
    
    // Two-Mile Run (2MR)
    _ = calculator.calculatePoints(for: .twoMileRun(time: RecordedTime(seconds: 810)))
    
    // Alternate Events
    // 1K Meter Swim
    _ = calculator.calculatePoints(for: .oneThousandMeterSwim(time: RecordedTime(seconds: 1500)))
    
    // 12K Meter Stationary Bike
    _ = calculator.calculatePoints(for: .twelveThousandMeterBike(time: RecordedTime(seconds: 1500)))
        
    // 5K Meter Row
    _ = calculator.calculatePoints(for: .fiveThousandMeterRow(time: RecordedTime(seconds: 1500)))
} catch {
    print(error)
}

When working with events that use time (such as the Two-Mile Run), you'll use the RecordedTime struct, which provides two options for initialization:

// Using RecordedTime(seconds:) creates a non-optional instance:
let recordedTime = RecordedTime(seconds: 60)

// Using RecordedTime(minutes:seconds:) creates an optional instance which returns nil when an invalid seconds value is provided (e.x. seconds > 59):
let nilRecordedTime = RecordedTime(minutes: 1, seconds: 100)
let validOptionalRecordedTime = RecordedTime(minutes: 1, seconds: 59)

Resources

For more information on the Army Combat Fitness Test and individual events, see https://www.army.mil/acft/

The source used to calculate points for each ACFT event can be found at https://www.army.mil/e2/downloads/rv7/acft/acft_scoring_standards.pdf

acftcalculator's People

Contributors

khaptonstall avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.