Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 9v00665bf61b000000000279

Define Gray code states

List the states using Gray code and assign Gray code values to each state.

Start file
typedef enum logic [3:0] {
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    ,
  S   = 4'b    
} state_t;
End file
typedef enum logic [3:0] {
  S00 = 4'b0000,
  S01 = 4'b0001,
  S02 = 4'b0011,
  S03 = 4'b0010,
  S04 = 4'b0110,
  S05 = 4'b0111,
  S06 = 4'b0101,
  S07 = 4'b0100,
  S08 = 4'b1100,
  S09 = 4'b1101,
  S10 = 4'b1111,
  S11 = 4'b1110,
  S12 = 4'b1010,
  S13 = 4'b1011,
  S14 = 4'b1001,
  S15 = 4'b1000
} state_t;

View Diff

2,17c2,17
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    ,
<   S   = 4'b    
---
>   S00 = 4'b0000,
>   S01 = 4'b0001,
>   S02 = 4'b0011,
>   S03 = 4'b0010,
>   S04 = 4'b0110,
>   S05 = 4'b0111,
>   S06 = 4'b0101,
>   S07 = 4'b0100,
>   S08 = 4'b1100,
>   S09 = 4'b1101,
>   S10 = 4'b1111,
>   S11 = 4'b1110,
>   S12 = 4'b1010,
>   S13 = 4'b1011,
>   S14 = 4'b1001,
>   S15 = 4'b1000

Solutions by @danilobellini:

Unlock 5 remaining solutions by signing in and submitting your own entry
Created by: @maharba6

11 active golfers, 36 entries

Solutions by @danilobellini:
56
#1 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

06/18/2024 at 09:27PM

59
#>4 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

06/16/2024 at 07:23PM

61
#>4 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

06/16/2024 at 02:43PM

63
#>4 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

06/03/2024 at 10:53PM

71
#>6 - Danilo J. S. Bellini 🥊🇧🇷 / @danilobellini

06/02/2024 at 03:46PM