Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / [STICKY] The Posting Competition

Author
Message
Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 28th Aug 2012 03:20 Edited at: 28th Aug 2012 03:33
Incorrect!

Page!

"MOVE R1,R2"~~Genesis 1:1, Bible
Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 28th Aug 2012 04:49 Edited at: 28th Aug 2012 04:49
Quote: "RETURN:
MOVE R1,!7
MOVE R2,!8
GREATER R2,R1
CJUMP <TRUE>
JUMP <FALSE>
TRUE:
......
JUMP <RETURN>
FALSE:
......
JUMP <RETURN>"

Your assembly is inefficient. This is better:
Quote: "RETURN:
MOVE R1,!7
MOVE R2,!8
LESSEQUAL R2,R1
CJUMP <FALSE>
TRUE:
......
JUMP <RETURN>
FALSE:
......
JUMP <RETURN>"


It's equivalent to the following code:


The jump back to the top is odd considering you're comparing constants. In reality it's better just to do this:


However, if "!" does not specify an immediate (perhaps it specifies a variable) then the code makes a bit more sense, but the overall structure above doesn't change. You haven't incremented R1 or R2 anywhere, and you set them each loop to "!7" and "!8," respectively.

Do I have anything wrong?

Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 28th Aug 2012 08:34 Edited at: 28th Aug 2012 08:34
I forget what I said you earned but you earned that and 25 for the comprehensive answer and suggestion of how it could be more efficient. Sadly LESSEQUAL wouldn't be a supported instruction for the first emulator. You did point out that it was checking constants (the ! is indeed immediate) and inside of a loop but I didn't go for the code to be practical.

Here is essentially what the code would translate to in DBPro:


I don't remember if the greater command checks if the first or second operand is greater, but the above code assumes one of those.

"MOVE R1,R2"~~Genesis 1:1, Bible
Fuzz
18
Years of Service
User Offline
Joined: 14th Nov 2006
Location: Tasmania, Australia
Posted: 28th Aug 2012 08:40
Anyone want a 75% off Portal 2 voucher?

Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 28th Aug 2012 09:26 Edited at: 28th Aug 2012 09:31
Quote: "Anyone want a 75% off Portal 2 voucher?"

Yes. My friend's been bugging me to get it and I've been putting it off because I can't justify it.

Quote: "GREATER R2,R1"

Correct me if I'm wrong, but wouldn't that check (in your example) if num2 > num1, instead of num1 > num2? Or is it reversed?

Fuzz
18
Years of Service
User Offline
Joined: 14th Nov 2006
Location: Tasmania, Australia
Posted: 28th Aug 2012 09:32
Aaron, what's your Steam add? I'll gift you the voucher.

Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 28th Aug 2012 10:02
Hmm... I'm not certain. I used kind of a right to left convention so MOVE will move from the right operand to the left for example... So I'd assume it checks if the right one is greater than the left one. I have the documentation but I don't feel like finding it now!

"MOVE R1,R2"~~Genesis 1:1, Bible
Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 28th Aug 2012 10:03 Edited at: 28th Aug 2012 10:21
My steam user handle is "aaronmiller42". Thanks for the voucher!

