Good vs. Evil

  • FTB will be shutting down this forum by the end of July. To participate in our community discussions, please join our Discord! https://ftb.team/discord

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
15 want to know a funny thing of php?
the "or" operator can either be written as "or" or "||" and generally spoken it doesn't matter which you use. Except that the text version has a lower precedence than the symbol version. Its the same with the "and" operator.

I wonder how many bugs have been introduced because of that....
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
14 Sounds like when people don't know the difference between | and ||, causing some issues. (|| will short-circuit if the first is true, not executing the second. | always executes both operands). A similar thing occurs with & and &&. Technically it's because the single is bitwise and the double is logical, but they perform similar things.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
14
14 Sounds like when people don't know the difference between | and ||, causing some issues. (|| will short-circuit if the first is true, not executing the second. | always executes both operands). A similar thing occurs with & and &&. Technically it's because the single is bitwise and the double is logical, but they perform similar things.
actually, php also has bitwise operators.

One question though. How often are they actually used? Maybe its just me but so far I never had a reason to use bitwise operators of any kind. Is it something you don't realize you need until you actually delve into them or.....?
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
14
One question though. How often are they actually used? Maybe its just me but so far I never had a reason to use bitwise operators of any kind. Is it something you don't realize you need until you actually delve into them or.....?
I've used them, if I need a side effect of both methods being called, but yeah, I don't end up using them that frequently.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
14

I've used them, if I need a side effect of both methods being called, but yeah, I don't end up using them that frequently.
15 I wasn't talking about just the bitwise version of or/and but all the bitwise operators in general.

Also, I would much rather see something like
PHP:
$a = someFunc();
$a = someOtherFunc() && a;
It means you don't have to know the difference between && and & to read it and if there ever is an error you can clearly see which function of the two has problems. But, that is of course personal preference.
 

LordPINE

Well-Known Member
Jan 2, 2016
345
249
69
15. Well, there is some reason on the positive and negative from a mathematical point of view, but the choice between them was indeed purely random. Electrons may just as well have been positively charged, with protons being negative.
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
12 And then there's the whole positive current flow is the direction opposite the actual flow of charge.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
13 so...as I need to make a presentation that should prove that I better learned how to use the terminal and some other things I decided to make the presentation in the terminal rather than to use a powerpoint.

So, time to dust off lua-term, lua poisx and make a "better" rendering engine than the one I used for the little game.

I wrote better in quotes because although it will be more advanced it will also be significant slower. The reason it will be more advanced is that it can actually draw shapes rather than just single characters and also deals correctly when shapes are overlapping. This however comes at the cost of having to update the whole screen each frame while the one from my game only updates the needed parts.

The way it knowns about overlapping is as each object gets stored in a linkedlist ordered based on the Z value of each object. This means that the farthest items get drawn first and it goes up the chain.

Oh, and yes I already know that linked lists aren't fast to loop over but I expect that new objects will be added to it rather often and they have the advantage that placing items in the middle of them is very fast (assuming you already are on the correct spot)

As for why I'm not drawing the closest objects first and just check if a cell already was drawn onto: Lets just start simple. I'm only going to update the screen whenever I press a key so....it doesn't have to be fast.
 

duckfan77

Popular Member
Mar 18, 2013
80
683
118
11 Franklin decided which way positive current was, and then we found out about electrons, and how it's negative charges that flow. So positive current is the direction of "positive charge flow", which isn't a thing, but would be the opposite of a negative charge flow.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
12 and the render can now render "complex" objects.
With complex I mean objects consisting of various characters that may also not be the same width at each line.

Additionally, it can turn command output into those "complex" objects. As a result, I now have a way to run commands and render the output of them at whatever location I want and have it follow the z order rules :)
Speaking of the Z order rules, there seems to be a small bug resulting in objects not always getting added to the list. Weird.....
There is currently also no transparency, meaning that spaces will replace whatever was behind it. Code is in place to add transparency, it just doesn't work yet.

edit: transparency now works. Literally had to change 1 assignment.
 

GamerwithnoGame

Over-Achiever
Jan 29, 2015
2,808
1,507
224
11 Franklin decided which way positive current was, and then we found out about electrons, and how it's negative charges that flow. So positive current is the direction of "positive charge flow", which isn't a thing, but would be the opposite of a negative charge flow.
Interestingly, positively charged "holes" can actually move in a semiconductor - its debatable whether it really counts as a thing, but its still cool.

Conventional current still screws me over when I'm trying to get my head around stuff, because things like transistors have arrows marked with conventional current in circuit diagrams, so when they say "current goes to here from here" or whatever its like "but... no, that's clearly not right, because the electrons move the other way so... wait how does that work then?!". I'm at the point now where I have to just ignore trying to understand it scientifically, and just focus on what it does in a circuit.