Friday, 7 October 2011

Back to basics...

I was trying to work out a system of gambling by running a simulation on a computer, rather than spending money in a bookies, but doing it manually was tedious. It was just the sort of thing that a computer could do easily, if only I could find the right program.

But I couldn't, so I wanted to write my own.

But modern computers do everything for you. You can't just dash off an ad hoc program like in days of yore.

Actually I suppose you can, but as ever, I had to be a bit perverse and go about things in an arse over tit manner.

Hence I downloaded first a ZX Spectrum emulator. This was extremely unwieldy. It had to emulate the spectrum's method of assigning commands to individual keys. - Press L to get the command, "LIST" for example.

So I tried a BBC emulator instead. This was much better. It assumed that when you typed "x=1:y=5" that you meant "LET x=1: LET y=5" instead of having to type in the command. It allowed me to just type in what I wanted, rather than constantly have to refer to a table of commands and their PC keyboard equivalents.

It's not perfect. Once a line of code is in place, I can only edit it by typing "EDIT line number" for example, but it's simple enough.

Funny what you remember. It must be 25 years since I used a BBC micro, yet I know what I'm doing (mainly)

Not got the program I want yet, but it's coming.

As you can see, I'm trying different methods, like calling procedures and jumping to different line numbers. Very much a work in progress...

driving lessons in Wallasey?


Jim Bliss said...

BASIC was the first computer language I learnt as well... I think most of us started there. But it is rather obsolete these days. When you say,

But modern computers do everything for you. You can't just dash off an ad hoc program like in days of yore.

you couldn't be further from the truth (well, about the second sentence anyway). There's nothing, for example, that you can do with BASIC than you couldn't also do with a bit of javascript embedded in an html page and then rendered by your favourite browser (or you could go a step further and use a server-side language like php). And you don't need to download an emulator; just fire up a text editor and web browser... both of which come built into your OS.

There's some excellent javascript (and php) tutorials online. The advantage being that in only a little bit more time than it would take to do in BASIC, you could teach yourself a bit of javascript and then have a skill that would be potentially useful further down the line should you ever wish to expand the functionality of your website.

Pete said...

Hmmm, Basic, I remember that from about 30 years ago, I think. I did get into it and write a few "programs" some of them as long as 20 lines. And then it got difficult so I became a TEFL teacher, sigh. Never mind.

Talking about gambling, why are you talking about gambling or is that just a subject for the project. Anyway, I am still doing my arbing, which is not gambling. Today I found Robbie McEwen to beat Alessandro Petacchi @ 6/4 and Petacchi to beat McEwen @ 4/5. Instant cash, courtesy of one of the bookies or the other. There are companies which claim to sell programmes which find potential arbs for you. I guess they must be screen scraping type programmes. If you could write one of those and successfully market it, that would solve your driving lessons dilemma. However, this is rather similar to the "Get rich quick!" books, in that why does the author need to write such a book to make money. I rest my case, my lud. Driveling post ends here.

Paul said...

I've been giving language some thought Pete. Computer languages too have vocab and grammar. The vocab is an instruction set, and the grammar is the syntax. I struggle with it all, frankly. I'm not a natural polyglot.

As far as the gambling thing goes, I was curious as to how something would work in practice, but didn't want to spend a lot of money finding out. Essentially a Martingale system, but doubling up on a 2-1 shot instead of on an evens shot.

Pete said...

"Martingale", I had to look that up. OK, a simple system of doubling up on even money bets. Eventually you will lose because a) the exponential increase required to bet will exceed your pot. [Wikipedia] and b) an even money bet appears to have a 50% chance of winning but in reality reflects a 40% probability plus the bookie's percentage.

It's discussed ad infinitum on forums like punter's lounge. There are people up and down the country making a good living out of gambling but they are not using the martingale system. They are mostly IT geeks and mathematicians taking advantage of betting spreads and having the best and fastest internet and information systems. I avoid competing with them and just stick to arbs at less than 2% usually.

I suspect this may not be such a good road for you to walk down. You can lose as well as win. You know this. Who the hell am I to tell you what you should and shouldn't do? Right, I need to go and do some lesson prep, BORING, because tomorrow I have 8 and a half hours teaching, HELLISH.