Sha256: f0bc872185d4533803d19e3efb2caec51986e987833583516123663b4991c437

Contents?: true

Size: 393 Bytes

Versions: 87

Compression:

Stored size: 393 Bytes

Contents

handshake <- function(n) {
  
  # 1 = wink
  # 10 = double blink
  # 100 = close your eyes
  # 1000 = jump
  # 10000 = reverse
  actions = c("wink", "double blink", "close your eyes", "jump")
  
  bin = intToBits(n)
  
  events = c()
  
  for (i in 1:4){
    if (bin[i] > 0) {
      events = c(events, actions[i])
    }
  }
  
  if (bin[5] > 0) {
    events = rev(events)
  }
  
  events
  
}

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
trackler-2.1.0.21 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.20 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.19 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.18 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.17 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.16 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.15 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.14 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.13 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.12 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.11 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.10 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.9 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.8 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.7 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.6 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.5 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.4 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.3 tracks/r/exercises/secret-handshake/example.R
trackler-2.1.0.2 tracks/r/exercises/secret-handshake/example.R