Программа, что-то типа симулятор игр в карты. Даются четыре масти: Черви, Бубны, Пики и Крести. Значение карты бесконечно(от 0 до +бесконечности).
Например:
ч 1
к 101
б 52
п 16
п 6
Программа должна читать комманды из входящего файла.
Комманды которые присутствуют в игре:
1. Комманда add (добавляет карты в руку)
Например:
add ч 1
add п 16
2. Команда play (играть картой, она удаляется из руки)
Например:
play б 52
play п 6
3. Команда show (показывает какие карты остались в руке)
Например:
show.
Пример:
input file:
add б 52
add п 6
add ч 1
add ч 5
play ч 1
play ч 5
show
output file:
б 52
п 6
Нужно использовать Linked List обязательно:
public interface PositionList<E> {
/** Returns the number of elements in this list. */
public int size();
/** Returns whether the list is empty. */
public boolean isEmpty();
/** Returns the first node in the list. */
public Position<E> first();
/** Returns the last node in the list. */
public Position<E> last();
/** Returns the node after a given node in the list. */
public Position<E> next(Position<E> p)
throws InvalidPositionException, BoundaryViolationException;
/** Returns the node before a given node in the list. */
public Position<E> prev(Position<E> p)
throws InvalidPositionException, BoundaryViolationException;
/** Inserts an element at the front of the list, returning new position. */
public void addFirst(E e);
/** Inserts and element at the back of the list, returning new position. */
public void addLast(E e);
/** Inserts an element after the given node in the list. */
public void addAfter(Position<E> p, E e)
throws InvalidPositionException;
/** Inserts an element before the given node in the list. */
public void addBefore(Position<E> p, E e)
throws InvalidPositionException;
/** Removes a node from the list, returning the element stored there. */
public E remove(Position<E> p) throws InvalidPositionException;
/** Replaces the element stored at the given node, returning old element. */
public E set(Position<E> p, E e) throws InvalidPositionException;
}Подскажите хотя бы идею, как все организовать. Плиз.