This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1-neuron N-inputs 1-output perceptron in c++ (Binary classifier) | |
//Training data is for AND but you edit it to what you want the Perceptron to learn | |
//Short and sweet with lots of comments | |
#include <stdio.h> | |
#define dataLenght 4 | |
#define numOfInputs 2 | |
#define trainTimes 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Perlin { | |
public int repeat; | |
public Perlin(int repeat = -1) { | |
this.repeat = repeat; | |
} | |
public double OctavePerlin(double x, double y, double z, int octaves, double persistence) { | |
double total = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Print digits of pi using the Leibniz formula: pi = 4 * (1 -1/3 +1/5 -1/7 ....) | |
#include <stdio.h> | |
#define NumType long double | |
int main(){ | |
NumType d = 1.0; | |
NumType f = 0.0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Images, example and guide at : https://github.com/lukakostic/Random-Infinite-2DTerrain | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
[RequireComponent(typeof(PolygonCollider2D))] | |
[RequireComponent(typeof(LineRenderer))] | |
public class RandomTerrain2D : MonoBehaviour { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//More random version of UnityEngine.Random | |
//Just replace Random with MoreRandom in your code and thats it | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using System; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Solving this: | |
#https://www.youtube.com/watch?v=uCsD3ZGzMgE | |
#by iteration and not math | |
def JosephusProblem(n): | |
people = list(range(1,n+1)) | |
i = 0 |
NewerOlder