MS Coding Camp(working title)

This forum is for discussion about anything else.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

MS Coding Camp(working title)

Post Post #0 (isolation #0) » Thu Nov 03, 2016 10:44 am

Post by chamber »

Some people in site chat expressed an interest in learning how to program. The idea behind this thread is people on MS that know how to code working together to make a program for those who don't to help them learn. An idea for a group project was a mafia app (this would make me lean to teaching Java). If you have interest in either the teacher or student end post here and say which.

Teachers:
Me?
Road Kamelot
Errantparabola
Cheetory6(design?)
papazito

Spoiler: students
Chevre
UpTooLate
Apricity
Annadog40
Glork
Sudo_Nym
Mina
Equinox
singersigner
Sotty7
kraska77
Accountant
xRECKONERx
Clumsy
Majjify
Firebringer
guyinfreezer

Spoiler: Lesson Index
Last edited by chamber on Fri Nov 18, 2016 3:37 am, edited 10 times in total.
Taking a break from the site.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #5 (isolation #1) » Thu Nov 03, 2016 10:55 am

Post by chamber »

SO I imagine if we do decide on a mafia app, step one is going to be teachers getting together and designing it, and then figuring out which elements can be broken down to teach which concepts. From there basics will need to be taught, I'm sure you can handle different parts of these things.
Taking a break from the site.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #8 (isolation #2) » Thu Nov 03, 2016 11:00 am

Post by chamber »

whats your programming experience?

Also, I guess we could use unity(c#) instead of java. Might muddle basic programming concepts, but would potentially take care of a lot of work in terms of making the app side of things.
Taking a break from the site.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #23 (isolation #3) » Sat Nov 05, 2016 7:00 am

Post by chamber »

Probably start next weekend. We've been discussing medium. Current thoughts are a mix of text and discord voice chat. I also considered youtube videos, but feel like that might require too much production time.
Taking a break from the site.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #26 (isolation #4) » Sat Nov 05, 2016 3:42 pm

Post by chamber »

Yeah, plan is Unity atm.
Taking a break from the site.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #28 (isolation #5) » Sun Nov 06, 2016 7:14 am

Post by chamber »

Unity has some framing that is custom but lets you use 1 of 2 languages for scripting, one of which is c#.
Taking a break from the site.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #40 (isolation #6) » Thu Nov 10, 2016 4:50 pm

Post by chamber »

In post 38, xRECKONERx wrote:Image

I think it'd be helpful to understand what we're coding. Like, what is the "Debug" command? Etc
We do intend to teach everything that's going on in this example eventually. But Everything is a lot. We wanted there to be some sense of accomplishment rather than here's 6 hours of us truly explaining everything you need to learn before you can do anything.

Expect it to be peppered into future lessons when knowing more about it becomes more useful.

In this instance, the Debug command is used to help debug your code, when you run into issues it can be useful to write things to the console about the state of the program so you can better figure out where and why it's failing.
Taking a break from the site.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #42 (isolation #7) » Thu Nov 10, 2016 4:52 pm

Post by chamber »

Yes.

There is a very deep rabbit hole to better explain what's going on. For now trust that we will get there in time, and that this lesson was mostly about getting you comfortable working in unity a little bit.
Taking a break from the site.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #48 (isolation #8) » Thu Nov 17, 2016 12:32 pm

Post by chamber »

Spoiler: Introduction
In the previous lesson we used the following code:

Code: Select all

void Start () {
	Debug.Log("Hello world!");
}

In today's first lesson we will be covering one part of this in more detail. "Hello world!". If you were observant you may have found it strange that we had to put quotation marks around this, but not other parts of the code. This is because "Hello world!" represents a string value. This shouldn't mean anything to you yet if you are new to programming, so don't worry. For today's lesson I've provided code snippets for most of the examples, however I encourage you to type them yourself rather than copy-pasting them. This will help your familiarity going forward.


Spoiler: 2.01: Variables explained
Variables are a means of storing data for later use. They are one of the core pillars of programming. It may help you to think of a variable as a box.

Image

It has a name used to access the value, and the value that is stored. Variables come in different types, today we'll be handling 3 families of variables. Words, Numbers, and True/False (in programming called a Boolean). With the exception of Booleans, these are not typically grouped like this, and are only being done so now as a teaching tool. For Words your primary type of variable is a string. A string holds whatever characters you want it to, and is enclosed in ""s. An addition type is char, which is a single character. char's are enclosed in ''s.

If we go back to the program we made last week, we now know some of what we need to make a change.

Change

Code: Select all

void Start () {
	Debug.Log("Hello world!");
}

To

Code: Select all

void Start () {
        string message = "Hello world!";
	Debug.Log(message);
}


And run the program again. You should see the same message as last time.

As I said previously "Hello world!" is a string value. We know this because it's enclosed in ""s. What's new here is

Code: Select all

        string message = "Hello world!";


This has several parts which I will now break down.

'string': This is the type of the variable we wish to declare.
'message': This is the name of the variable we wish to declare, we can then use it in the future to represent the stored value.
'=': This is the assignment operator. This may be confusing for people with a math background. Thinking of it as a traditional equals sign can get you in trouble. It means set the value of what's on it's left side to the value of what is on it's right side.
'"Hello world!"': This is the value we assign to message using '=' the assignment operator.

At this point I encourage you to play around a bit, entering your own string values.

Above we declared and assigned the variable in the same line. This is common, but not the only way to do things. You may not know the value a variable will have at the time it's being declared. In such cases you can break it up

Code: Select all

        string message;
        message = "Hello world!";


Note that string is not repeated at the beginning of future references to message, only when it's first declared, and that you need to end each line with ";" the line terminator. If you are observant you'll notice that this isn't true of all code by looking at other parts in this file, but for now, everything you do inside of 'Start' will require it.

Try one final example to help understand variable assignment

Code: Select all

void Start () {
        string message;
        message = "Hello world!";
	Debug.Log(message);
        message = "Hello world Again!";
	Debug.Log(message);
}


At this point if you feel you don't understand variable assignment, please ask one of the teachers in discord.

That will cover strings for now, but as I said above, we are also covering Numbers, and booleans.


Spoiler: 2.02: More Types
There is a lot more going on with types for numbers than there were for strings and chars, and we wont be covering it exhaustively today. Primarily they are divided in 3 ways. First, whether the Number is an integer or a floating point (real). Second, the maximum and minimum sized number it can hold. And Third, whether it can hold negative values or not(signed).

The primary Type you will use for an interger is
int
. The primary type you will use for a floating point number is
double
.

An int is also known as an
int32
. This is because it can store 32 bits worth of data. It is signed, which means it can hold both negative and positive numbers. Because of this the maximum value it can hold is (2^31)-1 and the minimum value it can hold is -(2^31).
The first bit of the 32 being used to indicate whether it is odd or even.

A double holds 64 bits of data and is also signed. Because of the way a double stores data, it can store very large values, but is only precise to 15 or 16 digits.

Now lets try and use some new types of variables in our program.

Code: Select all

void Start () {
        string message;
        message = "Hello world!";
	Debug.Log(message);
        message = "Hello world Again!";
	Debug.Log(message);
        int number;
        number = 7;
        Debug.Log(number);
}


Now lets try a double

Code: Select all

void Start () {
        string message;
        message = "Hello world!";
	Debug.Log(message);
        message = "Hello world Again!";
	Debug.Log(message);
        double number;
        number = 7.0;
        Debug.Log(number);
}


The final variable Type we introduce in this lesson is a Boolean. A Boolean is either true or false. Up until now all of our programs have run from the top of 'Start' to the bottom of 'Start' in order. Boolean values are key in controlling and altering the flow of a program. We wont be doing so this lesson, but I wanted you to understand their significance.

Code: Select all

void Start () {
        string message;
        message = "Hello world!";
	Debug.Log(message);
        message = "Hello world Again!";
	Debug.Log(message);
        double number;
        number = 7.0;
        Debug.Log(number);
        bool isTrue = true;
        bool isFalse = false;
        Debug.Log(isTrue);
        Debug.Log(isFalse);
}


Take this Moment to ask in discord if you feel you don't understand anything.

Now that we know some basic variable types lets have some fun with them.

Think a bit about what you think these will do before running them.

Code: Select all

void Start () {
       int number1 = 1;
       int number2 = 1 + 1;
       number1 = number1 + number2;
       Debug.Log(number1);
}


Code: Select all

void Start () {
       int number1 = 1;
       int number2 = 1 + 1;
       number1 = number1 + number2;
       number2 = 5;
       Debug.Log(number1);
}


Spoiler: 2.03: Operators
Now that we have a basic grasp on variables, we are going to introduce and cover some basic operators. That sounds more scary than it is because we've already used one above +(addition). Some other operators are -(subtraction), *(multiplication), /(division), %(mod). For those that have been out of school for a while the % operator will return the remainder of a division operation. So 5%2 would be 1. These are collectively known as arithmetic operators. Most of those should work how you expect. However there is one big exception. / can have unexpected results for new programmers because if both sides of the operator are ints, the return value will also be an int. For example 5/2 would not be 2.5, it would be 2.

I don't have any structured exercises to take you through for these right now, but I suggest you play with them a bit on your own. When you are comfortable with them we can move on to some string operators.

The only string operation we are going to cover for now is concatenation. That's a big scary word, but it just means adding 2 or more strings together. When they are added the latter will be appended to the former. In c# the concatenation operator is also +.

Code: Select all

void Start () {
      string hello = "hello";
      string world = "world!";
      string helloworld = hello + world;
      Debug.Log(helloworld);
}


You'll note that the 2nd string was appended (added to the end of) the first string. However, we are missing a space between them. I did this intentionally because its an easy error to make, and wanted you guys thinking about it.

Code: Select all

void Start () {
      string hello = "hello";
      string world = "world!";
      string helloworld = hello + " " + world;
      Debug.Log(helloworld);
}


All better.

Finally for booleans we are going to cover the comparative operator(==), not (!), or(||), and (&&). We will cover these in more detail later, but I at least want to get them introduced to you now. == is used to compare two values and resolves to a boolean. So for instance 1 == 1 would resolve to true.

Code: Select all

void Start () {
      Debug.Log(1 == 1);
      Debug.Log(1 == 2);
}


The ! operator inverts the boolean value of anything its put in front of. For instance

Code: Select all

void Start () {
      Debug.Log(!(1 == 1));
      Debug.Log(!(1 == 2));
}


|| and && are used for more complex statements, for instance

Code: Select all

void Start () {
      Debug.Log((1 == 1) || (1 == 2));
      Debug.Log((1 == 1) && (1 == 2));
}


|| is true if either side is true, && is true only if both sides are true.



Spoiler: Challenges (not so challenging this week)
1 print the boolean true value to the screen using all of the different boolean operators we worked with. Don't just copy a previous example.
example:

Code: Select all

Debug.log((1==1) && !(1==2) || (1==1));

2 Same as above but false instead of true.
3 Try concatenating a string and an int or double. Print it to the screen.
4 Try the same with a string and a bool.
5 print the product of any 2 numbers.
6 print the maximum value of an int.
Taking a break from the site.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #56 (isolation #9) » Wed Nov 23, 2016 7:55 pm

Post by chamber »

There is no power operator. You would need to use Math.Pow, I expected you to do exactly what you did, ^ is a bitwise xor.
Taking a break from the site.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #58 (isolation #10) » Thu Nov 24, 2016 1:06 am

Post by chamber »

I've had the same issue. I assume he copy and pasted from here rather than typing everything manually.
Taking a break from the site.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #69 (isolation #11) » Fri Dec 09, 2016 4:50 am

Post by chamber »

Me and Cheetory talked about it and we are heavily leaning towards canceling this. Participating from students has been very low. We don't think its worth our time for the ~3ish students actually doing things (no offense to them). And its certainly a terrible format for that many students.
Taking a break from the site.
User avatar
chamber
chamber
Cases are scummy
User avatar
User avatar
chamber
Cases are scummy
Cases are scummy
Posts: 10703
Joined: November 20, 2005

Post Post #74 (isolation #12) » Mon Jan 02, 2017 2:18 pm

Post by chamber »

If someone wants to take this over PM me, I'll give them the OP.
Taking a break from the site.

Return to “General Discussion”