Edit
@DBD
Ah, okay. In most assembly syntax (that I'm aware of) the comparison always does it left to right. However, assignment order tends to differ. In the Intel-style it's "destination, source." In the "AT&T" style (if I may use that term), it's "source, destination." I personally prefer the Intel-style, but dislike their ISA, lol!

Fuzz
18
Years of Service
User Offline
Joined: 14th Nov 2006
Location: Tasmania, Australia
Posted: 28th Aug 2012 10:25
Quote: "My steam user handle is "aaronmiller42". Thanks for the voucher!"


Sweet. Added.

Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 28th Aug 2012 10:38
Fuzz
18
Years of Service
User Offline
Joined: 14th Nov 2006
Location: Tasmania, Australia
Posted: 28th Aug 2012 10:46
Now once you accept my request, I'll gift it to you

Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 28th Aug 2012 10:56 Edited at: 28th Aug 2012 10:59
I don't see any requests, or I'd accept it. I'll keep looking around though.

Edit: Okay, it wasn't set up. It is now. Try again?

Fuzz
18
Years of Service
User Offline
Joined: 14th Nov 2006
Location: Tasmania, Australia
Posted: 28th Aug 2012 11:01
Hmmm still won't work. Try adding theobviousfuzz and I'll send it after dinner.

Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 28th Aug 2012 11:10
Alrighty. Sent the request.

I'm a bit tired here though, so I'll check in the morning. Thanks again!

Fuzz
18
Years of Service
User Offline
Joined: 14th Nov 2006
Location: Tasmania, Australia
Posted: 28th Aug 2012 11:20
Sweet, got the invite. Seems the the coupon is only tradable so hopefully you'll be online when I am. It expires on the 30th.

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 28th Aug 2012 19:44
Code::Blocks won't allow me to use the debugger anymore o.O Ever since I installed a newer version of MingW I've been unable to use the debugger. Does anyone know what's going on?

Fractal time!







TheComet

"if you don't understand recursion than you probably don't understand recursion." ~Jerico2day
Aertic
17
Years of Service
User Offline
Joined: 2nd Jul 2007
Location: United Kingdom
Posted: 28th Aug 2012 19:46
I started seeing faces inside of them.
Benjamin
22
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 28th Aug 2012 22:46
Hah, PNG!
Happy Cheesecake
15
Years of Service
User Offline
Joined: 16th Jun 2009
Location: My non-vice-presidential refrigerator.
Posted: 28th Aug 2012 23:31
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 28th Aug 2012 23:42 Edited at: 28th Aug 2012 23:43
Got the debugger to work again, I just re-installed Code::Blocks and that seemed to fix the problem.

TheComet

"if you don't understand recursion than you probably don't understand recursion." ~Jerico2day
Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 28th Aug 2012 23:58
swissolo
15
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 29th Aug 2012 00:03
I copied the entire page and tried to paste it... claims my message contains bad language... where?

swis
Joined: Tue Dec 16th 2008
Interstellar
Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 29th Aug 2012 00:08 Edited at: 29th Aug 2012 21:02
Edit: Works for me.

Edit 2: Does this work?#include <stdio.h>

int main() {
printf("Hello, world!\n");
return 0;
}
[code=cpp]#include <stdio.h>

int main() {
printf("Hello, world!\n");
return 0;
}

Edit 3: Nope. It (code) did not work.

Dark Java Dude 64
Community Leader
14
Years of Service
User Offline
Joined: 21st Sep 2010
Location: Neither here nor there nor anywhere
Posted: 29th Aug 2012 00:10
Holy dimple hole! Make sure to fix that before a mod sees it! (self experience)

"MOVE R1,R2"~~Genesis 1:1, Bible
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Aug 2012 00:11 Edited at: 29th Aug 2012 00:12


Nope.

TheComet

"if you don't understand recursion than you probably don't understand recursion." ~Jerico2day

Attachments

Login to view attachments
Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 29th Aug 2012 00:16 Edited at: 29th Aug 2012 00:19
Quote: "if you don't understand recursion than you probably don't understand recursion."

should be
Quote: "if you don't understand recursion then you probably don't understand recursion."


Edit: See here.
Quote: "4. In that case, therefore (often with "if")

If you want to go, then you'll have to finish your homework.

I'm hungry!
Then you should eat."


Aertic
17
Years of Service
User Offline
Joined: 2nd Jul 2007
Location: United Kingdom
Posted: 29th Aug 2012 00:16
well poop
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 29th Aug 2012 00:24
@ Aaron - I copied it from Jerico... I guess that flushes his and Obese's presidential campaign down the toilet.

TheComet

"if you don't understand recursion than you probably don't understand recursion." ~Jerico2day
Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 29th Aug 2012 00:30
Poop is a palindrome, but well is not.

"A Toyota's A Toyota" is a palindrome.
"Did Hannah see bees? Hannah did." is a palindrome.
"Do, O God, no evil deed! Live on! Do good!" is a palindrome.
"Stella won no wallets." is a palindrome.

"Palindrome" is not a palindrome.

Seppuku Arts
Moderator
20
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 29th Aug 2012 00:35
'Race car' is also a palindrome and so is 'taco cat'.




But points is not.

Indicium
17
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 29th Aug 2012 00:57
IS bukkit for minecraft broke? All chunks are misaligned xD


They see me coding, they hating. http://indi-indicium.blogspot.co.uk/
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 29th Aug 2012 09:41
Happy Cheesecake, they need to be that fat to hibernate when the mutant alligators take over the surface.

mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 29th Aug 2012 13:12
Where did you get the number?

Aertic
17
Years of Service
User Offline
Joined: 2nd Jul 2007
Location: United Kingdom
Posted: 29th Aug 2012 15:43
I am now the proud owner of a pocket abacus.
The Nerevar
15
Years of Service
User Offline
Joined: 19th May 2010
Location: Vvardenfell
Posted: 29th Aug 2012 18:27
hows it going?

Fulfilling the Nerevarine Prophecy, one trial at a time, because I... Am... The Nerevar!
Aaron Miller
19
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 30th Aug 2012 00:56
Seppuku, the cat in that picture looks just like my sister's cat... (Except for the taco part, of course.)

I found source code to a PHP forum software I was working on a while ago. I haven't worked up the courage to go running through that tangled jungle of man eating plants yet. I tried getting the darn thing set up on my web server and it just failed miserably. (Lots of basic fundamentals I need to review there. I never liked PHP or MySQL; they're both horrible.)

