Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > General Gambling > Probability
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 10-20-2006, 01:10 AM
iversonian iversonian is offline
Senior Member
 
Join Date: Sep 2003
Posts: 367
Default Re: Suitable programming language

The correct answer is VBA using Excel. Chances are, you already have it installed, so cost is $0. VBA is easy to learn and forgiving to newbs. Having the spreadsheet there lets you do things in a very hands-on, non-abstract manner.

Here's a made up problem with VBA code that simulates the game to demonstrate how easy VBA is and how to manipulate the workbook. Open excel, right click "Sheet1" and select View Code. Into the window that pops up, copy the subroutine below and hit Run (the play button).

The problem posed is the following: Two players are engaged in a 10 round contest. The winner of each round is the one who produces the higher score X, where X is a random variable with flat distribution from 0 to Y, where Y is a random variable with a flat distribution from 0 to 1 that is constant through all 10 rounds. What are the chances that one player wins all 10 rounds?

Sub test()

iterations = 100000
Range("A1") = 0

For iter = 1 To iterations
p1skill = Rnd
p2skill = Rnd
p1score = 0

For game = 1 To 10
If p1skill * Rnd > p2skill * Rnd Then p1score = p1score + 1
Next game

If p1score = 0 Or p1score = 10 Then Range("A1") = Range("A1") + 1
Next iter

MsgBox Range("A1") / iterations

End Sub
Reply With Quote
  #12  
Old 10-20-2006, 09:56 AM
PrayingMantis PrayingMantis is offline
Senior Member
 
Join Date: Nov 2003
Location: some war zone
Posts: 2,443
Default Re: Suitable programming language

Thanks all.

After reviewing all the replies, asking around some more and doing some basic research, I'm going for the VBA with excel option. At least, that's where I'm going to start.
Reply With Quote
  #13  
Old 10-23-2006, 03:00 PM
fnord_too fnord_too is offline
Senior Member
 
Join Date: May 2004
Location: February made me shiver
Posts: 9,200
Default Re: Suitable programming language

PM,

The problem with Excel using VBA is it really starts breaking down when your simulations get large. If you are doing (relatively) simple things it is absolutely great. For instance, I do lots and lots of pf all in analysis in Excel. For more complex problems I use Java almost exclusively. It's free, eclipse is a free integrated development environment (IDE) that is about the best I have seen free or otherwise for any language.

What type of analysis are you trying to do? You may not even need VBA. If you do though, you should start to think about doing it in another laguage.

To whoever suggested Perl was slower than C, some calculations actually run faster in Perl than in native C, and most Perl programs are close. (This is truly odd Perl is (at least was) actually written in C and does JIT compilation IIRC. I have never worked with Python, but Perl is much faster than you may think.) What ever happened to Perl 6, btw? It was a year away like 5 years ago, now they don't even have a target date?
Reply With Quote
  #14  
Old 10-23-2006, 07:52 PM
PrayingMantis PrayingMantis is offline
Senior Member
 
Join Date: Nov 2003
Location: some war zone
Posts: 2,443
Default Re: Suitable programming language

fnord,

[ QUOTE ]
What type of analysis are you trying to do? You may not even need VBA. If you do though, you should start to think about doing it in another laguage.

[/ QUOTE ]

I have lots of different ideas for simulations, many of them naturally deal with poker scenarios, HU, sng play and tournament enviroment, but I also have a few more abstract ideas with regard to variance and risk of ruin for instance, that I would really like to simulate and test by myself, and I wanted to do so for a long while now.

I wouldn't think that these are particularly "heavy" simulations, but obviously I have very little expirience in actually doing it.
Reply With Quote
  #15  
Old 10-24-2006, 12:04 AM
AlienBoy AlienBoy is offline
Senior Member
 
Join Date: Feb 2006
Location: Poker Happens...
Posts: 2,264
Default Re: Suitable programming language

I never thought of Java as being more efficient than VBA - is it really that much better?

If it is I'll look into it because one of the reasons I like VBA is that it's Windoz/Mac compatible - but of course Java in near universal - even better.

I've just found so many Java apps unstable, slow and lacking in many ways...



AB
Reply With Quote
  #16  
Old 10-24-2006, 09:22 AM
fnord_too fnord_too is offline
Senior Member
 
Join Date: May 2004
Location: February made me shiver
Posts: 9,200
Default Re: Suitable programming language

AlienBoy,

