Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > >

Notices

Programming Discussions about computer programming

Reply
 
Thread Tools Display Modes
Old 12-11-2014, 07:49 PM   #151
Allen C
journeyman
 
Join Date: Oct 2004
Posts: 379
Re: Programming homework and newbie help thread

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.
Allen C is offline   Reply With Quote
Old 12-11-2014, 08:12 PM   #152
Allen C
journeyman
 
Join Date: Oct 2004
Posts: 379
Re: Programming homework and newbie help thread

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.
Allen C is offline   Reply With Quote
Old 12-11-2014, 10:02 PM   #153
Acemanhattan
veteran
 
Acemanhattan's Avatar
 
Join Date: Jan 2007
Location: PDX Oregon
Posts: 2,978
Re: Programming homework and newbie help thread

Thanks for sharing your knowledge with me and answering my questions about this.
Acemanhattan is offline   Reply With Quote
Old 12-12-2014, 12:09 AM   #154
Anais
Carpal \'Tunnel
 
Anais's Avatar
 
Join Date: Mar 2006
Posts: 6,666
Re: Programming homework and newbie help thread

Quote:
Originally Posted by Allen C View Post
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
Anais is offline   Reply With Quote
Old 12-12-2014, 02:03 AM   #155
ChrisV
Carpal \'Tunnel
 
ChrisV's Avatar
 
Join Date: Jul 2004
Location: Adelaide, Australia
Posts: 34,837
Re: Programming homework and newbie help thread

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.
ChrisV is offline   Reply With Quote
Old 12-12-2014, 02:38 AM   #156
Acemanhattan
veteran
 
Acemanhattan's Avatar
 
Join Date: Jan 2007
Location: PDX Oregon
Posts: 2,978
Re: Programming homework and newbie help thread

Quote:
Originally Posted by ChrisV View Post
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)?
Acemanhattan is offline   Reply With Quote
Old 12-12-2014, 05:20 AM   #157
ChrisV
Carpal \'Tunnel
 
ChrisV's Avatar
 
Join Date: Jul 2004
Location: Adelaide, Australia
Posts: 34,837
Re: Programming homework and newbie help thread

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.
ChrisV is offline   Reply With Quote
Old 12-12-2014, 02:19 PM   #158
catsec
centurion
 
catsec's Avatar
 
Join Date: Apr 2014
Location: hunting shells
Posts: 179
Re: Programming homework and newbie help thread

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.
catsec is offline   Reply With Quote
Old 12-12-2014, 03:57 PM   #159
Anais
Carpal \'Tunnel
 
Anais's Avatar
 
Join Date: Mar 2006
Posts: 6,666
Re: Programming homework and newbie help thread

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.
Anais is offline   Reply With Quote
Old 12-12-2014, 04:15 PM   #160
catsec
centurion
 
catsec's Avatar
 
Join Date: Apr 2014
Location: hunting shells
Posts: 179
Re: Programming homework and newbie help thread

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!
catsec is offline   Reply With Quote
Old 12-14-2014, 05:48 AM   #161
Sugar Nut
Carpal \'Tunnel
 
Sugar Nut's Avatar
 
Join Date: Nov 2007
Location: You Gonna Get Heynckes'd!
Posts: 17,811
Re: Programming homework and newbie help thread

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.
Sugar Nut is offline   Reply With Quote
Old 12-14-2014, 06:10 AM   #162
Mr.mmmKay
Drugs are bad...
 
Mr.mmmKay's Avatar
 
Join Date: May 2011
Posts: 13,711
Re: Programming homework and newbie help thread

Quote:
Originally Posted by Sugar Nut View Post
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
Mr.mmmKay is offline   Reply With Quote
Old 12-14-2014, 06:13 AM   #163
Sugar Nut
Carpal \'Tunnel
 
Sugar Nut's Avatar
 
Join Date: Nov 2007
Location: You Gonna Get Heynckes'd!
Posts: 17,811
Re: Programming homework and newbie help thread

