Here are some code snippets, written by me.
Coding Puzzles:
2. The C# function Fib returns the n’th number in the Fibonacci sequence. The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is, F(0) = 0, F(1) = 1F(N) = F(N - 1) + F(N - 2), for N > 1. This is a solution to this online puzzle.
3. The C# function NextGreaterElement returns the solution to this puzzle:
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums2. The Next Greater Number of a number x in nums1 is the first greater number to its right in nums2. If it does not exist, output -1 for this number.
Example :
Input: nums1 = [4,1,2], nums2 = [1,3,4,2].
Output: [-1,3,-1]
Explanation: For number 4 in the first array, you cannot find the next greater number for it in the second array, so output -1. For number 1 in the first array, the next greater number for it in the second array is 3. For number 2 in the first array, there is no next greater number for it in the second array, so output -1.
Idle Chess Story Scripts:
This script was used on the final version of Idle Chess Story, a game I developed in 2019.
1. The C# function CalculateFideMMRChange is used in the game to calculate the rating change when a player beats another player in a match. It follows the Elo rating system supported by the FIDE.
2. The C# function SpawnFriendlyNPC is used to spawn friendly units on the player’s side of the chess board.
Chilly Bits NFTs Scripts:
This script was used to generate art for The Chilly Bits NFT collection:
1. The C# function RandomizeAttribute is used to give a Chilly Bit a random attribute, such as a hat, or a beak, or an accessory.
Retro Karting 22 Scripts:
This script was used in the final version of Retro Karting 22, a game I developed in 2022.
The C# script Kartcontroller allows the user to control the player driven kart.