[QUOTE=Lord Ned;33517336]Care to elaborate on what exactly "n & 0xfc" does?[/QUOTE]
I would like to know, too.
[QUOTE=synthiac;33517248]converting a 8-bit number to a binary string representation via a lookup table then extracting 6-bits/converting it back into a number using some ungodly 6-comparison macro
vs
(n & 0xfc) >> 2
lol okay lets benchmark[/QUOTE]
I missed the part where he didn't actually use those strings for anything useful. The code is so crypic I couldn't make out what he was doing. I feel like an idiot now. :\
So, if he [i]actually needed [/i]those ascii-encoded-binary strings, a lookup table would be the right way to do it. But he doesn't need the ascii-binary strings to do base64 encoding.
Honestly, I can write code, but I can't read it for shit. It's like some sort of horrible curse.
the non-programming observers don't know [i]what[/i] the hell the difference, theoretically, is between generating the codes on the fly and culling them from a table.
so, me.
is there a different part of the computer working around this? GPU cycles were mentioned but I'd like to hear a more thorough explanation.
I just wrote it how my head would do it, haha. I did it like this:
3 characters:
01110100 00111010 01000110
take base64 value of first six bits of the first char, store the last two, append the first four of the second char to those and find the base64 value, store the last four, append the first two of the third char to those four, take the base64 of that, and finally take the base64 of the remaining 6 bits.
I wish I had known about the bitwise method, but if synthiac could have just told me that much earlier instead of acting superior to me it would have been better.
[editline]1st December 2011[/editline]
[QUOTE=mutated;33517431]the non-programming observers don't know [i]what[/i] the hell the difference, theoretically, is between generating the codes on the fly and culling them from a table.
so, me.
is there a different part of the computer working around this? GPU cycles were mentioned but I'd like to hear a more thorough explanation.[/QUOTE]
I think my method was just more convoluted than the bitwise one... My method used more memory by storing the table and various bits as strings. In truth, my method probably used more CPU cycles than the bitwise one due to its length. Bitwise operations are the easiest operations for a CPU to perform, so that explains the speed of it.
[QUOTE=synthiac;33517501]could you point me to where i was supposedly acting superior?[/QUOTE]
You never clearly explained what he did wrong.
You just said his method was "nieve" and responded with tings like "wow, just wow".
If you had clearly explained what he had done wrong, the debate wouldn't have gone on this wrong. It's late, I spent all day (literally [i]all [/i]day from 10AM to now) working on an assignment, I'm exhausted, and my brain can't grok information right now. On any other day I probably would have picked up on it right away. But not today. So a little help and patience would have been appreciated.
[QUOTE=synthiac;33517501]could you point me to where i was supposedly acting superior?[/QUOTE]
[QUOTE=synthiac;33516119]what[/QUOTE]
Unhelpful, "wowurstupid" type reply.
[QUOTE=synthiac;33516154]that's not a hash table.[/QUOTE]
Unhelpful, not explaining anything.
[QUOTE=synthiac;33516445]i'm not confused by it. it just seems to be very unnecessary and naive.[/QUOTE]
Calling my code bad without giving an alternative
[QUOTE=synthiac;33516541]using bitwise operations like anyone else would
or by representing 24-bit values in base-64[/QUOTE]
Implying I am stupider than "everyone else".
[QUOTE=synthiac;33516653]wow. just wow.[/QUOTE]
Being a dick.
[QUOTE=synthiac;33516828]if it's "a hell of a lot faster" then why does almost every single implementaion use bitwise operations over this "ideal solution"?[/QUOTE]
Once again implying I am worse than "everyone else".
[QUOTE=synthiac;33517248]converting a 8-bit number to a binary string representation via a lookup table then extracting 6-bits/converting it back into a number using some ungodly 6-comparison macro
vs
(n & 0xfc) >> 2
lol okay lets benchmark[/QUOTE]
Giving tiny snippet of code, not explaining it, not taking my code seriously or even explaining how to use yours efficiently and going for a "zing" type reply at me.
I'm not sure if you have something against me or if you're an asshole all the time, but I think people would appreciate it if you were nicer.
I thin he's just an asshole all the time.
[QUOTE=synthiac;33517768]i thought i wouldn't need to explain why it's not a hash table because i supposedly don't know what they are![/QUOTE]
be nice please
[QUOTE=synthiac;33517768]i thought i wouldn't need to explain why it's not a hash table because i supposedly don't know what they are![/QUOTE]
You sound like an immature idiot by attempting to keep this argument alive.
I meant to get some programming done today; I really did.
Instead I spent 3 hours reading about molluscs on wikipedia
Uhhhh, here's some content from yesterday; it's my same old menu library
[img]http://dl.dropbox.com/u/45554193/images/azreegfb.png[/img]
[QUOTE=ZenX2;33517913]I meant to get some programming done today; I really did.
Instead I spent 3 hours reading about molluscs on wikipedia[/QUOTE]
Wikipedia syndrome is a fascinating thing; I don't know of any other website I can lose so much time on and not realize it, even if I'm in the middle of a Hitler-related article.
[QUOTE=amcfaggot;33517115]parsing[/QUOTE]
Try:
[code]
patt = 'href="members/%d+%-([^"]+)'
[/code]
Explanation:
- Match 'href="members/'
- Match 1 or more digits
- Match '-'
- Capture anything until a '"' is reached, then stop
The last couple days have been nothing but fighting.
All of you stop it.
Let's not have the best section on Facepunch go to shit.
Anyway, I'm learning java so I can do android stuff, and I'm most of the way though a TicTacToe game.
[img]http://img265.imageshack.us/img265/9159/woojava.jpg[/img]
[QUOTE=Deco Da Man;33517987]Try:
[code]
patt = 'href="members/%d+%-([^"])'
[/code]
Explanation:
- Match 'href="members/'
- Match 1 or more digits
- Match '-'
- Capture anything until a '"' is reached, then stop[/QUOTE]
Thank you so much! I was trying to figure out how to do that last one for a while, but couldn't figure it out.
[editline]1st December 2011[/editline]
Hmm. Actually, no dice.
[code]C:\Users\Andrew\Documents\Facepunch Lua API>lua main.lua
a
S
T
s
O
L
R
m
Y
Z
D
c
C:\Users\Andrew\Documents\Facepunch Lua API>lua main.lua
amcfaggot
Soviet_Banter
Titz
synthiac
supersnail11
Octave
Lord-Ned
ROBO_DONUT
mutated
Yogurt
ZenX2
Deco-Da-Man
chimitos
[/code]
[QUOTE=Deco Da Man;33517987]Try:
[code]
patt = 'href="members/%d+%-([^"])'
[/code]
Explanation:
- Match 'href="members/'
- Match 1 or more digits
- Match '-'
- Capture anything until a '"' is reached, then stop[/QUOTE]
I'm pretty sure you'd want ([^"]+) ? (It'll capture 1 char only with your method).
I'll rewrite it tomorrow, off to bed now. Nighty nighty, WAYWO.
[editline]1st December 2011[/editline]
[QUOTE=LuaStoned;33518170]I'm pretty sure you'd want ([^"]+) ? (It'll capture 1 char only with your method).[/QUOTE]
Well shit, now I have to try that too. One second.
Fighting? I just scroll until I see a screenshot or a post with a lot of ratings.
Well, I'll be. It worked! Now I don't have to do any more gsub stuff. Thank you, LuaStoned. :)
[code]C:\Users\Andrew\Documents\Facepunch Lua API>lua main.lua
amcfaggot
Soviet_Banter
Titz
synthiac
supersnail11
Octave
Lord-Ned
ROBO_DONUT
mutated
Yogurt
ZenX2
Deco-Da-Man
chimitos
LuaStoned
Ortzinator
[/code]
[editline]1st December 2011[/editline]
Tomorrow I'll have it grab the actual displayed username rather than the href SEO names. If I don't, you'll see hyphens where spaces should be for some names.
Update on my Real-time "What am I listening to" Winamp plug-in.
[IMG]http://triebr.com/MusicSync/fancy/music.php/1.png[/IMG]
Album art isn't working yet. Thinking of the most efficient way to implement it :v:
Why do people make uplink mods all of the sudden?
Did they release a mod API or the source or something?
They released the source code in the latest humble bundle:
[QUOTE]Humble Introversion Bundle customers get access to the source code of Darwinia, Multiwinia, DEFCON, and Uplink![/QUOTE]
Working on rendering Mandelbrot in Love2D. I have a working complex number, but now I need to figure out arithmetic with complex numbers.
I figured out that absolute values of complex numbers are the square root of the real number squared plus the imaginary number squared.
[img]http://i.imgur.com/Vg4bP.png[/img]
But now I can't figure out how to apply the formula z = z^2 + c to the complex number, in code. I would assume that it would work like this, but it doesn't output the correct values.
[code]
-- z.r = -1.468, z.i = 0.4
-- c.r = -1.468, c.i = 0.4
z.r = z.r*z.r + c.r
z.i = z.i*z.i + c.i
-- so it works out to be this
z.r = -1.468 * -1.468 + -1.468
z.i = 0.4 * 0.4 + 0.4
-- z.r = 0.68
-- z.i = 0.56
-- when z should equal
-- z.r = 0.52
-- z.i = 0.77
[/code]
So thats my problem. Anyone here in WAYWO know how to correctly multiply complex numbers or apply this formula?
[editline]e[/editline]
Figured it out. The way I need to multiply complex numbers in code is:
[code]
local nz = {} -- use a buffer so i can compute the correct values
nz.r = (z.r*z.r - z.i*z.i) + c.r -- z = z^2 + c for the real part
nz.i = (z.r*z.i + z.i*z.r) + c.i -- z = z^2 + c for the imaginary part
z = nz -- push the buffer onto Z
[/code]
Got GMod spitting out videos into VP8. 10FPS at 1920x1080. Pretty slow, so probably no good for realtime stuff.
[QUOTE=i300;33518548]Working on rendering Mandelbrot in Love2D. I have a working complex number, but now I need to figure out arithmetic with complex numbers.
I figured out that absolute values of complex numbers are the square root of the real number squared plus the imaginary number squared.
[img]http://i.imgur.com/Vg4bP.png[/img]
But now I can't figure out how to apply the formula z = z^2 + c to the complex number, in code. I would assume that it would work like this, but it doesn't output the correct values.
[code]
-- z.r = -1.468, z.i = 0.4
-- c.r = -1.468, c.i = 0.4
z.r = z.r*z.r + c.r
z.i = z.i*z.i + c.i
-- so it works out to be this
z.r = -1.468 * -1.468 + -1.468
z.i = 0.4 * 0.4 + 0.4
-- z.r = 0.68
-- z.i = 0.56
-- when z should equal
-- z.r = 0.52
-- z.i = 0.77
[/code]
So thats my problem. Anyone here in WAYWO know how to correctly multiply complex numbers or apply this formula?
[editline]e[/editline]
Figured it out. The way I need to multiply complex numbers in code is:
[code]
local nz = {} -- use a buffer so i can compute the correct values
nz.r = (z.r*z.r - z.i*z.i) + c.r -- z = z^2 + c for the real part
nz.i = (z.r*z.i + z.i*z.r) + c.i -- z = z^2 + c for the imaginary part
z = nz -- push the buffer onto Z
[/code][/QUOTE]
Well we're working with complex number in math class and when you want to square it you first translate it to trigonometric form then the square is r^2(cos(2*angle) + i*sin(2*angle)).
[QUOTE=Jookia;33516094]Why would you take comments out?[/QUOTE]
optimization
[QUOTE=swift and shift;33518706]optimization[/QUOTE]
But the managers pay me on lines of code!! I need those comments for more pay!!
So there I was, browsing the Uplink source code when suddenly...
[cpp]void TaskManager::RunSoftware ( char *name, float version )
{
UplinkTask *task = NULL;
// Create the new task
if ( strcmp ( name, "Password_Breaker" ) == 0 ) { task = new PasswordBreaker (); }
else if ( strcmp ( name, "Dictionary_Hacker" ) == 0 ) { task = new DictionaryHacker (); }
else if ( strcmp ( name, "Trace_Tracker" ) == 0 ) { task = new TraceTracker (); }
else if ( strcmp ( name, "File_Copier" ) == 0 ) { task = new FileCopier ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "File_Deleter" ) == 0 ) { task = new FileDeleter ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Defrag" ) == 0 ) task = new Defrag ();
else if ( strcmp ( name, "Log_Deleter" ) == 0 ) { task = new LogDeleter ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Log_UnDeleter" ) == 0 ) { task = new LogUnDeleter ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Log_Modifier" ) == 0 ) { task = new LogModifier ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Decrypter" ) == 0 ) { task = new Decrypter ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "IP_Lookup" ) == 0 ) { task = new IPLookup (); }
else if ( strcmp ( name, "Gateway_Nuke" ) == 0 ) { task = new GatewayNuke (); }
else if ( strcmp ( name, "Motion_Sensor" ) == 0 ) { task = new MotionSensor (); }
else if ( strcmp ( name, "Proxy_Disable" ) == 0 ) { task = new ProxyDisable (); }
else if ( strcmp ( name, "Firewall_Disable" ) == 0 ) { task = new FirewallDisable (); }
else if ( strcmp ( name, "IP_Probe" ) == 0 ) { task = new IPProbe (); }
else if ( strcmp ( name, "Proxy_Bypass" ) == 0 ) { task = new SecurityBypass ( SECURITY_TYPE_PROXY );
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Firewall_Bypass" ) == 0 ) { task = new SecurityBypass ( SECURITY_TYPE_FIREWALL );
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Encryption_Bypass" ) == 0 ) { task = new SecurityBypass ( SECURITY_TYPE_ENCRYPTION );
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Monitor_Bypass" ) == 0 ) { task = new SecurityBypass ( SECURITY_TYPE_MONITOR );
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Revelation" ) == 0 ) { task = new Revelation (); }
else if ( strcmp ( name, "Tutorial" ) == 0 ) { task = new Tutorial (); }
else if ( strcmp ( name, "Decypher" ) == 0 ) { task = new Decypher ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Voice_Analyser" ) == 0 ) { task = new VoiceAnalyser (); }
else if ( strcmp ( name, "Revelation_Tracker" ) == 0 ) { task = new RevelationTracker ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Uplink_Agent_List" ) == 0 ) task = new UplinkAgentList ();
else if ( strcmp ( name, "Faith" ) == 0 ) task = new Faith ();
else if ( strcmp ( name, "LAN_Scan" ) == 0 ) task = new LanScan ();
else if ( strcmp ( name, "LAN_Probe" ) == 0 ) { task = new LanProbe ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "LAN_Spoof" ) == 0 ) { task = new LanSpoof ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "LAN_Force" ) == 0 ) { task = new LanForce ();
task->SetFollowMouse ( true ); }
else {
printf ( "Task Manager warning : Called RunSoftware, name not recognised '%s'\n", name );
return;
}
// Run the new task
task->SetVersion ( version );
int pid = SvbRegisterTask ( name, task );
SetTargetProgram ( pid );
}[/cpp]
That's some [I]sexy[/I] code right there.
can we stop bitching about indie game studios' bad code? it gets tiring pretty quickly
[QUOTE=swift and shift;33518793]can we stop bitching about indie game studios' bad code? it gets tiring pretty quickly[/QUOTE]
I wouldn't call that bad code, it could be done better but it's certainly not horrible code.
[QUOTE=Chris220;33518720]So there I was, browsing the Uplink source code when suddenly...
[cpp]void TaskManager::RunSoftware ( char *name, float version )
{
UplinkTask *task = NULL;
// Create the new task
if ( strcmp ( name, "Password_Breaker" ) == 0 ) { task = new PasswordBreaker (); }
else if ( strcmp ( name, "Dictionary_Hacker" ) == 0 ) { task = new DictionaryHacker (); }
else if ( strcmp ( name, "Trace_Tracker" ) == 0 ) { task = new TraceTracker (); }
else if ( strcmp ( name, "File_Copier" ) == 0 ) { task = new FileCopier ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "File_Deleter" ) == 0 ) { task = new FileDeleter ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Defrag" ) == 0 ) task = new Defrag ();
else if ( strcmp ( name, "Log_Deleter" ) == 0 ) { task = new LogDeleter ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Log_UnDeleter" ) == 0 ) { task = new LogUnDeleter ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Log_Modifier" ) == 0 ) { task = new LogModifier ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Decrypter" ) == 0 ) { task = new Decrypter ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "IP_Lookup" ) == 0 ) { task = new IPLookup (); }
else if ( strcmp ( name, "Gateway_Nuke" ) == 0 ) { task = new GatewayNuke (); }
else if ( strcmp ( name, "Motion_Sensor" ) == 0 ) { task = new MotionSensor (); }
else if ( strcmp ( name, "Proxy_Disable" ) == 0 ) { task = new ProxyDisable (); }
else if ( strcmp ( name, "Firewall_Disable" ) == 0 ) { task = new FirewallDisable (); }
else if ( strcmp ( name, "IP_Probe" ) == 0 ) { task = new IPProbe (); }
else if ( strcmp ( name, "Proxy_Bypass" ) == 0 ) { task = new SecurityBypass ( SECURITY_TYPE_PROXY );
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Firewall_Bypass" ) == 0 ) { task = new SecurityBypass ( SECURITY_TYPE_FIREWALL );
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Encryption_Bypass" ) == 0 ) { task = new SecurityBypass ( SECURITY_TYPE_ENCRYPTION );
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Monitor_Bypass" ) == 0 ) { task = new SecurityBypass ( SECURITY_TYPE_MONITOR );
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Revelation" ) == 0 ) { task = new Revelation (); }
else if ( strcmp ( name, "Tutorial" ) == 0 ) { task = new Tutorial (); }
else if ( strcmp ( name, "Decypher" ) == 0 ) { task = new Decypher ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Voice_Analyser" ) == 0 ) { task = new VoiceAnalyser (); }
else if ( strcmp ( name, "Revelation_Tracker" ) == 0 ) { task = new RevelationTracker ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "Uplink_Agent_List" ) == 0 ) task = new UplinkAgentList ();
else if ( strcmp ( name, "Faith" ) == 0 ) task = new Faith ();
else if ( strcmp ( name, "LAN_Scan" ) == 0 ) task = new LanScan ();
else if ( strcmp ( name, "LAN_Probe" ) == 0 ) { task = new LanProbe ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "LAN_Spoof" ) == 0 ) { task = new LanSpoof ();
task->SetFollowMouse ( true ); }
else if ( strcmp ( name, "LAN_Force" ) == 0 ) { task = new LanForce ();
task->SetFollowMouse ( true ); }
else {
printf ( "Task Manager warning : Called RunSoftware, name not recognised '%s'\n", name );
return;
}
// Run the new task
task->SetVersion ( version );
int pid = SvbRegisterTask ( name, task );
SetTargetProgram ( pid );
}[/cpp]
That's some [I]sexy[/I] code right there.[/QUOTE]
I can never tell if you guys are sarcastic with these posts or not...
Sorry, you need to Log In to post a reply to this thread.