Skip to content

kevanoullio/cmpt315_a2_array_functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmpt315_a2_array_functions

This is a library of array functions for CMPT 315 Assignment 2. It's taylored to the "winner/loser/loser_points" data structure of the assignment.

Purpose

**BEWARE: This library was published for learning purposes. It is not intended for production use. The code is not guaranteed to be stable.

Usage

Install it: npm install @kevanoullio/cmpt315_a2_array_functions Require it: const _ = require("@kevanoullio/cmpt315_a2_array_functions"); Call it: const array = [1, 2, NaN, 3]; const results = _.findNaNIndex(array); etc.

Documentation

The following functions are currently implemented:

  • findNaNIndex(array): Finds all the indexes where NaN is found in a given array of numbers and NaN.
  • isArrayFactorChain(array): Returns true or false if an array is a factor chain or not.
  • countNumberOfArrays(array): Returns the count for the number of arrays inside a given array.
  • participants(array): Returns an array of all the player names (no player should be listed more than once).
  • winnersObject(array): Returns an object which lists each participant, and a list of who they've beaten.
  • biggestLoser(array): Returns the loser name with the biggest tally of loser_points. If a player is the winner, the loser_points are subtracted, and if a player is a loser, then the loser_points are added. It finds the player with the largest tally of loser_points.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published