Statistics | We have 1675 registered users The newest registered user is dejo123
Our users have posted a total of 30851 messages in 1411 subjects
|
Who is online? | In total there are 47 users online :: 0 Registered, 0 Hidden and 47 Guests :: 1 Bot None Most users ever online was 443 on Sun Mar 17, 2013 5:41 pm |
Latest topics | » THIS FORUM IS NOW OBSOLETE by NickTheNick Sat Sep 26, 2015 10:26 pm
» To all the people who come here looking for thrive. by NickTheNick Sat Sep 26, 2015 10:22 pm
» Build Error Code::Blocks / CMake by crovea Tue Jul 28, 2015 5:28 pm
» Hello! I can translate in japanese by tjwhale Thu Jul 02, 2015 7:23 pm
» On Leave (Offline thread) by NickTheNick Wed Jul 01, 2015 12:20 am
» Devblog #14: A Brave New Forum by NickTheNick Mon Jun 29, 2015 4:49 am
» Application for Programmer by crovea Fri Jun 26, 2015 11:14 am
» Re-Reapplication by The Creator Thu Jun 25, 2015 10:57 pm
» Application (programming) by crovea Tue Jun 23, 2015 8:00 am
» Achieving Sapience by MitochondriaBox Sun Jun 21, 2015 7:03 pm
» Microbe Stage GDD by tjwhale Sat Jun 20, 2015 3:44 pm
» Application for Programmer/ Theorist by tjwhale Wed Jun 17, 2015 9:56 am
» Application for a 3D Modeler. by Kaiju4u Wed Jun 10, 2015 11:16 am
» Presentation by Othithu Tue Jun 02, 2015 10:38 am
» Application of Sorts by crovea Sun May 31, 2015 5:06 pm
» want to contribute by Renzope Sun May 31, 2015 12:58 pm
» Music List Thread (Post New Themes Here) by Oliveriver Thu May 28, 2015 1:06 pm
» Application: English-Spanish translator by Renzope Tue May 26, 2015 1:53 pm
» Want to be promoter or project manager by TheBudderBros Sun May 24, 2015 9:00 pm
» A new round of Forum Revamps! by Oliveriver Wed May 20, 2015 11:32 am
|
|
| [ARC]-Roadkill's programming tutorial part I- | |
|
+4eumesmo Invader Commander Keen roadkillguy 8 posters | Author | Message |
---|
roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: [ARC]-Roadkill's programming tutorial part I- Fri Oct 01, 2010 11:54 am | |
| *stickied by scio All right here we go. If you would like to learn to program, I will help. Please note that LUA is very foreign to me, and I probably shouldn't be teaching about it. If someone wants to add LUA, feel free to do so. First off, programming is easy. Especially when you know the basic commands in a program. A program executes these commands flawlessly and very fast. First off, the variable. Variables are defined like this: - Code:
-
//THIS IS A COMMENT. IT IS IGNORED BY THE COMPILER, SO YOU CAN TYPE //WHATEVER YOU WANT BEHIND IT.
/* YOU CAN ALSO COMMENT LIKE THIS */
//THE FOLLOWING LINE DEFINES myNumber AS THE NUMBER 1 var myNumber = 1;
//THE FOLLOWING LINE DEFINES myString AS THE STRING "I'm a pirate" var myString = "I'm a pirate";
What's a string, you might ask? It's a collection of characters strung together. - Code:
-
//IF YOU REMEMBER YOUR BASIC ALGEBRA, YOU CAN DO THIS TO var number1 = 1; var number2 = 2; var number3 = number1 + number2;
//THE + OPERATOR CAN ALSO APPEND THINGS TO STRINGS var string = "number1 = " + number1;
If we were to output number3, it would be the number 3. If we were to output string, it would be "number1 = 1". We will cover this later. - Code:
-
//HERE'S SOME MORE ALGEBRA var number1 = 1; var number2 = 5; var number3 = 2;
var number4 = number1*number2*number3;
var number5 = number4/2;
number4 would then be... You guessed it! 10! number5 would then be... 5! Now for the quiz! I need you to write me a program that creates a human readable string containing the following variables. x, y, z, rotation, dx, dy and dz. Please do not post the answer in the comments section, pm it to me instead. Thanks! Also, could we change the text color inside the code blocks to something like black? | |
| | | Commander Keen Industrial Team Lead
Posts : 1123 Reputation : 36 Join date : 2010-07-23 Location : Czech Republic (not that anyone would know where it is...)
| Subject: Re: [ARC]-Roadkill's programming tutorial part I- Fri Oct 01, 2010 12:35 pm | |
| I might add Lua if I ever find some time.. | |
| | | Invader Experienced
Posts : 528 Reputation : 11 Join date : 2010-07-10 Age : 28
| Subject: Re: [ARC]-Roadkill's programming tutorial part I- Fri Oct 01, 2010 6:02 pm | |
| - roadkillguy wrote:
- To actually contribute, everyone on this forum MUST learn to program.
I quit. | |
| | | eumesmo Regular
Posts : 297 Reputation : 4 Join date : 2010-07-09
| Subject: Re: [ARC]-Roadkill's programming tutorial part I- Fri Oct 01, 2010 6:21 pm | |
| want some lua? - Code:
-
--lua prime gen i made a while ago (i'll add the one that records to a file if i find it.... numbers = {} n = 1 _G["return"] = (function () return numbers end)
work = (function (number,tab) a = false i = 2 if #numbers > 2 then repeat got = number/tab[i] if got == math.floor(got) then a = true else i = i+1 end until a == true or i >= #tab end if a == false then table.insert(tab,number) print("number"..number.."Is It") end end)
coroutine.resume(coroutine.create(function () b = false repeat work(n,numbers) n = n+1 until b == true end))
lua is not that hard. variables 101. you dont need to define the type of any variable. if you say lol = 42 it automatically says that lol is a int with value 42. variables and even functions, tables and threads can many times remain anonymous, which means they need not their name to be determined lol = 42 --number var = "42" --string bool = true --bool fun = (function ...end) --function coroutine.resume(coroutine.create(function() end)) -- notice that function ha not been defined i know lua (though i do not have much experience with metatables) and i've started to learn C++ (but school has left me with no time to learn though) see lua.org for details and stuff... @ roadkilli think you mean something like this: var = "x, y, z, rotation, dx, dy and dz" the output would be: x, y, z, rotation, dx, dy and dz you might also mean to something like this: val = "x" val2 ="y" var = val..","..val2 | |
| | | roadkillguy Experienced
Posts : 528 Reputation : 17 Join date : 2010-08-25 Age : 31 Location : Rhode Island
| Subject: Re: [ARC]-Roadkill's programming tutorial part I- Fri Oct 01, 2010 8:00 pm | |
| ...I'm pretty sure that was part of the quiz. | |
| | | Noitulove Regular
Posts : 237 Reputation : 0 Join date : 2010-07-09
| Subject: Re: [ARC]-Roadkill's programming tutorial part I- Fri Oct 01, 2010 8:24 pm | |
| - roadkillguy wrote:
- To actually contribute, everyone on this forum MUST learn to program.
And I thought Sven was a dictator!Oh, em, I mean I pass. Please? | |
| | | ~sciocont Overall Team Lead
Posts : 3406 Reputation : 138 Join date : 2010-07-06
| Subject: Re: [ARC]-Roadkill's programming tutorial part I- Fri Oct 01, 2010 9:49 pm | |
| Not eneryone needs to program. It's actually a bad idea to have everyone here programming, because lots of people really aren't clear on all of our current ideas. Too many cooks will undoubtedly spoil the broth.
So, thank you very, very much for putting this up, but I'm the one calling the managerial shots here, ok?
| |
| | | AIs-null Learner
Posts : 142 Reputation : 1 Join date : 2011-02-05
| Subject: Re: [ARC]-Roadkill's programming tutorial part I- Fri May 13, 2011 1:59 am | |
| First they should learn Console input and output with mathematics, then teach them OpenGL. | |
| | | Mysterious_Calligrapher Biome Team Lead
Posts : 1034 Reputation : 26 Join date : 2010-11-26 Age : 32 Location : Earth, the solar system, the milky way...
| Subject: Re: [ARC]-Roadkill's programming tutorial part I- Fri May 13, 2011 10:18 am | |
| Lovely, but until I can do more than smack at my calculator, I stop at algebra.
Though thank you for putting this up, as it gives me an idea of the math that will be required in order to define our biomes and population dynamics. | |
| | | AIs-null Learner
Posts : 142 Reputation : 1 Join date : 2011-02-05
| Subject: Re: [ARC]-Roadkill's programming tutorial part I- Fri May 13, 2011 12:00 pm | |
| Mysterious Calligrapher, you are doing a splendid job at giving us information and doing the science! You are not required to learn how to program, as i see it, you are way to much needed in the science section and making concept arts.
However, it would maybe proove beneficial to have you learn a little bit, so that your concepts don't go overhand and are actually realistic to accomplish | |
| | | Mysterious_Calligrapher Biome Team Lead
Posts : 1034 Reputation : 26 Join date : 2010-11-26 Age : 32 Location : Earth, the solar system, the milky way...
| Subject: Re: [ARC]-Roadkill's programming tutorial part I- Fri May 13, 2011 5:23 pm | |
| I agree, I probably ought to have a look at the basics of math that the system can handle before I dump a lot of theorems on you.
I'm almost finished with finals, though, and I'm still hard at work on the biomes - I'm mostly interested in knowing if the math I've got for biome determination for the automatic placement can be handled by the programming... and unfortunately scio has class during the day, so I can't be pestering him for the answers all the time.
Kudos to you lot who actually make the machines accept all this math. | |
| | | Sponsored content
| Subject: Re: [ARC]-Roadkill's programming tutorial part I- | |
| |
| | | | [ARC]-Roadkill's programming tutorial part I- | |
|
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| |