|
Download chess/chess-0104.jsonl from winapiadmin/tinycodinglm: direct link, hf CLI and curl.
- Browser
- Download file 2.4 kB
-
https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/main/chess/chess-0104.jsonl
- Command line
-
hf download hf://datasets/winapiadmin/tinycodinglm/chess/chess-0104.jsonl
-
curl -L -o chess-0104.jsonl https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/main/chess/chess-0104.jsonl
2.4 kB
| {"type": "session", "harness": "opencode", "id": "chess-0104", "name": "Stockfish engine with python-chess"} | |
| {"type": "message", "message": {"role": "system", "content": "You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies."}} | |
| {"type": "message", "message": {"role": "user", "content": "How to use Stockfish engine with python-chess"}} | |
| {"type": "message", "message": {"role": "assistant", "content": "**Stockfish with python-chess:**\n\n**Installation:**\n```bash\npip install chess\n# Download Stockfish from https://stockfishchess.org/download/\n```\n\n**Basic Engine Usage:**\n```python\nimport chess\nimport chess.engine\n\n# Start engine\nengine = chess.engine.SimpleEngine.popen_uci(\"stockfish\")\n\n# Get best move\nboard = chess.Board()\nresult = engine.play(board, chess.engine.Limit(time=1.0))\nprint(result.move) # e2e4\n\n# Analyze position\nanalysis = engine.analyse(board, chess.engine.Limit(depth=20))\nprint(analysis[\"score\"]) # Cp(+20)\nprint(analysis[\"pv\"]) # principal variation\n\nengine.quit()\n```\n\n**Multi-PV Analysis:**\n```python\n# Get top 3 lines\nanalysis = engine.analyse(board, chess.engine.Limit(depth=20), multipv=3)\nfor info in analysis:\n print(info[\"score\"], info[\"pv\"][0])\n```\n\n**Custom Engine Options:**\n```python\nengine = chess.engine.SimpleEngine.popen_uci(\"stockfish\")\nengine.configure({\n \"Threads\": 4,\n \"Hash\": 256,\n \"Skill Level\": 20\n})\n```\n\n**Analyze Game:**\n```python\nimport chess.pgn\n\ndef analyze_game(pgn_path):\n with open(pgn_path) as f:\n game = chess.pgn.read_game(f)\n \n board = game.board()\n engine = chess.engine.SimpleEngine.popen_uci(\"stockfish\")\n \n for move in game.mainline_moves():\n board.push(move)\n analysis = engine.analyse(board, chess.engine.Limit(depth=18))\n score = analysis[\"score\"].relative.score(mate_score=10000)\n print(f\"{move}: {score/100:.2f}\")\n \n engine.quit()\n```\n\n**UCI Protocol:**\n```\nuci\nisready\nposition startpos moves e2e4 e7e5\ngo depth 20\nbestmove e2e4\n```"}} | |