Holy fook, rofl.

Thanks, mate. Works as intended now.
Sugar Nut is offline   Reply With Quote
Old 12-14-2014, 06:42 AM   #164
Anais
Carpal \'Tunnel
 
Anais's Avatar
 
Join Date: Mar 2006
Posts: 6,666
Re: Programming homework and newbie help thread

feel a spam bomb coming on
Anais is offline   Reply With Quote
Old 12-14-2014, 07:24 AM   #165
ChrisV
Carpal \'Tunnel
 
ChrisV's Avatar
 
Join Date: Jul 2004
Location: Adelaide, Australia
Posts: 34,837
Re: Programming homework and newbie help thread

Quote:
Originally Posted by Mr.mmmKay View Post
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.
ChrisV is offline   Reply With Quote
Old 12-14-2014, 08:34 AM   #166
Mr.mmmKay
Drugs are bad...
 
Mr.mmmKay's Avatar
 
Join Date: May 2011
Posts: 13,711
Re: Programming homework and newbie help thread

I have no idea but it definitely leads to some confusing errors
Mr.mmmKay is offline   Reply With Quote
Old 12-14-2014, 09:20 AM   #167
Xhad
Carpal \'Tunnel
 
Xhad's Avatar
 
Join Date: Jul 2005
Location: hatredcopter
Posts: 10,962
Re: Programming homework and newbie help thread

Quote:
Originally Posted by ChrisV View Post
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.
Xhad is offline   Reply With Quote
Old 12-14-2014, 10:08 AM   #168
adios
Carpal \'Tunnel
 
Join Date: Sep 2002
Location: Russian Troll
Posts: 20,917
Re: Programming homework and newbie help thread

Quote:
Originally Posted by ChrisV View Post
...
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.
adios is offline   Reply With Quote
Old 12-14-2014, 03:56 PM   #169
kazana
Pooh-Bah
 
kazana's Avatar
 
Join Date: May 2006
Location: que, said che
Posts: 5,659
Re: Programming homework and newbie help thread

Quote:
Originally Posted by adios View Post
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.
kazana is offline   Reply With Quote
Old 12-21-2014, 10:09 PM   #170
Atlantis1
adept
 
Join Date: Mar 2013
Posts: 1,006
Re: Programming homework and newbie help thread

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?
Atlantis1 is offline   Reply With Quote
Old 12-21-2014, 10:44 PM   #171
Anais
Carpal \'Tunnel
 
Anais's Avatar
 
Join Date: Mar 2006
Posts: 6,666
Re: Programming homework and newbie help thread

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
Anais is offline   Reply With Quote
Old 12-21-2014, 10:55 PM   #172
Atlantis1
adept
 
Join Date: Mar 2013
Posts: 1,006
Re: Programming homework and newbie help thread

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
Atlantis1 is offline   Reply With Quote
Old 12-21-2014, 10:59 PM   #173
daveT
S.A.G.E. Master
 
daveT's Avatar
 
Join Date: Jun 2005
Location: Why didn't I use Clojure instead?
Posts: 21,898
Re: Programming homework and newbie help thread

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
daveT is offline   Reply With Quote
Old 12-22-2014, 08:08 AM   #174
Anais
Carpal \'Tunnel
 
Anais's Avatar
 
Join Date: Mar 2006
Posts: 6,666
Re: Programming homework and newbie help thread

Quote:
Originally Posted by Atlantis1 View Post
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
Anais is offline   Reply With Quote
Old 01-02-2015, 09:12 AM   #175
Anais
Carpal \'Tunnel
 
Anais's Avatar
 
Join Date: Mar 2006
Posts: 6,666
Re: Programming homework and newbie help thread

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.
Anais is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Forum Jump


All times are GMT -4. The time now is 09:55 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © 2008-2017, Two Plus Two Interactive
 
 
Poker Players - Streaming Live Online