Skip to content

Instantly share code, notes, and snippets.

@WakkyFree
WakkyFree / CheckPrimeFactors.java
Created February 13, 2016 03:46
This code detects and prints prime numbers of "int number" (Answer of edX UC3Mx: IT.1.1x Introduction to Programming with Java EXAM2)
class CheckPrimeFactors {
public static void main(String args[]) {
int number = 78818740;
int count = 0;
for (int factor = 2; factor <= number; factor++){
while (number % factor == 0){
number = number / factor;
count++;
@WakkyFree
WakkyFree / zybo_top.v
Last active October 23, 2016 02:14
top module for ZYBO to blink LEDs.
module zybo_top(
input CLK,
input RST,
output reg [3:0] LED
);
parameter LED_COUNTER_1SEC = 26'd124999999;
@WakkyFree
WakkyFree / DeleteBall.cs
Last active December 21, 2016 14:25
Unity script to delete a ball
using UnityEngine;
using System.Collections;
public class DeleteBall : MonoBehaviour {
private Rigidbody rig;
// Use this for initialization
void Start () {
rig = this.GetComponent<Rigidbody>();
@WakkyFree
WakkyFree / WallEffect.cs
Created February 25, 2017 01:09
Unity script to add particle effect to walls
using UnityEngine;
using System.Collections;
public class WallEffect : MonoBehaviour {
private ParticleSystem particle;
public int i;
// Use this for initialization
void Start () {
@WakkyFree
WakkyFree / SwingBat.cs
Last active February 27, 2017 11:50
Script for Unity
using UnityEngine;
using System.Collections;
public class SwingBat : MonoBehaviour {
private int r = 12; // Rotation Speed
private int r_sum = 0;
private int r_max = 360;
// Use this for initialization
@WakkyFree
WakkyFree / MovePlayers.cs
Last active May 27, 2017 01:01
Unity script to move a player
using UnityEngine;
using System.Collections;
public class MovePlayer : MonoBehaviour {
private bool d_positive;
private float x;
private float x_sum = 0.0f;
private float x_max = 6.0f;
private float player_x;
@WakkyFree
WakkyFree / SoundBat.cs
Created August 21, 2017 19:18
Unity script to enable sound effects when a bat hits a ball.
using UnityEngine;
using System.Collections;
public class SoundBat : MonoBehaviour {
private AudioSource audioSourceBat;
public AudioClip seBat;
// Use this for initialization
void Start () {
@WakkyFree
WakkyFree / BgmControl.cs
Created March 14, 2018 14:26
Unity script to control BGM
using UnityEngine;
using System.Collections;
public class BgmControl : MonoBehaviour {
public AudioSource myAudioSource;
// Use this for initialization
void Start () {
myAudioSource = GetComponent<AudioSource>();
}
@WakkyFree
WakkyFree / ControlEndText.cs
Last active March 14, 2018 15:31
Unity script to control texts displayed on the scene
using UnityEngine;
using System.Collections;
public class ControlEndText : MonoBehaviour {
public GameObject EndText;
public GameObject RestartButton;
// Use this for initialization
void Start () {
@WakkyFree
WakkyFree / AddScore.cs
Last active April 3, 2018 22:36
Unity script to add score
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class AddScore : MonoBehaviour {
public static int score = 0;
public Text scoreText;
private int highScore = 0;
public Text highScoreText;