Logarithm

From Fancade Wiki
Revision as of 19:08, 16 May 2024 by Nikitaivanov (talk | contribs) (Created page with "Outputs the logarithm of a number by a given base. File:Logarithm1.png Inputs * Number: The target number * Base: The base to raise (defaults to [*e*](https://en.wikipedia.org/wiki/E_(mathematical_constant)) if unwired) Outputs * Logarithm: The Exponent in the (Base ^ Exponent = Number) == Notes == Logarithm is used as an inverse function for the function Power. This function is most commonly used for board game AIs. If you manage to learn how to make an AI,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Outputs the logarithm of a number by a given base.

File:Logarithm1.png

Inputs

Outputs

  • Logarithm: The Exponent in the (Base ^ Exponent = Number)

Notes

Logarithm is used as an inverse function for the function Power. This function is most commonly used for board game AIs. If you manage to learn how to make an AI, this function will be surely handy for you!

Examples

If you're looking for examples, surely all examples for this is complex. The simplest example is that you can compute a number's length by plugging 10 into the base and flooring it, and finally by adding 1.

File:Get num length.png

Logarithm is such an advanced function to be common in simple games. But if you really want to see how it can be used, one example is Sounak9434's [*MCTS Engine*](https://play.fancade.com/5E5924F7B97E2368), a type of AI used for board games.

  • Logarithm is used in the MCTS Engine as a function to find the best possible moves the AI can execute in the set of given possible moves and the players possible moves in the game.
  • *MCTS Engine* is made before the logarithm function is implemented. The function that was used before in the MCTS engine is a custom script made by Potato Chan.