Skip to main content
Saved 2 bytes by using a shorter regex
Source Link
MrPublic
  • 739
  • 6
  • 14

Ruby, 53 5555 52 bytes

f=->(a,b){/^(2|too2|t[wo]?|t0|twoo|t0)$/i=~a&&/^^b(be{,2}|b3e?e?|3)$/i=~b} 

I'll be honest, this is my first attempt at trying to golf a problem.

Function call in the form of f.call(firstValue, secondValue)

0 is Truthy, nil is Falsy.

Test it HereHere

Ruby, 53 55 bytes

f=->(a,b){/^(2|too?|t0|two)$/i=~a&&/^(be{,2}|b3)$/i=~b} 

I'll be honest, this is my first attempt at trying to golf a problem.

Function call in the form of f.call(firstValue, secondValue)

0 is Truthy, nil is Falsy.

Test it Here

Ruby, 53 55 52 bytes

f=->(a,b){/^(2|t[wo]?o|t0)$/i=~a&&/^b(e?e?|3)$/i=~b} 

I'll be honest, this is my first attempt at trying to golf a problem.

Function call in the form of f.call(firstValue, secondValue)

0 is Truthy, nil is Falsy.

Test it Here

Fixed error with "bb" passing as truthy. Updated link
Source Link
MrPublic
  • 739
  • 6
  • 14

Ruby, 5353 55 bytes

f=->(a,b){/^(2|too?|t0|two)$/i=~a&&/^be^(be{,2}|b3$|b3)$/i=~b} 

I'll be honest, this is my first attempt at trying to golf a problem.

Function call in the form of f.call(firstValue, secondValue)

0 is Truthy, nil is Falsy.

Test it HereHere

Ruby, 53 bytes

f=->(a,b){/^(2|too?|t0|two)$/i=~a&&/^be{,2}|b3$/i=~b} 

I'll be honest, this is my first attempt at trying to golf a problem.

Function call in the form of f.call(firstValue, secondValue)

0 is Truthy, nil is Falsy.

Test it Here

Ruby, 53 55 bytes

f=->(a,b){/^(2|too?|t0|two)$/i=~a&&/^(be{,2}|b3)$/i=~b} 

I'll be honest, this is my first attempt at trying to golf a problem.

Function call in the form of f.call(firstValue, secondValue)

0 is Truthy, nil is Falsy.

Test it Here

Added link for testing
Source Link
MrPublic
  • 739
  • 6
  • 14

Ruby, 53 bytes

f=->(a,b){/^(2|too?|t0|two)$/i=~a&&/^be{,2}|b3$/i=~b} 

I'll be honest, this is my first attempt at trying to golf a problem.

Function call in the form of f.call(firstValue, secondValue)

0 is Truthy, nil is Falsy.

Test it Here

Ruby, 53 bytes

f=->(a,b){/^(2|too?|t0|two)$/i=~a&&/^be{,2}|b3$/i=~b} 

I'll be honest, this is my first attempt at trying to golf a problem.

Function call in the form of f.call(firstValue, secondValue)

0 is Truthy, nil is Falsy.

Ruby, 53 bytes

f=->(a,b){/^(2|too?|t0|two)$/i=~a&&/^be{,2}|b3$/i=~b} 

I'll be honest, this is my first attempt at trying to golf a problem.

Function call in the form of f.call(firstValue, secondValue)

0 is Truthy, nil is Falsy.

Test it Here

Source Link
MrPublic
  • 739
  • 6
  • 14
Loading