hacker.org Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
easiest mathematical scripting tool

 
Reply to topic    hacker.org Forum Index » Challenges View previous topic
View next topic
easiest mathematical scripting tool
Author Message
sjoemelfreek



Joined: 14 Sep 2008
Posts: 15

Post easiest mathematical scripting tool Reply with quote
Hi there,

I've managed to solve 37 challenges without any knowledge about programming but now I have various ideas to solve a challenge but no experience in scripting. And I believe that the fast typing challenges teaches that there is another way...

Any recommendations on accesible scripting languages. I work with a Mac Os X...

Thanks
Sun Oct 12, 2008 8:14 pm View user's profile Send private message
canine



Joined: 14 Sep 2008
Posts: 189

Post Re: easiest mathematical scripting tool Reply with quote
sjoemelfreek wrote:
Hi there,

I've managed to solve 37 challenges without any knowledge about programming but now I have various ideas to solve a challenge but no experience in scripting. And I believe that the fast typing challenges teaches that there is another way...

Any recommendations on accesible scripting languages. I work with a Mac Os X...

Thanks


BC is an excellent calculator language that can be used to solve mathematical problems, and for things that require a bit more general capabilities, I'd suggest python.
Sun Oct 12, 2008 9:36 pm View user's profile Send private message
tails



Joined: 10 Jun 2008
Posts: 191
Location: Tokyo

Post Reply with quote
I know the best language!

All the top hackers here use it when solving challenges.
It's available for free.
It can run on web browsers, so it must work on Mac OS X.
As well as simple calculation, by using it you can count string length, do fast modulus, generate messages, and even solve a maze!

Its program is like this: 23+p
Sun Oct 12, 2008 10:58 pm View user's profile Send private message
canine



Joined: 14 Sep 2008
Posts: 189

Post Reply with quote
tails wrote:
I know the best language!

All the top hackers here use it when solving challenges.
It's available for free.
It can run on web browsers, so it must work on Mac OS X.
As well as simple calculation, by using it you can count string length, do fast modulus, generate messages, and even solve a maze!

Its program is like this: 23+p


wat
Sun Oct 12, 2008 11:34 pm View user's profile Send private message
tails



Joined: 10 Jun 2008
Posts: 191
Location: Tokyo

Post Reply with quote
canine wrote:
wat

A joke. You know we have to use HVM to solve some challenges.
Mon Oct 13, 2008 9:13 am View user's profile Send private message
gfoot



Joined: 05 Sep 2007
Posts: 269
Location: Brighton, UK

Post Reply with quote
I prefer dc to bc, and tails's program runs fine in dc as well as hvm. Smile

They're pretty similar, but you can use the differences between them in interesting ways, e.g. this rather long program prints a different message depending which one you run it in:

Code:

9 3+9*4-4 8*dP9 4+9*1+4 5*5*dP9 3+9*1+9 2+9*dP4 8*P9 3+9*6+P9 3+9*3+P9 2+9*P9 3+9*1-P9 3+9*7+P9 1+P

Mon Oct 13, 2008 10:50 am View user's profile Send private message
canine



Joined: 14 Sep 2008
Posts: 189

Post Reply with quote
tails wrote:
canine wrote:
wat

A joke. You know we have to use HVM to solve some challenges.


Elaborate. I am not sure what you mean by `HVM'.

gfoot wrote:
I prefer dc to bc, and tails's program runs fine in dc as well as hvm. Smile

They're pretty similar, but you can use the differences between them in interesting ways, e.g. this rather long program prints a different message depending which one you run it in:

Code:

9 3+9*4-4 8*dP9 4+9*1+4 5*5*dP9 3+9*1+9 2+9*dP4 8*P9 3+9*6+P9 3+9*3+P9 2+9*P9 3+9*1-P9 3+9*7+P9 1+P


I'm not such a fan of dc. It's terse and complicated and I find polish notation unnatural. Furthermore, bc has alot more features, such as functions.
Mon Oct 13, 2008 1:02 pm View user's profile Send private message
gfoot



Joined: 05 Sep 2007
Posts: 269
Location: Brighton, UK

Post Reply with quote
hvm is a virtual machine similar to dc. http://www.hacker.org/hvm/

I know what you mean about dc, and reverse-polish notation. But dc does have functions - any string between square braces can be stored in a variable and executed later.
Mon Oct 13, 2008 2:20 pm View user's profile Send private message
tails



Joined: 10 Jun 2008
Posts: 191
Location: Tokyo

Post Reply with quote
gfoot, a great code!

I remember I sometimes wrote "d", intending "0^", when I was not used to it. Very Happy

canine wrote:
Elaborate. I am not sure what you mean by `HVM'.

canine, you should know the HVM, the Challenge Hack VM.
Mon Oct 13, 2008 2:33 pm View user's profile Send private message
canine



Joined: 14 Sep 2008
Posts: 189

Post Reply with quote
gfoot wrote:
hvm is a virtual machine similar to dc. http://www.hacker.org/hvm/

I know what you mean about dc, and reverse-polish notation. But dc does have functions - any string between square braces can be stored in a variable and executed later.


Hmm...

The bracket thing in dc is actually a macro, which functions similarly to a function, but is not quite the same thing.

Compare functions in C and macros in C.

Do any challenges actually require hvm? Anyhow, it looks interesting. I may churn out a C implementation sometime, for the fun of it.

Heh. This reminds me of brainfuck.
Mon Oct 13, 2008 2:42 pm View user's profile Send private message
gfoot



Joined: 05 Sep 2007
Posts: 269
Location: Brighton, UK

Post Reply with quote
canine wrote:
Compare functions in C and macros in C.

Although dc calls them macros, they're effectively functions. I can't think of anything a function can do that a dc macro can't. They can recurse indefinitely, and they're not actually expanded until they're executed - the macro is (usually) loaded onto the stack and executed from there. You can return early from a macro (with the quirk that you also kill your parent).
Mon Oct 13, 2008 4:10 pm View user's profile Send private message
canine



Joined: 14 Sep 2008
Posts: 189

Post Reply with quote
gfoot wrote:
canine wrote:
Compare functions in C and macros in C.

Although dc calls them macros, they're effectively functions. I can't think of anything a function can do that a dc macro can't. They can recurse indefinitely, and they're not actually expanded until they're executed - the macro is (usually) loaded onto the stack and executed from there. You can return early from a macro (with the quirk that you also kill your parent).


Hmm...

Indeed.
Mon Oct 13, 2008 5:33 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    hacker.org Forum Index » Challenges All times are GMT
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.