HW1

Othello Arena

Back to AGI-25 Syllabus

In this homework, you will design your Othello strategy to compete with the built-in agents in Othello-Arena. (Deadline: Mar 23 11:59pm, Estimated time to complete: 10-30 hrs including implementation, testing, and write-up)

Assignment Overview

Testing Your Agent

Here’s a starter strategy that demonstrates important concepts:

function myStrategy(board, player) {
  // Write your custom Othello strategy here
  // Return an object with row and col properties, or null if no moves are possible
  // Example: return { row: 3, col: 4 } or return null

  // Available variables:
  // board: 8x8 array where 0=empty, 1=black, 2=white
  // player: 1 for black, 2 for white
  // getValidMoves(player): returns array of valid moves for player

  // Strategy: Find best move based on position value
  const validMoves = getValidMoves(player);
  if (validMoves.length === 0) return null;

  // Position weights - corners are best, edges next, avoid squares next to corners
  const positionWeights = [
      [90, -15, 10, 5, 5, 10, -15, 90],
      [-15, -25, -3, -3, -3, -3, -25, -15],
      [10, -3, 2, 1, 1, 2, -3, 10],
      [5, -3, 1, 1, 1, 1, -3, 5],
      [5, -3, 1, 1, 1, 1, -3, 5],
      [10, -3, 2, 1, 1, 2, -3, 10],
      [-15, -25, -3, -3, -3, -3, -25, -15],
      [90, -15, 10, 5, 5, 10, -15, 90]
  ];

  let bestMove = null;
  let bestScore = -Infinity;

  for (const move of validMoves) {
      // Score based on position
      const positionScore = positionWeights[move.row][move.col];
      
      if (positionScore > bestScore) {
          bestScore = positionScore;
          bestMove = move;
      }
  }

  return bestMove;
}

Your strategy will be packaged as a custom function for this othello-arena. Open the developer tool,check line 725 of the html file, to understand how it will work.

alt text

Submission Guidelines

Saving Your Strategy

  1. Copy your strategy code into the code editor in the Othello Arena
  2. Enter a name for your strategy in the “Strategy Name” field
  3. Click “Save Strategy” to save it to your browser’s local storage
  4. Test your strategy against the built-in AIs and other custom strategies
  5. When you’re satisfied with your strategy, save the code as a .js file for submission

HW1 will take 15% of the overall grade, and the evaluation criteria of the PDF and the algorithm will be determined during grading.

References

For those interested in diving deeper into Othello and Games: