anchor.diff:      Board = new_game(5, 4, 4, [0,2,3,8]),
       {Events, #board{n_hidden = NHidden}} = step({2,2}, Board),
       ?assertEqual(6, NHidden),
  -    ?assertMatch([{uncover, 19, {empty, 0}},
  -                  {uncover, 16, {empty, 0}},
  -                  {uncover, 12, {empty, 1}},
  -                  {uncover, 17, {empty, 0}},
  -                  {uncover, 18, {empty, 0}},
  -                  {uncover, 15, {empty, 0}},
  -                  {uncover, 13, {empty, 1}},
  -                  {uncover, 14, {empty, 0}},
  -                  {uncover, 11, {empty, 0}},
  -                  {uncover,  9, {empty, 1}},
  -                  {uncover,  7, {empty, 2}},
  -                  {uncover,  6, {empty, 2}},
  -                  {uncover,  5, {empty, 3}},
  -                  {uncover, 10, {empty, 0}}], Events).
  +    ?assertMatch([{uncovered, 19, {empty, 0}},
  +                  {uncovered, 16, {empty, 0}},
  +                  {uncovered, 12, {empty, 1}},
  +                  {uncovered, 17, {empty, 0}},
  +                  {uncovered, 18, {empty, 0}},
  +                  {uncovered, 15, {empty, 0}},
  +                  {uncovered, 13, {empty, 1}},
  +                  {uncovered, 14, {empty, 0}},
  +                  {uncovered, 11, {empty, 0}},
  +                  {uncovered,  9, {empty, 1}},
  +                  {uncovered,  7, {empty, 2}},
  +                  {uncovered,  6, {empty, 2}},
  +                  {uncovered,  5, {empty, 3}},
  +                  {uncovered, 10, {empty, 0}}], Events).
   
   generate_mines_test() ->
       ?assertMatch([_,_,_], generate_mines(2*2, 3)),
  
positive.code:             end
      end;
  %% stepped on a field with a mine -- handle explosion and game over
  board_event(explode, Seq, #board{fields = Fields} = Board, Events) ->
      F = array:get(Seq, Fields),
      Fields1 = array:set(Seq, F#field{status=exploded}, Fields),
      Board1 = Board#board{fields = Fields1},
      Events1 = [{exploded, Seq} | Events],
      board_event(game_over, Seq, Board1, Events1);
  board_event(game_over, _Seq, #board{fields = Fields} = Board, Events) ->
      %% generate uncover event for all fields still covered
  
negative.code: %% - if it is covered or questioned, it will become flagged.
  %% - if it is flagged, it will become covered.
  %% - if it is uncovered, nothing happens.
  flag(Pos, #board{dims = Dims} = Board) ->
      Seq = pos2seq(Pos, Dims),
      board_event(flag, Seq, Board, []).
  
  %% toggle the question mark on a covered field
  %% - if it is covered or flagged, it will become questioned.
  %% - if it is questioned, it will become covered.
  %% - if it is uncovered, nothing happens.
  question(Pos, #board{dims = Dims} = Board) ->
      Seq = pos2seq(Pos, Dims),
      board_event(question, Seq, Board, []).
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% Internal functions
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  board_event(flag, Seq, #board{fields = Fields} = Board, Events) ->
      F = array:get(Seq, Fields),
      case F#field.status of
          flagged ->
              update_field_status(covered, Seq, Board, Events);
          St when St == covered; St == questioned ->
              update_field_status(flagged, Seq, Board, Events);
          _ -> {Events, Board}
      end;
  board_event(question, Seq, #board{fields = Fields} = Board, Events) ->
      F = array:get(Seq, Fields),
      case F#field.status of
          questioned ->
              update_field_status(covered, Seq, Board, Events);
          St when St == covered; St == flagged ->
              update_field_status(questioned, Seq, Board, Events);
          _ -> {Events, Board}
      end;
  %% stepped on a field -- leads to an uncover or an explode on the same field
  board_event(step, Seq, #board{fields = Fields} = Board, Events) ->
      case array:get(Seq, Fields) of
          #field{has_mine = true, status = St} when St /= uncovered ->
  