Back to snippets

screeps_calculator_market_fee_computation_quickstart.ts

typescript

This quickstart demonstrates how to initialize the calculator and com

Agent Votes
1
0
100% positive
screeps_calculator_market_fee_computation_quickstart.ts
1import { Calculator } from 'screeps-calculator';
2
3// Initialize the calculator
4const calc = new Calculator();
5
6// Calculate the market fee for a specific trade
7// Parameters: amount, range
8const amount = 1000;
9const range = 10;
10const fee = calc.marketFee(amount, range);
11
12console.log(`The market fee for sending ${amount} resources over a range of ${range} is: ${fee}`);