Open Side Menu Go to the Top
Register
Programming homework and newbie help thread Programming homework and newbie help thread

12-11-2014 , 07:49 PM
Oops, ChrisV is right. At first I though 5x5 didn't sound like much but I guess it's bounded by 25! (you get to subtract the many games that finish early but it will still be huge). But that's only with a completely naive implementation. You can surely make use of the fact that there should be at most 25 choose 13 (5million) leaf nodes because many paths lead to the same state. It'll take some ingenuity.

Anyway the point is there is lots of stuff that is easy to do slow and big but hard to do fast and small.
Programming homework and newbie help thread Quote
12-11-2014 , 08:12 PM
Anais -

If you've taken a college course on programming you can do it. It doesn't matter whether you have all the skills you need now, by the time the project is over you'll have them!

One thing you'll need to decide is what level you want to work on. For instance just writing an evaluator that tells you what beats what can be quite a bit of work. Instead there are many libraries available in c/c++, which it sounds like you are using. It will be good practice just to learn to find, download, compile, link, edit? one of those to use.
Programming homework and newbie help thread Quote
12-11-2014 , 10:02 PM
Thanks for sharing your knowledge with me and answering my questions about this.
Programming homework and newbie help thread Quote
12-12-2014 , 12:09 AM
Quote:
Originally Posted by Allen C
Anais -

If you've taken a college course on programming you can do it. It doesn't matter whether you have all the skills you need now, by the time the project is over you'll have them!

One thing you'll need to decide is what level you want to work on. For instance just writing an evaluator that tells you what beats what can be quite a bit of work. Instead there are many libraries available in c/c++, which it sounds like you are using. It will be good practice just to learn to find, download, compile, link, edit? one of those to use.
sadly, we didn't get much practice (read: any) using or importing or writing other libraries in c++ aside from the standard ones. We saw the teacher do it once, but it was pretty quick and she didn't explain how to do it.

will hopefully have time at work to read ahead and get amazing before next semester
Programming homework and newbie help thread Quote
12-12-2014 , 02:03 AM
Ace:

If you wanted to do this still, building a 3x3 hex solver (the type I said I could probably knock out in a couple hours) just using minimax is probably within your reach and would teach you a lot about concepts like recursion, tree structures etc. It might be too hard for a beginner - hard to evaluate given how little I know about you, your knowledge and capabilities, etc.

3x3 could be solved in reasonable time with even the slowest, least optimised solver. Then after that you could decide whether you wanted to keep learning about optimisations or do something else.
Programming homework and newbie help thread Quote
12-12-2014 , 02:38 AM
Quote:
Originally Posted by ChrisV
Ace:

If you wanted to do this still, building a 3x3 hex solver (the type I said I could probably knock out in a couple hours) just using minimax is probably within your reach and would teach you a lot about concepts like recursion, tree structures etc. It might be too hard for a beginner - hard to evaluate given how little I know about you, your knowledge and capabilities, etc.

