Description Usage Arguments Details Value See Also Examples
A function to generate objects of class DoubleRule.
1 |
a |
an index of |
fr |
(first rule) an object of class |
sr |
(second rule) an object of class |
ns |
(next single rule) an object of class |
Parameters generated automatically have different probabilities assigned.
Because too complicated rules are very difficult to solve, objects of class IdenSingleRule
are generated with greater probability than other.
A function returns an object that inherits from class DoubleRule
.
Returned object will be of class corresponding to applied DoubleRule
.
SingleRule
,
DoubleRule
,
createSR
,
calculate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | ##[1] DoubleRule object with random combination of rules
m<-createDR()
print(m)
##[2]DoubleRule object with only one argument specified
m<-createDR(sr=new("AddConstSingleRule",constantVal=3,previousRule=new("IdenSingleRule")))
#only secondRule argument is specyfied, all other arguments are generated automatically
print(m)
##[3]simple 'DoubleRule' object created manually (no nested rules)
b<-createSR(a1=1,n=0)#creating SingleRule that is identical function
# setting firstRule, secondRule and nextSingle are objects of class 'IdenSingleRule'
m<-createDR(a=1,fr=b,sr=b,ns=b)
#altrnatively 'm<-createDR(a=1,fr=new("IdenSingleRule"),sr=new("IdenSingleRule"),ns=new("IdenSingleRule"))'
print(m)
##[4] Nesting many rules
b<-createSR(a1=2,cv1=1,n=2,2,14,3,6)
print(b) #two nested rules inside a 'SingleRule' b object
#An object of class "AddConstSingleRule"
#Slot "constantVal":
#[1] 1
#Slot "previousRule":
#name: AddConstSingleRule, constant value: 14
#name: MultConstSingleRule, constant value: 6
#name: IdenSingleRule
#Slot ".S3Class":
#[1] "AddConstSingleRule" "SingleRule"
c<-createSR(a1=2,cv=45, n=3) # I want to nest three SingleRules
#(no parameters for nested rules are specyfied - program generates them )
print(c)
#name: AddConstSingleRule, constant value: 45
#name: SubsConstSingleRule, constant value: 10
# first nested rule (generated automatically - it will be different for every generation)
#name: AddConstSingleRule, constant value: 10
# second nested rule (generated automatically- it will be different for every generation)
#name: MultConstSingleRule, constant value: 58
# third nested rule (generated automatically- it will be different for every generation)
m<-createDR(a=1,fr=b,ns=c) #combining DoubleRule with SingleRules
print(m)
#AddDoubleRule
# FIRST RULE:
#name: DigSumSingleRule
#name: AddConstSingleRule, constant value: 14
#name: MultConstSingleRule, constant value: 6
# SECOND RULE:
#name: IdenSingleRule
# NEXT SINGLE:
#name: AddConstSingleRule, constant value: 45
#name: SubsConstSingleRule, constant value: 10
#name: AddConstSingleRule, constant value: 10
#name: MultConstSingleRule, constant value: 58
##note that UNLIMITED number of rules can be nested !!!
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.