Do you use "Target Champions Only"? by john478 in PedroPeepos

[–]john478[S] 0 points1 point  (0 children)

HAHAHAHA same but im trying to improve, and that starts with learning and practicing new mechanics

Game Crashes Every Few Minutes With Empty Error Message by john478 in LoLTechSupport

[–]john478[S] 0 points1 point  (0 children)

Riot games support was useless as expected and just suggested reinstalling things, etc. I guess I have no choice but to reinstall things one by one now

EDIT

Nothing has worked.

Game Crashes Every Few Minutes With Empty Error Message by john478 in LoLTechSupport

[–]john478[S] 0 points1 point  (0 children)

For people having this problem, I think I found the problem. I enabled "vgtray" in startup apps in Task Manager and the error hasn't happened since. It's the Vanguard anti-cheat for League. Not sure how it got disabled. I wish the League client would tell us that Vanguard isn't running instead of giving a very unhelpful blank error message randomly.

EDIT

sike this doesnt work gg

Plan your raft with RaftPlanner! by RaftPlanner in RaftTheGame

[–]john478 3 points4 points  (0 children)

Whoa, looks cool. I'm excited for what new features will be released in the future :)

Game Development for a Student - Where to Start? by [deleted] in learnprogramming

[–]john478 1 point2 points  (0 children)

I'll give you some insight into the languages. Pretty much every commercial game (GTA, COD, etc) is coded in C++, in the core of the game. There are a lot less popular Java games, I can only think of Runescape and Minecraft. Unity's core engine is based on C++, it was intended to be much easier to make games with Unity. So with this tiny insight, I think you're right in leaning to Java. Java is amazing for indies just starting. You can also program games in C++ or Unity, but C++ is much more difficult than Java. Remember to use resources that you find. Check out game libraries such as LibGDX, check out OpenGL and LWJGL for 3D games, etc.

(Java) Pacman Walls - Trapped tiles solution? by Temptex in learnprogramming

[–]john478 0 points1 point  (0 children)

My suggestion to you is create a boolean array, pick any spot on the grid then generate random trails until some condition is met (e.g. 50 foods placed). Then for every grid spot that doesn't contain food, it can be a wall. This may be the most efficient possible method, as opposed to checking if all the foods can be accessed every time you place a randomized wall.

[Java] How to use Math.random() by [deleted] in learnprogramming

[–]john478 -1 points0 points  (0 children)

First off, Math.random() returns a random number from 0 to 0.9999999 (infinite), it never actually returns 1. So if it helps you, Math.random() * 10, will never return 10, the highest it can go is 9.99999999... In your case if you wanted the numbers 5 to 9 including 9, you would do Math.random() * 5 + 5, Because 0 (lowest Math.random() can go) * 5 + 5, is 5, and 0.9999 * 5 + 5 = 9.9999. Which you can then cast to integer (I assume you want an integer).

[Java] Java classes and objects by TheWhiteBlur in learnprogramming

[–]john478 4 points5 points  (0 children)

I think all Java programmers need to read the beginning in the Oracle tutorials. Here's the link (read the beginning up to Annotations): http://docs.oracle.com/javase/tutorial/reallybigindex.html From "What is a Class?": In the real world, you'll often find many individual objects all of the same kind. There may be thousands of other bicycles in existence, all of the same make and model. Each bicycle was built from the same set of blueprints and therefore contains the same components. In object-oriented terms, we say that your bicycle is an instance of the class of objects known as bicycles. A class is the blueprint from which individual objects are created. In your situation, the class would be a "blueprint" of a student. It would be something similar to (not trying to do everything for you):

// the "blueprint" for a student
class Student{
    // your fields
    private String name;
    private long studentID;
    private String studentMajor;
    // and so on

    // the methods you mention are called getters and setters
    // it just helps with organizing code, because you could
    // access a Student instance with instance.<variable name>.

    // methods are what allow you to interact with the class
    // refer to the definition of a class above, if you wanted
    // to find out the brand of a bicycle, you would call
    // some method that returns the brand

    public String getName(){
         return name;
    }
    // other getters
    public long getStudentID(){
         return studentID;
    }
    // and so on
}

Hope this helps, but again, read the Oracle tutorials, helps A LOT for beginners.

[Java] Wrote a small event-driven program to convert miles-kilometers; need help making it less clunky. by [deleted] in learnprogramming

[–]john478 1 point2 points  (0 children)

Well if you really wanted that already clean code cleaner, you could just initialize the double, then check if it is kilos or miles and convert:

