Wikipedia:Reference desk/Archives/Computing/2022 May 3

= May 3 =

How to learn programing
How can I learn programing easily as a beginner, and what site may I use to learn? Makerman88 (talk) 11:28, 3 May 2022 (UTC)


 * Python.org has a page Python for Non-Programmers offering suggestions, and specifically links to free interactive courses. Learn Python is advertized as suitable for absolute beginners. --Lambiam 14:24, 3 May 2022 (UTC)
 * I know there's also a website called "code.org" which teaches you coding using code blocks (However I Personally don't see how that's helpful since actual programming doesn't have code blocks for you to use), but I think that's Javascript (or is it Java?). ― Blaze WolfTalkBlaze Wolf#6545 14:28, 3 May 2022 (UTC)
 * Hi, the R-project has good manual to get started with R programming. There are multiple online free resources to learn it as well. I hope this helps. :) Nanosci (talk) 00:18, 4 May 2022 (UTC)
 * I've used code.org with school. Yes, you have blocks (I don't know if this is a certain code) but when you put the blocks in the right place, in the end, you can see the code you have written or see past levels you've done. So, you can learn coding in a really nice way and you can see what you have done so you can study it later. OK, I know that it can be seen a little bit childish at first because it was created in a funny way and to be closer for children too, but, it is a good way to learn coding, in my opinion. Also, it has helping videos to understand things easier. There are some levels that have to do with AI which I found really interesting. I would definitely recommend it for all ages.
 * Hope this helps :) - Fisforfenia (talk) 13:02, 5 May 2022 (UTC)

Restarting program/computer fixes some issues
Hello! So something people usually get told when something isn't working is to try closing it and reopening it or turning it off and then back on. Why exactly does doing this work? Isn't the computer just reading lines of code? Cause if that's true, then why would closing and reopening the program or restarting the computer change anything? For example, recently I was playing Snowrunner (insert a bunch of random, irrelevant details), I was using a truck with a crane attachment and the game had been running for a while. When I attempted to use the crane to pick up another truck, the attachment points for the crane were popping up (just white dots as a UI), however I wasn't able to actually select them and attach the crane to them. When I closed the game for the night and opened it back up the following morning, the crane and attachment points were working properly again. So why exactly did restarting the program fix the issue I was having? ― Blaze WolfTalkBlaze Wolf#6545 18:18, 3 May 2022 (UTC)


 * Let's imagine a reason why Snowrunner might do this. Suppose when each truck is created, it is given an index number, and its attachment points are given numbers as well. How does the game identify which one has been clicked on? (I don't know whether selection in this game is actually done with a mouse click, but I'm imagining it is.) Let's suppose it uses a kind of chroma key: it maintains a whole second copy of the screen, which is mostly black, but has the areas you can click on drawn in solid colors. They might actually look very similar to black, that doesn't matter, because this private copy is for the computer, not for human eyes. The important thing is that each clickable item is drawn in a different color, which translates to its index number, the same way that for instance magenta is represented by hexadecimal code FF00FF (which equals 16711935). So let's say that the programmer chose to store both the index numbers and the translations of those numbers into color codes, which are very similar to the indexes, but which combine the truck index with its specific attachment point number into one number of the right format to be drawn as a color. These translations could be done every time they are needed, but instead the programmer decided to do them in advance and store them. OK so far?
 * Now, suppose in this game there are a bunch of other trucks around, and they come and go - and once in a while they leave the location altogether, or a new one arrives. So that means index numbers are leaving and new index numbers are arriving, right? And let's say the programmer didn't want the numbers to just keep getting bigger as a result, and for some reason didn't think of just recycling the numbers from trucks that have left, but instead chose to reassign the numbers of every truck whenever one leaves to keep the numbers as low as possible, without any gaps. However, this idiot forgot to write the part where the color code translation of the index number gets updated. So now what happens is that after a certain amount of seemingly unrelated background activity, the game gets into a state where the clickable items are producing codes that don't match up to any currently existing part of any currently existing truck. It reacts to this by doing nothing when you click on them. If you restart the game, however, every truck is freshly created, and assigned a fresh index number and a corresponding color code translation which matches correctly (for now). This imagined reason will turn out to be implausible if picked apart, but it could be something like that. Card Zero  (talk) 19:38, 3 May 2022 (UTC)
 * That would make sense since I had been playing multiplayer previously so the person I was playing with was switching out the truck they were using (or just respawning their truck which I would assume would function the exact same). Probably not how it works exactly, but it does help understand. I always think of games and programs as just a bunch of lines of code that the computer is reading. And that's probably partially what it is, but clearly it's much more than that. ― Blaze WolfTalkBlaze Wolf#6545 20:07, 3 May 2022 (UTC)
 * An analogy for this I read a while ago was: Imagine you are in a new city and you've been given a map. You walk around for awhile but suddenly get lost, and don't know where you are on the map. Would it be easier to either try and figure out where you are at your current location, or to return to your starting location and try again? It's generally the same thing with computers. ― Tuna + 13:41, 5 May 2022 (UTC)
 * Huh. Interesting. (kinda moot now since most maps are now online and don't lose where you are, but I still understand it) ― Blaze WolfTalkBlaze Wolf#6545 13:42, 5 May 2022 (UTC)