diff --git a/.github/workflows/connect.yml b/.github/workflows/connect.yml index 3acb478..bbe21de 100644 --- a/.github/workflows/connect.yml +++ b/.github/workflows/connect.yml @@ -25,16 +25,6 @@ on: required: false type: number default: 6 - level: - description: "Level" - required: false - type: number - default: 8 - bpm: - description: "BPM" - required: false - type: number - default: 200 jobs: connect: @@ -48,6 +38,12 @@ jobs: with: exclude_inputs: os, next_count, level, bpm - uses: actions/checkout@v4 + - name: Upgrade glibc + if: ${{ inputs.os == 'ubuntu' }} + run: | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install --only-upgrade libstdc++6 - name: Build Project uses: ./.github/actions/build_dotnet with: @@ -64,10 +60,9 @@ jobs: import json config = { "NextCnt": ${{ inputs.next_count }}, - "Level": ${{ inputs.level }}, - "BPM": ${{ inputs.bpm }}, "Token": "${{ inputs.token }}", - "RoomKey": "${{ inputs.master_key }}" + "RoomKey": "${{ inputs.master_key }}", + "Quiet": True } json.dump(config, open("${{ env.OUTPUT_FOLDER }}/botconfig.json", "w")) - name: Run bot @@ -75,4 +70,4 @@ jobs: run: | pushd ${{ env.OUTPUT_FOLDER }} chmod +x ${{ env.PROJECT_NAME }} - ./${{ env.PROJECT_NAME }} --quiet + ./${{ env.PROJECT_NAME }} \ No newline at end of file diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c150e9c..a7d96ce 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -38,11 +38,15 @@ jobs: with: name: ${{ env.PROJECT_NAME }}_${{ matrix.os }} path: ${{ env.OUTPUT_FOLDER }}/* + - name: Prepare for release + if: ${{ (startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v'))}} + run: | + 7z a -tzip ${{ env.PROJECT_NAME }}_${{ matrix.os }}.zip ${{ env.OUTPUT_FOLDER }}/* - name: Upload release if: ${{ (startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v'))}} uses: ncipollo/release-action@v1 with: allowUpdates: true artifacts: | - ${{ env.OUTPUT_FOLDER }}/* + ${{ env.PROJECT_NAME }}_${{ matrix.os }}.zip prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }} diff --git a/BotrisBattle.NET/BotrisType.cs b/BotrisBattle.NET/BotrisType.cs index 194d271..99b77bc 100644 --- a/BotrisBattle.NET/BotrisType.cs +++ b/BotrisBattle.NET/BotrisType.cs @@ -97,10 +97,11 @@ public enum Block // Enum for Command public enum Command { - hold, move_left, move_right, sonic_left, sonic_right, + hold, move_left, move_right, sonic_left, sonic_right, hard_drop, rotate_cw, rotate_ccw, drop, sonic_drop } + // Enum for ClearName public enum ClearName { diff --git a/ZZZTOJ.Botris/ZZZBot.cs b/ZZZTOJ.Botris/ZZZBot.cs index 66b7123..84690bd 100644 --- a/ZZZTOJ.Botris/ZZZBot.cs +++ b/ZZZTOJ.Botris/ZZZBot.cs @@ -133,12 +133,17 @@ public MoveResult GetMove(RequestMovePayload requestMovePayload) //} int[] comboTable = new int[] { 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 4,4,4,4, -1 }; + + if (!BotSetting.Quiet) { + Console.WriteLine("T={0},X={1},Y={2},R={3}",requestMovePayload.GameState.current.piece[0],requestMovePayload.GameState.current.x, requestMovePayload.GameState.current.y, requestMovePayload.GameState.current.rotation); + } var path = ZZZTOJCore.BotrisAI3(field1, 10, 22, requestMovePayload.GameState.b2b ? 1 : 0, requestMovePayload.GameState.combo, requestMovePayload.GameState.queue.Select(s => s[0]).ToArray(), - requestMovePayload.GameState.held == null ? ' ': requestMovePayload.GameState.held[0], - requestMovePayload.GameState.canHold, requestMovePayload.GameState.current.piece[0], 3, 1, 0, true, false, requestMovePayload.GameState.garbageQueued.Length, comboTable, BotSetting.NextCnt, BotSetting.Duration); + requestMovePayload.GameState.canHold, requestMovePayload.GameState.current.piece[0], + requestMovePayload.GameState.current.x, 20 - requestMovePayload.GameState.current.y, requestMovePayload.GameState.current.rotation, + true, false, requestMovePayload.GameState.garbageQueued.Length, comboTable, BotSetting.NextCnt, BotSetting.Duration); string resultpath = Marshal.PtrToStringAnsi(path); _IOBoard.NextQueue.Enqueue(TetrisMino.Z); Console.WriteLine(resultpath.PadRight(50)); @@ -150,22 +155,16 @@ public MoveResult GetMove(RequestMovePayload requestMovePayload) case 'z': case 'Z': _IOBoard.LeftRotation(); - moveResult.moves.Add(Command.rotate_ccw); break; case 'c': case 'C': _IOBoard.RightRotation(); - moveResult.moves.Add(Command.rotate_cw); - break; case 'l': _IOBoard.MoveLeft(); - moveResult.moves.Add(Command.move_left); - - break; case 'L': while (_IOBoard.MoveLeft()) ; @@ -179,14 +178,14 @@ public MoveResult GetMove(RequestMovePayload requestMovePayload) case 'R': while (_IOBoard.MoveRight()) ; moveResult.moves.Add(Command.sonic_right); - break; case 'd': + _IOBoard.SoftDrop(); + moveResult.moves.Add(Command.drop); + break; case 'D': _IOBoard.SonicDrop(); - moveResult.moves.Add(Command.sonic_drop); - break; case 'v': //_IOBoard.OnHold(); @@ -229,9 +228,7 @@ public MoveResult GetMove(RequestMovePayload requestMovePayload) // moveResult.expected_cells[i][0] = list[i].Y; //} _IOBoard.HardDrop(); - - moveResult.moves.Add(Command.drop); - + //moveResult.moves.Add(Command.hard_drop); break; default: break; @@ -239,9 +236,9 @@ public MoveResult GetMove(RequestMovePayload requestMovePayload) if (move == 'V') break; } - _IOBoard.PrintBoard(); if (!BotSetting.Quiet) { + _IOBoard.PrintBoard(); Console.WriteLine($"combo: {requestMovePayload.GameState.combo,-3} b2b: {requestMovePayload.GameState.b2b} garbage: {requestMovePayload.GameState.garbageQueued.Length,-3}"); Console.WriteLine($"mino: {requestMovePayload.GameState.current.piece} pos: {requestMovePayload.GameState.current.x} {requestMovePayload.GameState.current.y}"); }