Blocked
Blocked

0 Members and 1 Guest are viewing this topic.

lucky_strike

  • Guest
Re: How to code RX Tuturioal 2
April 14, 2008, 02:26:05 PM

See what I mean about indenting the 'begins' and 'ends' ? If you don't do it, it starts to get very messy. This is now very much easier to do than in 1.5 because you can simply cut and paste one block and modify it to make the other two.

Finally, we have this:

Code:
system "Two Dozens"

method "main"
begin

if starting a new session
    begin
    call "Initialisation";
    end

call "Check Win/Lose";
call "Place Bets";

end




method "Initialisation"
begin

put 100% of bankroll on record "Starting Bankroll" data;
subtract 100 units on record "Starting Bankroll" data;
put 100% of record "Starting Bankroll" data on record "Lower Limit" data;
add 150 units on record "Starting Bankroll" data;
put 100% of record "Starting Bankroll" data on record "Upper Limit" data;

end




method "Check Win/Lose"
begin

if bankroll > record "Upper Limit" data
or bankroll < record "Lower Limit" data
    begin
    stop session;
    end

end





method "Place Bets"
begin

generate random number between 1 & 3 on record "Bet Decision" data;

if record "Bet Decision" data = 1
    begin
    put 1 unit on 1st Dozen;
    put 1 unit on 2nd Dozen;
    end
    
    if record "Bet Decision" data = 2
    begin
    put 1 unit on 1st Dozen;
    put 1 unit on 3rd Dozen;
    end
    
    if record "Bet Decision" data = 3
    begin
    put 1 unit on 2nd Dozen;
    put 1 unit on 3rd Dozen;
    end



end




The next post below will deal with the progressions. In order to be able to understand how progressions will work, you will have to be familiar and comfortable with the data records in RX2, how to create them, access them, and make comparisons with them, so have a good digest of the above before carrying on !