I was working on a website in raw C before. I have no idea where the source code to that went. But it was looking pretty decent iirc. I eventually stopped because I added on a scripting language to the C code and realized I was just going down the path of "make this easier to manage" instead of "get this working." Sometimes it's necessary to travel the former path, but I think the problem was the overall design of the source code internally. Besides, it would take a lot more time to get all of the features (I cared about) from PHP and SQL working in my own implementation than it would to just get the website working with those.

Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 30th Aug 2012 01:09
FIRST![u][/u]

Indicium
17
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 30th Aug 2012 01:44
Quote: " I never liked PHP or MySQL; they're both horrible."


They're beautiful!


They see me coding, they hating. http://indi-indicium.blogspot.co.uk/
Yodaman Jer
User Banned
Posted: 30th Aug 2012 02:17 Edited at: 30th Aug 2012 02:21
Why is it so difficult to get a platform to be able to move in different ways along the same axis?!?!?!

After hours of programming, I came up with this codezorzorzorzorzzzz, which allow me to use elevators anyway I want within Unity. And so far, it's just the X axis that's been programmed...



Ridiculous! There has to be a cleaner way... or not. I dunno. It's this messy so that I can literally tell it how to move inside the Unity Editor, and it's completely customizable, from the movement to the starting and ending positions. Part of the reason I have so many ifs-within ifs (ifception?) is because I have to determine if certain variables are greater or less than each other in order to tell the platforms to move the correct way. For such a seemingly simple operation, I can't believe how much code it takes!

And this script isn't even done yet. I next have to tell it to move ONLY when the player first steps onto the platform. That should be an interesting experiment.

"The ships hung in the air in much the same way that bricks don't."
~ Douglas Adams
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 30th Aug 2012 02:40 Edited at: 30th Aug 2012 10:43
You can use objects in unity, right? If so, you should just use 3D vectors and linear interpolation to create a Platform class. You just say (c++ style pseudocode):



That's it! Then you could set platformMoving to true and it would take off in the direction you wanted, and stop once it reached the other side.

I'm not sure why you're doing the code the way you're doing it, it doesn't need to be that complicated. (also, the exact same thing happens whether startX < 0.0 && endX < 0.0 is true or whether startX > 0.0 && endX > 0.0 is true)

swissolo
15
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 30th Aug 2012 02:54
this is a post

swis
Joined: Tue Dec 16th 2008
Interstellar
Yodaman Jer
User Banned
Posted: 30th Aug 2012 03:15
Quote: "also, the exact same thing happens whether startX < 0.0 && endX < 0.0 is true or whether startX > 0.0 && endX > 0.0 is true"


True, but the directions are reversed and that's how the script notices that. I know, it's ridiculously complicated and I only programmed it the way that I did because it was the only way that worked for a change.

Your idea looks good, but I'm not sure what you're talking about with interpolation... my math skills aren't exactly up to par, I guess you could say.

And using vectors is a cool idea, but for me it's still easier to separate the different axis', just for easier reading. I'm still learning a lot with Unity and OOP, so hopefully I'll get better as time goes on.

"The ships hung in the air in much the same way that bricks don't."
~ Douglas Adams
Indicium
17
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 30th Aug 2012 04:02
Eurgh, use vectors man.


They see me coding, they hating. http://indi-indicium.blogspot.co.uk/
Dar13
17
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 30th Aug 2012 04:49
Quote: "Eurgh, use vectors man."

Agreed. Vectors make life so much easier.

Yodaman Jer
User Banned
Posted: 30th Aug 2012 08:15 Edited at: 30th Aug 2012 08:19
Fine, fine, I'll update it to vectors.

I love vectors but just thought it would be easier to see the variables inside Unity if I had them all separated. Nope! Much tidier with vectors.


