Skip to content

Instantly share code, notes, and snippets.

View gist:c8529a53f30606b78a887bb20a3d0d3d
START
{
Boolean rand1;
Boolean rand2;
Boolean rand3;
Boolean rand4;
Boolean rand5;
Boolean ip1==false;
Boolean ip2==false;
Boolean ip3==false;
@tenifni
tenifni / sps_arduinomaze.cpp
Last active Nov 28, 2016
SPS Arduino Code
View sps_arduinomaze.cpp
//©UCLA-SPS 2016
START
{
Boolean rand1;
Boolean rand2;
Boolean rand3;
Boolean rand4;
Boolean rand5;
Boolean ip1==false;
Boolean ip2==false;
@tenifni
tenifni / ntBufferedReader.java
Last active Aug 29, 2015
Note on BufferedReader and length()
View ntBufferedReader.java
import java.io.*;
public class Practive{
public static void main (String[] args){
strmanip();
}
static void strmanip(){
String name ="";
String password="";
try{
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
@tenifni
tenifni / 3WaysToReverse.java
Last active Aug 29, 2015
3 ways to reverse array in Java
View 3WaysToReverse.java
import java.util.Arrays;
public class Practive{
public static void main (String[] args)
{
int [] array = new int[] {23,45,34,54,67,78};
System.out.println("Original array:");
System.out.println(Arrays.toString(array));
//reverse method 1:
int i =0;
while ( i< (array.length)/2){
@tenifni
tenifni / musicplayer_blogspot.html
Last active Aug 29, 2015
Music player on Blogspot
View musicplayer_blogspot.html
<span style="color:#808080;"><h4><a href="http://scarlettyusj.blogspot.com/2015/01/music-benvenutowelcome-by-premio-sciacca.html">Benvenuto (Premiosciacca) </a></h4> </span>
<p>
<audio controls>
<source src="https://sites.google.com/site/indecisivefin/home/Track2.mp3?revision=1" type="audio/ogg">
<source src="https://sites.google.com/site/indecisivefin/home/Track2.mp3?revision=1" type="audio/mpeg">
</source></source></audio></p>
@tenifni
tenifni / guessinggame.java
Last active Aug 29, 2015
[Game] Java Guessing Game. Randomly creates an integer between 1~1000. User tries to guess the number.
View guessinggame.java
import java.util.Random;
import java.util.Scanner;
public class Practive{
public static void main (String[] args){
Random rand = new Random();
int numberToGuess = rand.nextInt(1000);
int numberOfTries = 0;
Scanner input = new Scanner (System.in);
int guess;
@tenifni
tenifni / 21sticks_ver1.java
Last active Aug 29, 2015
[Game] 21 Sticks. Rules of game: start with 21 sticks, and two players take turns either taking one or two sticks. The player who takes the last stick loses. [simplified: no mis-numbering prevention; no player distinction]
View 21sticks_ver1.java
import java.util.Scanner;
public class Practive{
public static void main(String[] args){
int remain = 21;
Scanner scan = new Scanner(System.in);
while (remain >1){
System.out.println("Take 1 or 2 sticks");
int input = scan.nextInt();
remain = remain -input;
@tenifni
tenifni / 21sticks_ver2.java
Last active Aug 17, 2016
[Game] 21 Sticks (with Player distinction). Rules of game: start with 21 sticks, and two players take turns either taking one or two sticks. The player who takes the last stick loses. [simplified: no mis-numbering prevention] \
View 21sticks_ver2.java
import java.util.Scanner;
//Player recognizable; Wrong number protection
public class Practive{
public static void main(String[] args){
int remain = 21;
Scanner scan = new Scanner(System.in);
System.out.println("The rules of this game are simple. You start with 21 sticks, then two players take turns alternatively");
System.out.println("either taking one or two sticks. The player who takes the last stick loses.");
System.out.println();
You can’t perform that action at this time.