Caveat this with the last time I used VB or VBA was with VB6 (I think VBA is still VB.net, but I don't know).

Java is reasonably fast and it has gotten very stable, but that is not the reason I would prefer it over VB. The real reason is that development and maintenance times dominate all other costs of developing aps, even little toy ones you make to solve little problems. There are actually a lot of big expensive aps written in Java (or at least front ended in Java). Personally, I have never really seen any stability problems in the little stuff I write, and the only problems with stability I ever think I have encountered were 5+ years ago when it was still a pretty young language.

I am not sure what type of programming you do, but the release of 1.5 added some very nice language features, like generics (the equivalent of templates). This allows for type safe container classes and removes all the pain in the ass casting you had to do previously. Also, I cannot say enough good things about Eclipse. It is a free IDE that IBM has made open source (I think it is open source, it is definitely free). It has a plug in architecture so you can arbitrarily enhance it (and there are companies who write and sell plug ins for it). I think it has plugins for doing c++ development in it, too, and there is no reason it couldn't do VB (I am really unaware of the state of plugins for it). It is just slick. It has refactoring support, which lets you do a lot of things in a couple of clicks that would take a lot of time and effort to do manually.

Mac, I think, has the best Java integration, but sometimes they run a little behind since they write there own JVM IIRC, so they usually still have some work to do when a new standard is released.

Edit - the real thing about speed I was getting at pertains to Excel, but I just did a quick experiment and that looks like it has gotten A LOT better. (I pasted rand() into an entire column, a few years ago this would have hung my machine when I pasted or f9'd, but now it is almost instant.)
Reply With Quote
  #17  
Old 10-24-2006, 12:35 PM
thechainsaw thechainsaw is offline
Member
 
Join Date: Oct 2006
Posts: 69
Default Re: Suitable programming language

[ QUOTE ]
I'd like to learn a programming language that will allow me to write my own simulations for all kinds of math/probability problems that interest me. I don't have much of a knowledge or education in the programming field, but am a very fast (self) learner. It isn't meant to serve me on the job market or anything, but more like a fun/challenging thing. What would you recommend?

[/ QUOTE ]

Java hands down.

Your VBA excercise should be a good primer for programming in general, but you will SEE that it's going to break down pretty fast.

Get yourself java in a nutshell from any decent bookstore and use a simple editor like editplus or eclipse, both free. This is by far the most fun effective and sensible approach.

You're really going to struggle with the other options, i promise you. The reason is java is hands down is because for learning it's by far the best, and the other options WILL get you in serious trouble. Java is NOT slow either, ive programmed all the languages mentioned and java is as fast if not faster at times than other options.
Reply With Quote
  #18  
Old 10-25-2006, 12:01 AM
New York Jet New York Jet is offline
Senior Member
 
Join Date: Aug 2004
Location: I collect money
Posts: 546
Default Re: Suitable programming language

C#
IDE - Visual C# Express
Training - 16 Hours of Free Video Training
Poker Code - A C# native, fast Texas Holdem Hand Evaluator
Reply With Quote
  #19  
Old 10-25-2006, 12:54 AM
UATrewqaz UATrewqaz is offline
Senior Member
 
Join Date: Feb 2005
Location: Atlanta
Posts: 5,542
Default Re: Suitable programming language

C# is best for quickily thrown together, simple windows based apps.

C++ is probably best for large, complex projects.

You'll find the best software and the most support/documentation/help on these languages as well.
Reply With Quote
  #20  
Old 10-25-2006, 06:39 AM
punter11235 punter11235 is offline
Senior Member
 
Join Date: Mar 2005
Location: Check out my blog
Posts: 3,239
Default Re: Suitable programming language

Reading the replies I see that programming languages are like religions. Everybody is preaching for their favourite.
Dont forget our Hero is complete newbie. He wont be able to write large applications or go to finest details of code optimalization.
He probably jsut want to code some things as fast and simple as possible without caring about all the other stuff.

C/C++ is simply terrible choice. You will need to care about so many things using it (like memory management). Its sure fine for people who want to care about those things and who can program them to be optimal for their needs but out Hero has long way to go and he will be quickly discouraged.

Our Hero for sure need a high-level language. Like Java at very least but I think its still to complex (although way way better than C/C++ for amateur usage).
Some suggestins from Aaron Brown will do I guess. Python will do too I guess. If you have to choose C, go for C# at least making nice window interface and defining your own types will be simple and intuitive.
I strongly reccomend not touching C and C++ stuff. They are for masochist experienced programmers not for people who actually care mroe about using what they coded than coding itself.
Reply With Quote
Reply


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:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.