Wednesday, May 20, 2015

Snake app- available now!

Snake
an Android App by Ché Young 

       Ladies and gentlemen, I present my senior project, the Snake app. I stayed up until 1 AM making this fully functional Snake game, complete with random terrain generation, transparent shadows, high scores and screen wrapping (go off the left side of the screen, appear on the right).



Wednesday, April 15, 2015

Sorting Algorithm Visualizer v1.1

I made some changes to the sorting visualizer program to make it overall better.

1. updated timings- the delay between steps should be more accurate now.
2. fixed bug where, especially on large arrays, the program would occasionally redraw the screen without performing any steps.
3. fixed slowdown and erratic movement on large arrays.

Tuesday, April 14, 2015

Sorting Algorithm Visualizer

This was FUN. I made a program that showcases four different sorting algorithms. You can choose four different array sizes (64, 128, 256 or 512 elements), and the algorithm to display. You can also choose the speed you want the algorithm to run at by clicking the bar along the bottom- farther left is slower. If possible, the element will turn green when the algorithm deems that element sorted. It will also highlight elements being compared in red.

Also, there's a difference between Quick Sort and Quick Sort 2- the second uses the median of the leftmost, center and rightmost elements as the pivot, whereas the first just uses the element on the far left. This means Quick Sort 2 is generally more efficient in its choice of pivot.
Download it here!
Also grab the source code here!
Bubble Sort with an array of 64 elements
Gnome Sort with 128 elements
Merge Sort with 256 elements
Quick Sort with 512 elements
 
The GUI!

Thursday, March 19, 2015

Tree

"Tree"


It's funny, 'cause the code branches

Thursday, March 12, 2015

Anagram creator / Recursion

Earlier, our teacher chalenged us to write a program that outputs a list of anagrams given an input string. A bit later, he said "On second thought, it might be too hard, considering we haven't learned the skills needed yet."

WELL, I DID IT ANYWAYS.


This program uses some serious recursion to return a list of anagrams. For example, "yes" prints out "yes", "yse", "eys", "esy", "sye", and "sey". If the boolean useAllCharacters is set to false, it will print out the string at each step, meaning it will also print anagrams using only some of the characters. For example, "hi" will print "h", "hi", "i", and "ih".

The recursion function works like this- given a string and a list of characters, it will go through the list and each time, call itself with the original string plus a character from the list and the list of characters without the character added to the string. If the list is empty however, it will simply print the completed string, and end without calling itself. More visually demonstrated-


Wednesday, March 11, 2015

Rapid Counter app- available here!

Rapid Counter
an Android app by Ché Young

       To test out and better understand the Android app development and submission process, I have created this app, Rapid Counter. It is designed to be an ergonomically and aesthetically pleasing counter, with buttons to subtract as well as add to the count, along with a reset button and sounds.
     I would have this submitted to the Google Play store... except for the fact that the $50 signup fee is too high for me to comfortably pay for the moment. However, you can download it here instead. You will likely need to go into your settings to allow installing apps from non-market sources.

Regardless of whether or not you liked it, feel free to give me feedback!
Any input would be much appreciated.

Friday, March 6, 2015

Pig Latin converter

So I made this pig latin translator in class today. It doesn't handle capitalization or punctuation, but it can handle multiple words at once, separated by spaces.

import javax.swing.JOptionPane;

public class home {
static String[] vowels = {"a", "e", "i", "o", "u", "y"};
public static void main(String[] args) {
String input;
String out;
boolean x = true;
while (x) {
input = JOptionPane.showInputDialog("Words to change?");
if (input.equals("stop")){
x=false;
break;
}
out = "";
for (String ret: input.split(" ")){
int vpos = find(ret);
System.out.println(vpos);
if (vpos > 0) {
out = out + ret.substring(vpos) + ret.substring(0, vpos) + "ay ";
} else {
out = out + ret + "way ";
}
}
JOptionPane.showMessageDialog(null, out);
}
}
public static int find(String inp) {
int pos = -1;
for (String vwl: vowels) {
int vpos = inp.indexOf(vwl);
if ((vpos >= 0) && ((vpos < pos)||(pos==-1)) && (vpos != inp.indexOf("qu")+1)) {
pos=inp.indexOf(vwl);
}
}
return pos;
}
}