<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Sokoban
{
    class Program
    {
        static void Main(string[] args)
        {
            var fieldString =
@"
#########
#       #
# ##o## #
# p   o #
##o...# #
##    # #
####  ###
#########
";

            var charTable = new Dictionary<FieldTypes, char>
            {
                { FieldTypes.Space, ' ' },
                { FieldTypes.Wall, '#' },
                { FieldTypes.Player, 'p' },
                { FieldTypes.Block, 'o' },
                { FieldTypes.Goal, '.' },
                { FieldTypes.BlockOnGoal, 'O' },
                { FieldTypes.PlayerOnGoal, 'P' },
            };

            var mapSerializer = new MapSerializer();
            var map = mapSerializer.Deserialize(
                fieldString,
                charTable.ToDictionary(
                    kv => kv.Value,
                    kv => kv.Key));

            var sokoban = new Sokoban(map);
            var countMove = 0;

            Console.WriteLine("倉庫番");
            Console.WriteLine("Please Enter Key... Game Start");
            Console.ReadLine();

            while (!sokoban.IsClear)
            {
                Console.WriteLine(mapSerializer.Serialize(map, charTable));
                Console.WriteLine("移動回数: " + countMove);
                Console.WriteLine("移動: (上->w, 左->a, 下->s, 右->d) + Enter");
                Console.WriteLine("戻す->u, リセット->@, 入力キャンセル->!を含める");

                var input = Console.ReadLine();

                if (input.Length == 0)
                {
                    continue;
                }

                if (input.Contains('!'))
                {
                    // Cancel
                    continue;
                }

                if (input[0] == 'u' && sokoban.CanUndo)
                {
                    sokoban.Undo();
                    countMove--;
                    continue;
                }

                if (sokoban.TryMove(input[0]))
                {
                    countMove++;<commit_msg>Add reset function<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Sokoban
{
    class Program
    {
        static void Main(string[] args)
        {
            var fieldString =
@"
#########
#       #
# ##o## #
# p   o #
##o...# #
##    # #
####  ###
#########
";

            var charTable = new Dictionary<FieldTypes, char>
            {
                { FieldTypes.Space, ' ' },
                { FieldTypes.Wall, '#' },
                { FieldTypes.Player, 'p' },
                { FieldTypes.Block, 'o' },
                { FieldTypes.Goal, '.' },
                { FieldTypes.BlockOnGoal, 'O' },
                { FieldTypes.PlayerOnGoal, 'P' },
            };

            var mapSerializer = new MapSerializer();
            var map = mapSerializer.Deserialize(
                fieldString,
                charTable.ToDictionary(
                    kv => kv.Value,
                    kv => kv.Key));

            var sokoban = new Sokoban(map);
            var countMove = 0;

            Console.WriteLine("倉庫番");
            Console.WriteLine("Please Enter Key... Game Start");
            Console.ReadLine();

            while (!sokoban.IsClear)
            {
                Console.WriteLine(mapSerializer.Serialize(map, charTable));
                Console.WriteLine("移動回数: " + countMove);
                Console.WriteLine("移動: (上->w, 左->a, 下->s, 右->d) + Enter");
                Console.WriteLine("戻す->u, リセット->@, 入力キャンセル->!を含める");

                var input = Console.ReadLine();

                if (input.Length == 0)
                {
                    continue;
                }

                if (input.Contains('!'))
                {
                    // Cancel
                    continue;
                }

                var command = input[0];

                if (command == 'u' && sokoban.CanUndo)
                {
                    sokoban.Undo();
                    countMove--;
                    continue;
                }

                if (command == '@')
                {
                    while (sokoban.CanUndo)
                    {
                        sokoban.Undo();
                    }

                    countMove = 0;
                    continue;
                }

                if (sokoban.TryMove(command))
                {
                    countMove++;
{'fraction_non_alphanumeric': 0.13319901499888068, 'fraction_numerical': 0.0017909111260353706, 'mean_word_length': 1.0336822940373236, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3172247', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1186, 'n_words': 210}