R/newletters.R

Defines functions newletters

Documented in newletters

newletters=function(s1,s2){
   (s.list=sapply(c(s1,s2),function(x){strsplit(x,split="")}))
   for(i in 1:length(s.list[[1]])){
      s.list[[2]][match(s.list[[1]][i],s.list[[2]])]=""}
   return(paste(s.list[[2]][s.list[[2]]!=""],collapse=""))
}

   # Usually, the two strings are seven characters long, but they can be shorter.
   # The previousunused need to be part of the thismove letters.
   # The string that is returned has the same number of characters (max) 
   # as the previous unused string.
   # Align the second string of the first row with the 
   # combination of the first and second string of the second row.
   # The elements of previousunused need to be part of the second vector. 
   # Otherwise something is wrong.
   
   # The remaining letters are the new letters that were received at the previous turn.
   # It needs to be done by game! Create a list with start as the list names.
   
   # There will be four arguments. Matrix of 2 x 2.
vdweijer/games documentation built on Dec. 23, 2021, 3:02 p.m.