Commit a426f06c authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

fixes

parent dc2d9f21
Loading
Loading
Loading
Loading
+51 −3
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ prebuild_problem_3:
        exit 1;
      fi

    - git clone https://trachten-gitlab:${HW_INTERNAL}@agile.bu.edu/gitlab/ec330/ec330_staff/homeworks_internal/hw8_ec.git hw8_ec
    - git clone https://trachten-gitlab:${HW_INTERNAL_WRITE}@agile.bu.edu/gitlab/ec330/ec330_staff/homeworks_internal/hw8_ec.git hw8_ec

    - cp include/MyPlayer.h hw8_ec/Players/Student/include
    - cp impl/MyPlayer.cpp hw8_ec/Players/Student/impl/
@@ -39,7 +39,7 @@ compile_problem_3:
    - if: '$CI_COMMIT_REF_NAME == "problem3"'
  tags: [c++-17]

test_opponents:
test_standard_opponents:
  stage: test
  needs:
    - job: compile_problem_3
@@ -114,3 +114,51 @@ register_player:
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3"'
  tags: [c++-17]

test_all_opponents:
  stage: compete
  needs:
    - job: register_player
      artifacts: true
  script:
    - cd hw8_ec
    - |
      if [ $((RANDOM % 2)) -eq 0 ]; then
        STUDENT_COLOR="White"
        OPPO_COLOR="Black"
      else
        STUDENT_COLOR="Black"
        OPPO_COLOR="White"
      fi
      
      echo "YOU play: $STUDENT_COLOR"
      echo "$OPPO plays:  OPPO_COLOR"
    - ./loadOppo.sh "$OPPO" "$OPPO_COLOR"
    - make play
    - |
      # Run the program and capture exit status
      set +e
      ./play
      status=$?
      set -e
      
      case "$status:$STUDENT_COLOR" in
      1:White|2:Black)
      echo "You win!"
      curl "https://agile.bu.edu/ec330_scripts/chessScores.pl?key=${MAGIC_KEY}&name=${GITLAB_USER_LOGIN}&result=1"
      ;;
      *)
      echo "You lost :-("
      curl "https://agile.bu.edu/ec330_scripts/chessScores.pl?key=${MAGIC_KEY}&name=${GITLAB_USER_LOGIN}&result=1"
      ;;
      esac
  allow_failure: true
  artifacts:
    paths:
      - hw8_ec/
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem3"'
  tags: [c++-17]
  parallel:
    matrix:
      - OPPO: ["Random", "Smarter", "Smartest"]
 No newline at end of file