3x3 could be solved in reasonable time with even the slowest, least optimised solver. Then after that you could decide whether you wanted to keep learning about optimisations or do something else.
I took an introductory c++ class about 18 months ago so I have a little intuition about the basics. What language would you recommend playing around in given that I need to learn the type of programming applicable to actuarial work (I keep hearing things about SQL, SAS, R. I'm under the impression that those deal with databases and it sounds like a hex solver is a completely different thing, but if there is any overlap/way to kill two birds with one stone that would be nice)?
Programming homework and newbie help thread Quote
12-12-2014 , 05:20 AM
SAS and R are statistics packages, I know nothing about them other than that. SQL deals with databases.

If your aim is purely to learn about programming as it relates to actuarial work, I'm not an actuary so I can't offer a lot of advice, other than that this hex solver thing is definitely not a good fit. C++ is also not a good language for actuarial/finance stuff. It's a language designed to build big embedded systems.

Learning SQL might give you a good base for learning stats packages later. Basic SQL is easy if you understand sets and the ways in which they can be joined or combined. I can't really suggest a pet project though, maybe someone else has an idea.

If you wanted to learn a general purpose programming language, a guy who works as a trader in Singapore told me that the language of choice among quants and other finance types is generally Python.

If you're learning for actual usefulness in your day job though, I would go with SQL and maybe moving on to SAS or R later.
Programming homework and newbie help thread Quote
12-12-2014 , 02:19 PM
Anais,


I'm curious what made you choose C++ as a language to study? I'm still very much learning the pros and cons of the various languages, and why people choose them over different languages.
Programming homework and newbie help thread Quote
12-12-2014 , 03:57 PM
cat -

first, thank you for the very detailed response in the other thread. I haven't had time to go thru it all, but I will say that I'm more interested in the idea of working for a security firm writing anti-virus stuff, studying the workings of viruses, that sort of thing, than actually doing any hacking myself. I guess part of it will undoubtedly be learning by doing, so it's probably something I'd have to do anyway. (At least from what I know, network hardening is like that)

wrt languages: I started college in computer science but dropped out during the first semester basically. I thought it was a field you could get through without reading (I was pretty young, and more than a little dumb at the time), and as such I never got far. C++ was, I think, the first language we wrote anything in.

In fact, I'm pretty sure at the time (10+ years ago) there weren't many other options at my school. Now I see places starting with python and other easier-to-learn languages, but just because of how big a set back it was to leave school only to come back to the same discipline, I really wanted to tackle C++. Kinda like my digital white whale, if you know what I mean.
Programming homework and newbie help thread Quote
12-12-2014 , 04:15 PM
Interesting, thanks!

Also, you're welcome. But in your case, you might be more interested in a couple books I have but didn't think to recommend, as I haven't really gone through them much yet, as I felt I should have a solid grasp of programming before diving into them.

Practical Malware Analysis, by Michael Sikorski, and Andrew Honig
Malware Forensics Field Guide for Windows Systems: Digital Forensics Field Guide, by Cameron H. Malin, Eoghan Casey, and James M. Aquilina

I don't like to recommend books I don't have personally, even if I haven't really read much of them, but another that is highly regarded that I have yet to get, but plan to is The Rootkit Arsenal: Escape and Evasion in The Dark Corners of The System, by Bill Blunden.

You'll also want to become familiar with OllyDbg, and tools like it.
http://www.ollydbg.de/
https://en.wikipedia.org/wiki/OllyDbg

I personally think what you're considering going into is a noble craft. The world needs more security researchers! Good luck!
Programming homework and newbie help thread Quote
12-14-2014 , 05:48 AM
So, I'm teaching myself Python through instructional stuff I find online and through googling (mostly googling actually). Whenever I learn something new, I try to write my own little script implementing it, as opposed to just copying what I found and moving on to the next subject.

Now, I just learned about functions and modules, how to import them and how to call them up (not sure if my lingo is correct here).

So, I wrote this script called math.py

Code:
def run(int1, int2):
    add = int1 + int2
    sub = int1 - int2
    mul = int1 * int2
    div = int1 / int2
    
    print "The sum of %d and %d is:" % (int1, int2), add
    print "%d subtracted from %d is:" % (int2, int1), sub
    print "%d times %d is:" % (int1, int2), mul
    print "%d divided by %d is:" % (int1, int2), div
It works just fine on its own, that is, if I add another line in the end like so:

Code:
run(6, 3)
and then run the program, the output looks as intended:

Quote:
The sum of 6 and 3 is: 9
3 subtracted from 6 is: 3
6 times 3 is: 18
6 divided by 3 is: 2
However, if I make another script, callMath.py

Code:
import math

math.run(6, 3)
I get the following error message:

Quote:
Traceback (most recent call last):
File "callMath.py", line 3, in <module>
math.run(6, 3)
AttributeError: 'module' object has no attribute 'run'
-----------------------------------------------------

I've written and imported other scripts like that before. This was basically just a repetition exercise of what I had learned yesterday, before I move on to today's lesson.

These are two scripts I have written yesterday:

cmpr.py

Code:
def compare(int1, int2):
    if int1 > int2:
        print "%d is greater than %d." % (int1, int2)
    
    elif int1 < int2:
        print "%d is smaller than %d." % (int1, int2)
        
    else:
        print "%d and %d are equal." % (int1, int2)
callCmpr.py

Code:
import cmpr

cmpr.compare(5, 3)
If I run callCmpr.py, the output is a satisfactory:

Quote:
5 is greater than 3.
As far as I'm able to tell, I'm doing the exact same thing in both cases. Googling didn't help this time, either.

Last edited by Sugar Nut; 12-14-2014 at 05:57 AM.
Programming homework and newbie help thread Quote
12-14-2014 , 06:10 AM
Quote:
Originally Posted by Sugar Nut
So, I'm teaching myself Python through instructional stuff I find online and through googling (mostly googling actually). Whenever I learn something new, I try to write my own little script implementing it, as opposed to just copying what I found and moving on to the next subject.

Now, I just learned about functions and modules, how to import them and how to call them up (not sure if my lingo is correct here).

So, I wrote this script called math.py

Code:
def run(int1, int2):
    add = int1 + int2
    sub = int1 - int2
    mul = int1 * int2
    div = int1 / int2
    
    print "The sum of %d and %d is:" % (int1, int2), add
    print "%d subtracted from %d is:" % (int2, int1), sub
    print "%d times %d is:" % (int1, int2), mul
    print "%d divided by %d is:" % (int1, int2), div
It works just fine on its own, that is, if I add another line in the end like so:

Code:
run(6, 3)
and then run the program, the output looks as intended:



However, if I make another script, callMath.py

Code:
import math

math.run(6, 3)
I get the following error message:



-----------------------------------------------------
It's because math is a default python package so it will choose that one before yours. You could name yours my_math.py or something. I did the exact same thing while learning Python
Programming homework and newbie help thread Quote
12-14-2014 , 06:13 AM
Holy fook, rofl.

Thanks, mate. Works as intended now.
Programming homework and newbie help thread Quote
12-14-2014 , 06:42 AM
feel a spam bomb coming on
Programming homework and newbie help thread Quote
12-14-2014 , 07:24 AM
Quote:
Originally Posted by Mr.mmmKay
It's because math is a default python package so it will choose that one before yours. You could name yours my_math.py or something. I did the exact same thing while learning Python
Is there any reason this is allowed? Seems like attempting to define a package with the same name as a core package should throw an exception, if it's just not going to let you use the package later anyway.
Programming homework and newbie help thread Quote
12-14-2014 , 08:34 AM
I have no idea but it definitely leads to some confusing errors
Programming homework and newbie help thread Quote
12-14-2014 , 09:20 AM
Quote:
Originally Posted by ChrisV
Is there any reason this is allowed? Seems like attempting to define a package with the same name as a core package should throw an exception, if it's just not going to let you use the package later anyway.

In python, there's no syntactic difference between a standalone script and a module. So there's not really any logical point to throw such an error. I also seem to recall some way to tell the interpreter to import the local one but I haven't used python in awhile.
Programming homework and newbie help thread Quote
12-14-2014 , 10:08 AM
Quote:
Originally Posted by ChrisV
...
C++ is also not a good language for actuarial/finance stuff. It's a language designed to build big embedded systems.
...
Actually this is incorrect. You might be amazed at how many hedge funds are looking for expert C++ developers and C++ is largely eschewed for embedded development due to the overhead it imposes including the overhead for STL. C is definitely the language of choice for embedded development.
Programming homework and newbie help thread Quote
12-14-2014 , 03:56 PM
Quote:
Originally Posted by adios
Actually this is incorrect. You might be amazed at how many hedge funds are looking for expert C++ developers and C++ is largely eschewed for embedded development due to the overhead it imposes including the overhead for STL. C is definitely the language of choice for embedded development.
Having worked in both fields (big finance & embedded soft), I can confirm all of adios' points from my experience.

Had the impression that embedded software providers are trying to move more towards C++, though. Legacy code bases usually in C, therefore still used a lot. Just not necessarily the default choice for green field projects anymore.
Programming homework and newbie help thread Quote
12-21-2014 , 10:09 PM
Sorry I got a bit confused reading the past couple of pages.

I am looking to apply for a job in option trader, as a trader. However I was told being able to code was a plus. I was told either python or c++. I have the feeling I do not have to be super good, since the job I will be applying to is just screentrading.

I am looking to apply for this job in roughly a year. I have an Economic background, I am handy with computers but have never programmed. I am good with numbers and math, but I do not have a mathematics background.

If you were me.

What would you do?
Programming homework and newbie help thread Quote
12-21-2014 , 10:44 PM
If you can self study like a mofo, do it. Otherwise, maybe find courses at a community college. Even if you don't end up using it in your job, it still wouldn't be bad to learn.

If you can squeeze an extra class in during summer and get three knocked out in a year, all the better
Programming homework and newbie help thread Quote
12-21-2014 , 10:55 PM
hey thanks for replying.

Unfortunately where I live there are no community colleges, but I can take some courses at university though.

What do you actually mean with knock out 3?

Thanks again.

A
Programming homework and newbie help thread Quote
12-21-2014 , 10:59 PM
The intro to programming course on EdX would probably be up your alley. Pretty heavy on math and statistics, but not incredibly difficult math.

https://www.edx.org/course/introduct...mitx-6-00-1x-0
Programming homework and newbie help thread Quote
12-22-2014 , 08:08 AM
Quote:
Originally Posted by Atlantis1
What do you actually mean with knock out 3?
Like take c++ 101 in the spring semester, 102 in the summer, 103 in the fall, as opposed to just 101 in the fall and 102 in the spring.

If the uni is too pricey, look for community colleges in your state with online learning available. You can usually get a credit hour for less than a hundred, where as a full blown university might be upwards of four hundred a credit hour
Programming homework and newbie help thread Quote
01-02-2015 , 09:12 AM
DePaul graduate credits are 800 an hour, woof! For that kinda money, that degree better suck my d...

Uh, anyway.

Are there any good books the seasoned vets or other newbies might know of that would be skill-appropriate for the starter programmers to read, which aren't your basic "learn language x" book?

Giz picked up a few books on programming for us, but I think they're a bit beyond the level we're at. Just looking for something interesting to read between semesters, but also something I'll understand (as the LC thread here isn't always a good source for that).

Heck, even websites or blogs would be good.
Programming homework and newbie help thread Quote

      
m