Programming Thread

Started by the-pi-guy, Mar 13, 2016, 10:39 PM

previous topic - next topic

0 Members and 4 Guests are viewing this topic.

Go Down

the-pi-guy

Code: [Select]


public class Driver{
  public static void main(String[] args)
  {
   List l = new List();
    for(int i=0; i<12; i++){
     l.display();
     l.getNext();
     
    }
    System.exit(0);
  }
}

public class List{
  int[] current;
  int[] next;
 
  public List(){
    current = new int[1];
    next = new int[0];
    current[0] = 1;
  }
 
  public void add(int i){
    expand();
    next[next.length-1] = i;
   
  }
  public void expand(){
   int[] temp = new int[next.length+1];
    for(int i=0; i<next.length; i++){
      temp[i] = next[i];
    }
    next = temp;
  }
  public void getNext(){
    next = new int[0];
    for(int i =0; i<current.length; i++){
      if(current[i]>4 && (current[i]-4)%6==0){
       add(current[i]*2);
       add((current[i]-1)/3);
      }else{
        add(current[i]*2);
      }
     
    }
    current = next;
  }
 
  public int[] getCurr(){
   return current;
  }
 
  public void display(){
    for(int i =0; i<current.length; i++){
      System.out.print(current[i] + "   ");
    }
    System.out.println("");
   
  }
}


I threw together some code on my chromebook for the collatz conjecture.  And I don't really want to lose it.
It makes the tree of successors for where each values can go. 

Legend


the-pi-guy


Legend


the-pi-guy


darkknightkryta


Legend

I don't know, Python exists.
Hehe

I like python. Never really used it, but Blender uses it.

spl/fibonacci.spl at master · flowerhack/spl · GitHub

This is the worst programming language.  
What does that example do?

the-pi-guy

I don't know, Python exists.
There are so many worse.  
Python is great. ::P

What does that example do?
I don't even know.  
I have a good idea of what a few lines do, but the whole thing is just bizarre.

darkknightkryta

Python is terrible.  I would honestly rather program in x86.

Legend

Python is terrible.  I would honestly rather program in x86.
Is that even doable?

the-pi-guy

Python is terrible.  I would honestly rather program in x86.
No it isn't.  
Is that even doable?
I'm assuming he means assembly.  
Unless he means binary.  Then he's way wrong.  

Legend

No it isn't.  I'm assuming he means assembly.  
Unless he means binary.  Then he's way wrong.  
Real Programmers

darkknightkryta

Yes I would rather cornver x86 assembly into binary than program Python

the-pi-guy

So a while ago, I made up a matching game for Android for Japanese words.  
I kind of gave up on it.  There was a weird blue screen that im not sure where it comes from and loading the words takes way too long.

 
I want to go back and fix it up though.  

Legend

So a while ago, I made up a matching game for Android for Japanese words.  
I kind of gave up on it.  There was a weird blue screen that im not sure where it comes from and loading the words takes way too long.

 
I want to go back and fix it up though.  
How were you loading the words?

Go Up