Quote: "also, the exact same thing happens whether startX < 0.0 && endX < 0.0 is true or whether startX > 0.0 && endX > 0.0 is true"


D'Oh, I see what you were talking about now! What the heck was I thinking? I literally just cut it in half...



I don't suppose you would be willing to explain your function a little more in-depth? I like the sound of less code.

EDIT: The massive amount of redundant code I feel I should explain. You see, I only got 4 hours of sleep last night, and on top of that I'm learning UnityScript from the ground-up, and it's sort of a mix between procedural and OOP, depending on if you use C# or US... so I get confused very easily with it, but I'm learning. It's been great fun so far!

"The ships hung in the air in much the same way that bricks don't."
~ Douglas Adams
Randomness 128
18
Years of Service
User Offline
Joined: 13th Feb 2007
Location:
Posted: 30th Aug 2012 08:19
It's almost September.
Yodaman Jer
User Banned
Posted: 30th Aug 2012 08:26
Ok, completely updated script, all I have to do is add in the functionality for making it so that the platform only responds when the player touches it, and add in the Y/Z directions.



"The ships hung in the air in much the same way that bricks don't."
~ Douglas Adams
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 30th Aug 2012 10:11
I just got the book Moving from C to C++. This should give me some helpful information! I mean, the online tutorials are great and all, but it doesn't deliver you the information in a concentrated form where this book will. And besides, I've seen online tutorials give you false or inefficient methods, so there's not much trust in my relationship with online tutorials.

TheComet

"if you don't understand recursion than you probably don't understand recursion." ~Jerico2day
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 30th Aug 2012 11:20
Sure. The basic idea is that the vector (B-A)t+A will be A when t=0, and B when t=1. So as t varies, the result varies linearly, and you get a line from A to B. I've also seen it written as Bt+A(1-t). Whichever you find clearer to understand/rederive works.

So yeah, when t>1 (and it's moving positively) you stop it moving and reverse the speed's direction. When t<0 (and it's moving negatively), you do the same thing.

For the speed, basically the reason Lerp (linear interpolation) like this isn't always the best choice is because t always varies from 0 to 1, even though the actual distance travelled by the result vector may be huge or tiny. So basically, when you're stepping t, you want it to take distance/speed seconds for t to increase by 1.

So you have distance/speed=totaltime. Since you want t to take totaltime seconds to get to 1, you increase it by timestep/totaltime each time step (timestep=dt in the above function), so that you say t+=dt*speed/distance.


Also: The entire point of using vectors (IMO) is to make it so you don't have to deal with their individual components. The nice thing about the interpolation is that you don't have to deal with the components explicitly! Yes, the equation:

P=(B-A)*t+A
is equivalent to:
P.x=(B.x-A.x)*t+A.x
P.y=(B.y-A.y)*t+A.y
P.z=(B.z-A.z)*t+A.z

but being able to not write it out is great. It becomes really important once you have dot products and other weird things in there, because then it's all interdependent:

A+=((B-A)*X)*A (The first * is dot product, the second * multiplies the scalar (B-A)*X with the vector A)
is NOT equivalent to:
A.x+=((B.x-A.x)*X.x+(B.y-A.y)*X.y+(B.z-A.z)*X.z)*A.x
A.y+=((B.x-A.x)*X.x+(B.y-A.y)*X.y+(B.z-A.z)*X.z)*A.y
A.z+=((B.x-A.x)*X.x+(B.y-A.y)*X.y+(B.z-A.z)*X.z)*A.z

Instead you have to use temporary values:
tmpx=((B.x-A.x)*X.x+(B.y-A.y)*X.y+(B.z-A.z)*X.z)*A.x
tmpy=((B.x-A.x)*X.x+(B.y-A.y)*X.y+(B.z-A.z)*X.z)*A.y
A.z+=((B.x-A.x)*X.x+(B.y-A.y)*X.y+(B.z-A.z)*X.z)*A.z
A.x+=tmpx
A.y+=tmpy

Plus, it's an eyesore and harder to interpret than "A+=((B-A)*X)*A". None of this is really relevant though. I'm just kinda talking at this point. How's the weather?

I ordered some books three days ago. They're still on the other side of the country

Randomness 128
18
Years of Service
User Offline
Joined: 13th Feb 2007
Location:
Posted: 30th Aug 2012 11:24
32,300[i]

Login to post a reply

Server time is: 2025-06-08 22:38:13
Your offset time is: 2025-06-08 22:38:13