Hack Forums
[Shell] Occasionally Useful Batch Concepts - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Shell] Occasionally Useful Batch Concepts (/showthread.php?tid=4863205)



Occasionally Useful Batch Concepts - WOLGA - Aug 5, 2015

This tutorial will cover:
  • FOR
  • Pointers
  • Arrays
  • Multi-Threading

I will try my best to answer any question and comment. If there are any mistakes in this post, please let me know.

FOR (Click to View)







Pointers (Click to View)







Arrays (Click to View)







Multi-Threading (Click to View)

Found this in my drafts somewhere, and so I decided to just finish it up and post it. Enjoy


* - ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ - Aug 5, 2015

Well done, Qwerty. I'm going to experiment with that multi-threading


* - Ventriloquism - Aug 5, 2015

(Aug 5, 2015 01:56 PM)ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ Wrote:  Well done, Qwerty. I'm going to experiment with that multi-threading

Yeah, same. That looks pretty interesting... thanks bro 🤝

Arrays aren't bad either. Very cool.


* - xxv2012 - Aug 6, 2015

thank you this is very useful ^_^


* - WOLGA - Aug 9, 2015

(Aug 6, 2015 08:24 AM)xxv2012 Wrote:  thank you this is very useful ^_^

Thank you for your top-quality response.


* - ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ - Aug 9, 2015

(Aug 9, 2015 10:45 AM)Qwertyuiopasdfghjklzxc Wrote:  Thank you for your top-quality response.

Sometimes I wish I could rate comments. I'd give you +3 just for that haha. Also, can you explain your multi-threading? I've played with it but I ended up fork bombing myself lol


* - WOLGA - Aug 10, 2015

(Aug 9, 2015 07:45 PM)ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ Wrote:  Sometimes I wish I could rate comments. I'd give you +3 just for that haha. Also, can you explain your multi-threading? I've played with it but I ended up fork bombing myself lol

Of course! I don't blame you at all for having trouble understanding, I explained it poorly (if at all), and will have to update it soon.

Remember that 'game' (https://hackforums.net/showthread.php?tid=4885997) a while ago, where the 'enemy' would move, even if you do not press a key? Multi-threading was crucial then. This is because usually, the enemy will not move unless you move.

What the multi-threading did was essentially let 2 pieces of code run, with what I like to call the 'displayer' and the 'input source'.

The input source would run, and then all it would do is wait for a keypress, and then update a file. Nothing fancy there.

The displayer had two roles. For every few sub-seconds that passed, it would check if the file was updated, and then update the display/screen with the new movements. And then, regardless of whether the file was updated or not, it would move the enemy.

As White Light demonstrated, this technique could also be applied to chat rooms.

Of course, non-blocking inputs are not the only function of multithreading. It can be used to pseudo-parallel process code, as White Light used in his quicksort, which is now unfortunately expired 😭.

Did I explain it well?👍


* - 'Palladium - Aug 11, 2015

Well done on this tutorial, others will find this very useful.


* - ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™ - Aug 11, 2015

(Aug 10, 2015 05:42 PM)Qwertyuiopasdfghjklzxc Wrote:  Of course! I don't blame you at all for having trouble understanding, I explained it poorly (if at all), and will have to update it soon.

Remember that 'game' (https://hackforums.net/showthread.php?tid=4885997) a while ago, where the 'enemy' would move, even if you do not press a key? Multi-threading was crucial then. This is because usually, the enemy will not move unless you move.

What the multi-threading did was essentially let 2 pieces of code run, with what I like to call the 'displayer' and the 'input source'.

The input source would run, and then all it would do is wait for a keypress, and then update a file. Nothing fancy there.

The displayer had two roles. For every few sub-seconds that passed, it would check if the file was updated, and then update the display/screen with the new movements. And then, regardless of whether the file was updated or not, it would move the enemy.

As White Light demonstrated, this technique could also be applied to chat rooms.

Of course, non-blocking inputs are not the only function of multithreading. It can be used to pseudo-parallel process code, as White Light used in his quicksort, which is now unfortunately expired 😭.

Did I explain it well?👍

I'm curious what kind of games could be made with it. And yes you did lol