#!/usr/bin/python
#@not-modified@
# Remove the above line if this file has been modified.
# If you don't, this file will be overwritten.

# NOTICE:
# The keys (the format) may change when you update the game.  If that
# happens, the configuration files need to be replaced for the game to
# function.  Any modification would need to be remade, so keep a
# backup.
#
# Installing a new version when the configuration format has changed
# requires replacing the system-wide configuration files.
#
# BUG: As of version 0.0.5, the user's own configuration have a higher
# priority and will be loaded if available.  If they are out of date,
# the game will crash.


{
    'curses-input': {   # Key bindings.
        'flag':     ['f',       ],
        'reveal':   [' ', '\n', ],
        # Hexagonal direction numbers:
        #  5 0
        # 4   1
        #  3 2
        'hex0':     ['u', '9', 'e', ],
        'hex1':     ['l', '6', 'd', ],
        'hex2':     ['n', '3', 'x', ],
        'hex3':     ['b', '1', 'z', ],
        'hex4':     ['h', '4', 'a', ],
        'hex5':     ['y', '7', 'w', ],
        # Neumann and Moore neighbourhood directions:
        # NW    up      NE
        # left          right
        # SW    down    SE
        'up':    ['k', 'w', '8', curses.KEY_UP,    ],
        'right': ['l', 'd', '6', curses.KEY_RIGHT, ],
        'down':  ['j', 's', '2', curses.KEY_DOWN,  ],
        'left':  ['h', 'a', '4', curses.KEY_LEFT,  ],
        'NE':    ['u',      '9', ],
        'SE':    ['n',      '3', ],
        'SW':    ['b',      '1', ],
        'NW':    ['y',      '7', ],
    },
    # 'pre-doc':        In-game documentation on the key bindings
    #                   for flagging and revealing.
    # 'doc-hex':        In-game documentation on the key bindings
    #                   for the hexagonal gametype.
    # 'doc-square':     In-game documentation on the key bindings
    #                   for the other gametypes.
    'pre-doc': '''
    Press f to flag or unflag a cell.  Press space or enter to
    reveal (click on) a cell.
    ''',
    'doc-square': '''
    In the traditional and von Neumann modes, you can steer with the arrow
    keys, WASD, the numpad or hjklyubn.  Do not hold down shift.
    ''',
    'doc-hex': '''
    This mode lacks an obvious up or down.
     w e        y u        7 9
    a   d      h   l      4   6
     z x        b n        1 3
    Do not hold down shift.
    ''',
    'curses-output': {
        # Textics
        # =======
        #
        # 'key': (pair, 'C', 'foreground', 'background', attributes),
        
        # Keys
        # ----
        #
        # These keys consist of two parts:
        #       * the property (mandatory)
        #       * the mode (optional)
        # 'property'
        # 'property:mode'
        # The mode-part is used to give different gametypes different
        # values for a property.
        # Recognised properties are:
        #       'hex'           Only for hexagonal fields.
        #       'moore'         Only for traditional fields.
        #       'neumann'       Only for fields with von Neumann
        #                       neighbourhoods.
        #       'square'        'moore' + 'neumann'
        #       no mode         Used when the preferred mode is
        #                       unavailable.
        # Search order:
        # von Neumann fields:   ':neumann',     ':square',      ''
        # hexagonal fields:     ':hex',         ''
        # traditional fields:   ':moore',       ':square',      ''
        #
        # Properties:
        #       'flag'
        #       'free' (unclicked)
        #       'number'
        #       'zero' (no mines around this cell)
        #       'mine' (game over; don't click on these)
        #   **  'grid' (The space between the characters of each cell)
        #   **  'cursor-l' and 'cursor-r' (Mark the position of the
        #               selected cell)
        #   **  'text' (All messages that appear in curses mode and the
        #               flags left text)
        #   **  'background'    (To differ from the grid.)
        #
        
        # Values
        # ------
        #
        # The values are tuples of:
        # [0]:  color pair; Each unique combination of foreground and
        #       background color MUST have its own pair.  The pair MUST
        #       be a positive integer.
        # [1]:  character (Required by all keys except 'number', 'grid'
        #       and 'text'. For these three, the character will be
        #       ignored.  'background' will also be ignored due to BUG #7)
        # [2]:  foreground color; valid colors are: "BLACK", "BLUE",
        #       "GREEN", "CYAN", "RED", "MAGENTA", "YELLOW" and
        #       "WHITE".
        # [3]:  background color; (same valid colors as for foreground)
        # [4]:  attributes; this is curses attributes or'ed together,
        #       see link below for a table of common attributes:
        # https://docs.python.org/3/howto/curses.html#attributes-and-color
        #       To or together blinking and bright/bold text use:
        #               curses.A_BLINK | curses.A_BOLD
        #       as attribute.  The pipe character is the or operator.
        #       NOTICE: The effects of the attributes will vary between
        #       different terminals:
        #               - curses.A_BOLD may or may not make the background
        #               color brighter.  And as the name suggests, some
        #               terminals may use a bolder font instead.
        #               - curses.A_BLINK is not always supported and on
        #               the Linux virtual consoles (tty1 to tty6) it does
        #               something with the color.
        
       #                  pair      foreground           attributes
       #key                   character        background
        'flag':           (1, 'F',  "BLACK",   "YELLOW", curses.A_NORMAL),
        'free':           (2, '.',  "BLACK",   "BLACK",  curses.A_NORMAL),
        'number':         (3, None, "GREEN",   "BLACK",  curses.A_BOLD),
        'zero':           (3, '-',  "GREEN",   "BLACK",  curses.A_BOLD),
        'mine':           (4, 'X',  "RED",     "BLACK",  curses.A_BLINK),
        'grid':           (5, None, "MAGENTA", "BLACK",  curses.A_DIM),
        'cursor-l':       (6, '(',  "CYAN",    "BLACK",  curses.A_BOLD),
        'cursor-r':       (6, ')',  "CYAN",    "BLACK",  curses.A_BOLD),
        'text':           (7, None, "YELLOW",  "BLACK",  curses.A_NORMAL),
        'background':     (8, ' ',  "BLUE",    "BLUE",   curses.A_NORMAL),
        'background:hex': (2, ' ',  "BLACK",   "BLACK",  curses.A_NORMAL),
    },
    'highscores': {
        'tabsize':      6,      # Tab size for the highscores
        'min_tabspace': 2,      # Minimum amount of spaces in a tab.
        'less_step':    3,      # Horizontal step size for less(1).
        # Real tabs would be: tabsize=8; min_tabspace=1
        # To separate the columns more clearly: increase `min_tabspace`
        # High values of `tabsize` can be excessive.
        # For aesthetic reasons `tabsize` should be divisible by `less_step`.
    },
}
