Skip to content

v2.0.0

Latest

Choose a tag to compare

@ihs7 ihs7 released this 13 Sep 21:58
· 1 commit to main since this release

Version 2

🎯 Major Rewrite: Functional API

v2.0.0 introduces a complete rewrite with a functional API that replaces the previous class-based approach.

✨ New Features

  • Simple function calls replace multi-step class setup
  • Strong TypeScript typing enforces minimum 2 teams at compile time
  • Pure functions for better testing and functional programming patterns
  • Multi-team matches with dedicated calculateMultiTeamMatch() function

πŸ’₯ Breaking Changes

  • Classes removed: Duel, FreeForAll, TeamMatch, Player classes β†’ replaced with functions
  • API simplified: calculateDuel(), calculateFreeForAll(), calculateTeamMatch()
  • Player objects: new Player(id, rating) β†’ { id, rating } plain objects
  • Team scoring: rank parameter β†’ score parameter (higher score = better performance)
  • Expected score: player.expectedScoreAgainst() β†’ calculateExpectedScore() function

πŸ“¦ Migration

See MIGRATION_v2.md for detailed migration examples.

Before (v1):

const match = new Duel();
match.addPlayer(new Player("p1", 1200), true);
match.addPlayer(new Player("p2", 1320), false);
const results = match.calculate();

After (v2):

const results = calculateDuel(
  { id: "p1", rating: 1200 }, // winner
  { id: "p2", rating: 1320 }  // loser
);

Full Changelog: v1...v2.0.0