Topic: Good programming language to learn?

Offline Kayne

  • Addicted
  • Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!
  • Posts: 3,298
Wait, Please correct me here.

Apart from forgetting all the different names, I'm going to try piece together this question...

A method (/function?) is an "operation" that you can call multiple times, right? I could write one out, then keep calling it to repeat that same exact task?
A variable inside that method, can not be accessed outside of that method / function? unless it's a global variable, in which case the variable is set...outside of the function?

I honestly have tried reading the basics. It's just too much information to deal with, I guess. My brain just keeps reading over these words of function, method, class, shell, and what ever other term there is, to describe some sticky process that has great importance.

TL:DR : Everyone seems to use other programming words to explain programming. When I know these words don't mean what I think they mean, It stops becoming fill in the blanks and starts becoming an meaningless paragraph of letters.

Reply #275 Posted: November 17, 2015, 09:31:03 pm
Quote
Top Geary - 27th May 2016 at 12:10 AM
I've learnt to ignore when you say derogatory things to me

Offline Kayne

  • Addicted
  • Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!
  • Posts: 3,298
How about this guys.

Start me off with an idea to do. Something extremely basic. I'll get started from there.

Reply #276 Posted: November 17, 2015, 09:33:56 pm
Quote
Top Geary - 27th May 2016 at 12:10 AM
I've learnt to ignore when you say derogatory things to me

Offline Xenolightning

  • Moderator
  • Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!
  • Posts: 3,485
A method is a grouping of statements. They are usually created when you have a group of statements that you wish to run in that sequence more than once. There's no guarantee that it will do the exact same thing every time, but only that it will execute the same way**.

Method/Function/Operation/Subroutine, are all interchangeable. In C#, method is the correct name.

**Ignoring conditional branches.. if(...)...

Make something that takes two whole numbers, A and B. Return the result that is equivalent to A^B.

Or try: http://www.learncs.org/en/Variables_and_Types
Last Edit: November 17, 2015, 09:59:09 pm by Xenolightning

Reply #277 Posted: November 17, 2015, 09:57:00 pm
-= Sad pug is sad =-

Offline Tiwaking!

  • Hero Member
  • Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!Tiwaking! is awe-inspiring!
  • Posts: 12,584
How about this guys.

Start me off with an idea to do. Something extremely basic. I'll get started from there.

You have two players. Each player has three cards: Rock, Paper, and Scissors. Each player plays one card. Once both players have played their card the cards are revealed.

The Rock card beats the Scissors card
The Scissors card beats the Paper card
The Paper card beats the Rock card

If the cards are the same then it is a draw.
Code: [Select]
public String getResult(Card card1,Card card2){
String name1=card1.getName();
String name2=card2.getName();
String result="Wins";
if(name1.equals("Scissors")&&name2.equals("Paper"))return result;
if(name1.equals("Paper")&&name2.equals("Rock"))return result;
if(name1.equals("Rock")&&name2.equals("Rock"))return result;
if(name1.equals(name2))return "Draws";
return "Loses";
}
Now: Instead of 'losing' or 'winning', each player does a certain amount of damage to each other until one person runs out of health and dies. Replace 'player' with 'Pokemon' and you're on your way to making Pokemon.

For Xenolightning
Spoiler :
getLocationOnScreen(), is the correct approach..? Needs to be run after the layout has been performed.

Yuck: http://stackoverflow.com/questions/19497402/get-position-of-imageview-relative-to-screen-programmatically

Doesnt work. In fact, it is Wronger than wrong. Essentially it does exactly what it normally does (i.e absolutely nothing) and can never work properly because you need to set it during creation of the layout. Any changes to the layout breaks it. You're better off doing what I originally started doing and just randomly guessing x and y values.

Reply #278 Posted: November 17, 2015, 10:29:56 pm
I am now banned from GetSome

Offline Kayne

  • Addicted
  • Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!Kayne is awe-inspiring!
  • Posts: 3,298
Make something that takes two whole numbers, A and B. Return the result that is equivalent to A^B.

You don't really need to download it, It's exactly what you said.

But I learnt from doing it and hunger for more.

Now you're going to ask me to give an error, or maybe even prevent someone from typing in any non numeral character.

Here's the code, because I figure you'll want to see how bad I did :>

Code: [Select]
namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public Double Variable, Variable2, Result; //Haha fuck you I used a public variable!

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            Double.TryParse(textBox2.Text, out Variable2); // This is the part where you call me an idiot for not using an int
            Result = Math.Pow(Variable, Variable2);
            label1.Text = Result.ToString();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            Double.TryParse(textBox1.Text,out Variable);
            Result = Math.Pow(Variable, Variable2);
            label1.Text = Result.ToString(); // Repeating the two lines probably wasn't needed but I wanted it to auto update.
        }
    }
}
Last Edit: November 17, 2015, 11:49:55 pm by `Kayne

Reply #279 Posted: November 17, 2015, 11:44:51 pm
Quote
Top Geary - 27th May 2016 at 12:10 AM
I've learnt to ignore when you say derogatory things to me

Offline Xenolightning

  • Moderator
  • Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!Xenolightning is awe-inspiring!
  • Posts: 3,485
Try doing it, when not using a Windows Form application.

Use a console application instead. Using Windows Forms forms (heh) really bad habits.

See if you can do it without Math.Pow too, it's nice to explore and understand how to do something instead of just using something that someone else wrote.

Reply #280 Posted: November 18, 2015, 09:47:56 am
-= Sad pug is sad =-

Offline Pyromanik

  • Hero Member
  • Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!Pyromanik is awe-inspiring!
  • Posts: 28,834
Swift. The next new C killer.
Because no one's tried that before.

Reply #281 Posted: December 07, 2015, 12:33:28 pm
Everyone needs more Bruce Campbell.