/* Read next note in current group. If no more notes, go to next board */ static void do_nread (CHAR_DATA *ch, char *argument) { NOTE_DATA *p; int count = 0, number; time_t *last_note = &ch->pcdata->last_note[board_number(ch->pcdata->board)]; if (!str_cmp(argument, "again")) { /* read last note again */ } else if (is_number (argument)) { number = atoi(argument); for (p = ch->pcdata->board->note_first; p; p = p->next) if (++count == number) break; if (!p || !is_note_to(ch, p)) send_to_char ("No such note.\n\r",ch); else { show_note_to_char (ch,p,count); *last_note = UMAX (*last_note, p->date_stamp); } } else /* just next one */ { char buf[200]; count = 1; if (ch->pcdata->board == NULL) { send_to_char("You are not on a board.\n\r", ch ); return;} if (ch->pcdata->board->note_first == NULL) { send_to_char("There are no notes.\n\r", ch ); return;} for (p = ch->pcdata->board->note_first; p ; p = p->next, count++) if ((p->date_stamp > *last_note) && is_note_to(ch,p)) { show_note_to_char (ch,p,count); /* Advance if new note is newer than the currently newest for that char */ *last_note = UMAX (*last_note, p->date_stamp); return; } send_to_char ("No new notes in this board.\n\r",ch); if (next_board (ch)) xprintf (buf, "Changed to next board, %s.\n\r", ch->pcdata->board->short_name); else xprintf (buf, "There are no more boards.\n\r"); send_to_char (buf,ch); } }
BitMoveOrderingIterator::BitMoveOrderingIterator( const Board& board, Evaluator<Board>& eval) : board_(board), sorted_next_() { std::vector<eval_t> sort_key; BitBoard::data_type moves = board.get_move_bit(); while (moves.any()) { BitBoard::data_type next = moves.get_next_bit(); unsigned pos = next.get_next(); BitBoard next_board(board); next_board.try_move(pos); eval_t v = eval.evaluate(next_board, BLACK); sort_insert(sort_key, sorted_next_, v, pos); moves ^= next; } current_ = sorted_next_.begin(); }
inline BitBoard BitMoveOrderingIterator::get_next() const { BitBoard next_board(board_); next_board.try_move(*current_); return next_board.make_inverse(); }