Пример #1
0
def start():
    chess.pregame.setup()

    if settings.DEBUG:
        run_all_tests()

    if settings.COMPUTER_PLAY:
        chess.play_computer_game()
    else:
        chess.play_against_computer()
Пример #2
0
def main():
    feedback_queue = queue.Queue()

    test_mode = cli.parse_and_initialize(feedback_queue)

    if test_mode:
        tests.run_all_tests()
        return

    sim = usersim.UserSim()

    spinner = itertools.cycle('-/|\\')
    while True:
        result = sim.cycle()
        for feedback in result:
            feedback_queue.put(feedback)

        # Spinner to demonstrate that the simulator is still running without scrolling the terminal.
        for i in range(4):
            sys.stdout.write(next(spinner))
            sys.stdout.flush()
            time.sleep(.25)
            sys.stdout.write('\b')
Пример #3
0
                    default=False,
                    help="Run unit tests")
parser.add_argument('--mapLevel',
                    dest='mapLevel',
                    type=int,
                    default=None,
                    help='Shows a vertical map level as a CSV')
parser.add_argument("--mmp",
                    type=str2bool,
                    nargs='?',
                    const=True,
                    default=False,
                    help="Map in MMP XML format")
args = parser.parse_args()
if args.tests:
    run_all_tests()
    sys.exit()

log("", "Server Boot")

log("", "Loading configuration file")

# load the configuration file
Config = configparser.ConfigParser()
Config.read('config.ini')
# example of config file usage
# print(str(Config.get('Database', 'Hostname')))

# Declare rooms dictionary
rooms = {}
Пример #4
0
# 
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products 
#    derived from this software without specific prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import sys
_nocurrentdir = '.' not in sys.path
if _nocurrentdir:
    sys.path.append('.')

import tests
tests.run_all_tests()

if _nocurrentdir:
    sys.path.remove('.')