> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fincept.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Fictitious Play Algorithm

> Find approximate Nash equilibrium using fictitious play learning dynamics. Each player best-responds to the empirical frequency of opponent's past play. Converges to Nash equilibrium for certain game classes (e.g., zero-sum games, potential games). Returns the limiting mixed strategy profile after specified iterations. Useful for learning dynamics and evolutionary game theory. [Tier: STANDARD, Credits: 2]



## OpenAPI

````yaml api-specs/economics.json post /quantlib/economics/games/fictitious-play
openapi: 3.1.0
info:
  title: FinceptQuantLib API - Economics
  description: >-
    Economics module endpoints for FinceptQuantLib API - general equilibrium,
    game theory, auctions, and utility functions
  version: 3.0.0
  contact:
    name: Fincept API Support
    url: https://fincept.in
servers:
  - url: https://api.fincept.in
    description: Fincept API Production Server
security:
  - APIKeyHeader: []
tags:
  - name: quantlib-economics
    description: >-
      Economics module - general equilibrium, game theory, auctions, and utility
      theory
    x-displayName: Economics
paths:
  /quantlib/economics/games/fictitious-play:
    post:
      tags:
        - quantlib-economics
      summary: Fictitious Play Algorithm
      description: >-
        Find approximate Nash equilibrium using fictitious play learning
        dynamics. Each player best-responds to the empirical frequency of
        opponent's past play. Converges to Nash equilibrium for certain game
        classes (e.g., zero-sum games, potential games). Returns the limiting
        mixed strategy profile after specified iterations. Useful for learning
        dynamics and evolutionary game theory. [Tier: STANDARD, Credits: 2]
      operationId: fictitious_play_quantlib_economics_games_fictitious_play_post
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - payoff_matrix_1
                - payoff_matrix_2
              properties:
                payoff_matrix_1:
                  type: array
                  description: Payoff matrix for Player 1
                  items:
                    type: array
                    items:
                      type: number
                  example:
                    - - 3
                      - 0
                    - - 5
                      - 1
                payoff_matrix_2:
                  type: array
                  description: Payoff matrix for Player 2
                  items:
                    type: array
                    items:
                      type: number
                  example:
                    - - 3
                      - 5
                    - - 0
                      - 1
                iterations:
                  type: integer
                  description: Number of iterations to run
                  minimum: 1
                  default: 1000
                  example: 1000
                seed:
                  type: integer
                  description: Random seed for reproducibility (null for random)
                  example: 42
                  nullable: true
            example:
              payoff_matrix_1:
                - - 3
                  - 0
                - - 5
                  - 1
              payoff_matrix_2:
                - - 3
                  - 5
                - - 0
                  - 1
              iterations: 1000
              seed: 42
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      strategy_1:
                        type: array
                        description: Player 1's limiting strategy (empirical frequency)
                        items:
                          type: number
                        example:
                          - 0.1
                          - 0.9
                      strategy_2:
                        type: array
                        description: Player 2's limiting strategy (empirical frequency)
                        items:
                          type: number
                        example:
                          - 0.05
                          - 0.95
                      iterations:
                        type: integer
                        description: Number of iterations completed
                        example: 1000
              example:
                success: true
                data:
                  strategy_1:
                    - 0.1
                    - 0.9
                  strategy_2:
                    - 0.05
                    - 0.95
                  iterations: 1000
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/InsufficientTierError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
              example:
                detail:
                  - loc:
                      - body
                      - iterations
                    msg: ensure this value is greater than 0
                    type: value_error.number.not_gt
      security:
        - APIKeyHeader: []
components:
  responses:
    UnauthorizedError:
      description: Authentication information is missing or invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Invalid API key
    InsufficientTierError:
      description: API tier insufficient for this endpoint
      content:
        application/json:
          schema:
            type: object
            properties:
              detail:
                type: string
                example: Endpoint requires Basic tier or higher
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key for authentication. Get your key at
        https://api.fincept.in/auth/register

````