Yeah, me neither. Copy an paste is not that easy. Here again:
https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/routing/util/CarFlagEncoder.java
https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/car.lua
https://github.com/abrensch/brouter/blob/master/misc/profiles2/car-eco.brf
https://github.com/osmandapp/OsmAnd-resources/blob/master/routing/routing.xml
Just take a look at the one of the linked documents. It is not that difficult. Staying with OsmAnd it has an explanation starting at line 45. In general the router calculates the “costs” of the route or a segment. There might be multipliers (line 135) or some fix values (line 164) to influence the calculated costs. The least expensive way is chosen. The real values start at line 381.