Jump to content

Logic Help


 Share

Recommended Posts

I am an amateur and need some help formulating the logic.

I need to figure out a more efficient code other than a lengthy nested if then statement

Slot1           If slot 1 to slot 4 is "A" then press "B"
Slot2           If not then remove slot 1 and check if slot 2 to 4 is "A" then press "B"
Slot3           If not then remove slot 2 and check if slot 3 to 4 is "A" then press "B"
Slot4           If not then remove slot 3 and check if slot 4 is "A" then press "B"
                   then return Slot 3 and check if "A" then press "B"
                   then return Slot 2 and check if "A" then press "B"
                   then return Slot 1 and check if "A" then press "B"

Example is 

Slot 1 to Slot 4 is not "A"
remove Slot 1 is still not "A"
remove Slot 2 is "A"
Press B
Return Slot 2 
Check again if slot 2 to 4 is "A" and so forth 

Sorry for the confusing format but any help would be appreciated.

 

Link to comment
Share on other sites

BUTTON press turns SLOT value to 0

SLOT1    SLOT2    SLOT3    SLOT4        TOTAL    BUTTON        
4             3            2             1                10            
IS "total" <= 5                                
YES    press button and return SLOT1 if missing else return SLOT2 if missing else return SLOT3 if missing                            
No    Remove SLOT1 if SLOT1 is present else remove SLOT2 if SLOT2 is present else remove SLOT3 if SLOT3 is present                            

    SLOT2    SLOT3    SLOT4        TOTAL    BUTTON        
    3            2             1                 6            
IS "total" <= 5                                
YES    press button and return SLOT1 if missing else return SLOT2 if missing else return SLOT3 if missing                            
No    Remove SLOT1 if SLOT1 is present else remove SLOT2 if SLOT2 is present else remove SLOT3 if SLOT3 is present                            

        SLOT3    SLOT4        TOTAL    BUTTON        
        2             1                3            
IS "total" <= 5                                
YES    press button and return SLOT1 if missing else return SLOT2 if missing else return SLOT3 if missing                            
No    Remove SLOT1 if SLOT1 is present else remove SLOT2 if SLOT2 is present else remove SLOT3 if SLOT3 is present                            

    SLOT2    SLOT3    SLOT4        TOTAL    BUTTON        
    3             0            0                 3            
IS "total" <= 5                                
YES    press button and return SLOT1 if missing else return SLOT2 if missing else return SLOT3 if missing                            
No    Remove SLOT1 if SLOT1 is present else remove SLOT2 if SLOT2 is present else remove SLOT3 if SLOT3 is present                            

SLOT1    SLOT2    SLOT3    SLOT4        TOTAL    BUTTON        
4             0            0             0                 4            
IS "total" <= 5                                
YES    press button and return SLOT1 if missing else return SLOT2 if missing else return SLOT3 if missing                            
No    Remove SLOT1 if SLOT1 is present else remove SLOT2 if SLOT2 is present else remove SLOT3 if SLOT3 is present                            

SLOT1    SLOT2    SLOT3    SLOT4        TOTAL    BUTTON        
0             0            0             0                 0            
 

Link to comment
Share on other sites

There are 4 slots with variables

There is a Total that displays the total of the 4 variables

There is a button that can be pressed to set the variables to 0 

I need to press the button when the total sums to 5 or less
I can remove the variable in a slot to reduce the total sum but want to put it back after the button is pressed. 

1,2,3,4 as values is a sum of 10 so if I remove the variables one at a time I will end up with SLOT 4 with variable value 4 before I press the button
So when the button is pressed the variable in slot 4 becomes 0 and I want to return the variables removed earlier so it will look like 1,2,3,0 sum of 7

Then it will cycle and remove variables till it is 5 or less in this case it will remove SLOT 1 and 2 and be left with 3,0 and the button will be pressed again
so upon returning the other variables it will be 1,2,0,0 which will be sum 3 and the button will be pressed again to have 0,0,0,0

Link to comment
Share on other sites

  • Moderators

@hhh_troll you seem not to have bothered to read the forum rules. Please do so now, especially the part about game automation, and you will see why this thread is locked.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...