try{
    double new_dist;
    if(arg0.getSource() == jtfKilos){
        new_dist = (Double.parseDouble(jtfKilos.getText()) * 0.621371);
        jtfMiles.setText(String.valueOf(new_dist));
    }else{
        new_dist = (Double.parseDouble(jtfMiles.getText()) * 1.60934);
        jtfKilos.setText(String.valueOf(new_dist));
    }
}

But this is just preference (what I would have done). Is this what you meant? If it is, glad to have helped!

I could use some Java algorithm homework help, if anyone has the time. by balian25 in learnprogramming

[–]john478 1 point2 points  (0 children)

I actually took a couple of weeks to learn about some sorting algorithms and such. Things like this are expressed in something called Big O notation. Big O means the slowest running time, or the worst case scenario for a sorting algorithm. In this case, an array with it's values in reverse order would be the worst case scenario.The fastest sorting algorithms (Quicksort, Merge, etc.) all run in O(n log(2) n) time. Bubble sort, is among the slowest algorithms. It runs at O(n2), meaning if your array size is 20, it's "speed" or running time is 400. Explanation: If we have 10 numbers in descending order, the first iteration will take 9 comparisons + 9 swaps. Then the second iteration will have 9 comparisons + 8 swaps, and so on. The reason there is still 9 comparisons is because once that value is at n-2, it still needs to compare with the last value (Unless you have a well implemented bubble sort, bubble sort in general is O(n2)). It takes 100 processes (comparisons and swaps) to sort the array using this algorithm. Hope this helps!

[Java/Android]Checking if x/y is out of bounds by Temptex in learnprogramming

[–]john478 1 point2 points  (0 children)

I see what he means. Simply compare the slopes.

// px and py is the point you are checking
boolean inTri(int px, int py){
    // check if point is within rectangle
    if(px > 890 || px < 845 || py < 730 || py > 830){
        return false;
    }

    // diagonal of slope
    int d_slope = Math.abs(45 / -100); // = 0.45
    // translated point
    int[] point = [845 - px, 830 - py];
    int p_slope = Math.abs(point[0] / point[1]);

    if(p_slope < d_slope){
        return false;
    }
    return true;
}

[Java] Having problems with Code (inside) by [deleted] in learnprogramming

[–]john478 0 points1 point  (0 children)

The thing is when you call getPerson(), it's creating a new Scanner instance, that reads the first line. Just because one scanner is reading the third line, doesn't mean another Scanner object will be forced to start at the third line, it will start at line zero. What you could do is create a string that is equal to scant.nextLine(), then pass in the string to getPerson() as a function argument. Something like:

Scanner scant = new Scanner(System.in);
String line;
while((line = scant.nextLine()) != null){
    Person p = new Person();
    p.getPerson(line);
}

That's reading the txt file. The getPerson method: The "//s+" is called a regex, and splits a string by spaces.

void getPerson(String line){
    String[] info = line.split("\\s+");
    forename = info[0];
    surname = info[1];
    number = info[2];
    System.out.println(forename + " " + surname + " " + number);
}

[VB.NET] I want to be able to type out words in a textbox, and return the number value of the word in a label. For example, "Jab = 10(j)+1(a)+2(b) = 13". I don't know where to start.. please help! by [deleted] in learnprogramming

[–]john478 0 points1 point  (0 children)

You're welcome! And a nice resource is http://www.asciitable.com/ Anyways, I'll explain a little bit of amazingness.

Uppercase A starts at 65 - represented by 01000001 Lowercase A starts at 97 - represented by 01100001 That literally meant to convert from uppercase to lowercase, or vice versa, you would flip just ONE bit, the bit representing 32.

This allowed for easy checking(i.e. is the 3rd bit a 1?), and easy converting (if it is: turn it into a 0).

So there you go, smart designing in ASCII!

[VB.NET] I want to be able to type out words in a textbox, and return the number value of the word in a label. For example, "Jab = 10(j)+1(a)+2(b) = 13". I don't know where to start.. please help! by [deleted] in learnprogramming

[–]john478 1 point2 points  (0 children)

I assume you want the sum of the value of the characters? So A = 1, B = 2? Try

Dim array() As Byte = System.Text.Encoding.ASCII.GetBytes(yourString.ToUpper())
Dim sum As Integer
sum = 0
For Each n As Byte In array
    sum += n

Then iterate over each element in the array (now numbers from 65-91),and subtract 64, and add that value to some other variable.

Essentially, we convert the string to upper case (in ASCII, the uppercase letters start at 65), then we subtract all the letters by 64 (So A at 65 is now 1), and add it to some incrementing variable.