Skip to content

feat: Add web interface using Pollinations.ai API#2

Open
voodoohop wants to merge 19 commits intolechmazur:mainfrom
voodoohop:main
Open

feat: Add web interface using Pollinations.ai API#2
voodoohop wants to merge 19 commits intolechmazur:mainfrom
voodoohop:main

Conversation

@voodoohop
Copy link

This PR adds a web-based interface to the step game that uses the free Pollinations.ai API to simulate LLM responses. The new interface makes it easier to run and visualize the game while maintaining all the original game mechanics.

Key Features:

  • Visual game board showing real-time player positions
  • Interactive player selection with multiple LLM options
  • Character type system (strategist, diplomat, trickster, etc.)
  • Real-time conversation display between players
  • Auto-advance mode for continuous play
  • Win tracking and scoreboard
  • Modern, responsive UI design

Technical Changes:

  • Added index.html with the main game interface
  • Added game.js with core game logic and API integration
  • Added styles.css for UI styling
  • Modified conversation prompt template for more concise responses
  • Updated README with web interface documentation

The implementation uses the free Pollinations.ai API, making it accessible to anyone who wants to try the game without needing to set up their own LLM infrastructure.

- Change API endpoint to a constant for flexibility
- Enhance logging with detailed move and collision info
- Add exponential backoff for API requests
- Adjust max sub-rounds to 2 for game balance
- Remove unnecessary config file and constants
- Simplify prompt construction for player responses
- Ensure last valid move is selected from response
- Introduce player order randomization at game start
- Adjust API retry logic for efficiency
- Add helper function to shuffle player array
- Deleted llm_feedback.html as it is no longer needed
- Removed associated styles and scripts
- Cleaned up project directory by eliminating unused files
- Ensure content after last </think> is returned
- Log all content before the last </think> tag
- Introduced a new section in the UI to display player thoughts.
- Updated `removeThink` function to handle player thoughts.
- Randomized player order in conversation phase for varied interactions.
- Styled player thoughts with distinct colors for each player.
- Ensure consistent random seed generation
- Limit seed range to 0-999999 for better control
- Change game title to "Pump and Dump Game"
- Update HTML elements to reflect new game name
- Add new script for DOM manipulation

Enhance API error handling and logging
- Add null checks for API response content
- Improve logging for API requests and responses
- Consolidate error handling for API calls

Revise game logic and scoring system
- Implement new scoring rules for "Pump and Dump"
- Adjust game constants for shorter rounds
- Update player character types and descriptions

Improve UI and game flow
- Update scoreboard and player labels dynamically
- Enhance conversation and move phase transitions
- Add auto-advance option for seamless gameplay

Simplify prompt templates
- Remove redundant game rules from prompts
- Streamline conversation and move instructions
- Ensure clarity and conciseness in player guidance

Refactor CSS for better layout and styling
- Adjust track label positioning and styles
- Enhance scoreboard appearance and alignment
- Improve button and score item styling for clarity
- Include "referrer: 'roblox'" in API request payload
- Change default character type to 'trickster'
- Adjust MAX_SUB_ROUNDS to 2 for longer conversations
- Update PAYOFFS structure for clarity and adjust point values
- Optimize move processing with parallel promises
- Simplify winner check and round transition logic
- Revise prompts for clarity and consistency in instructions
- Introduced reasoning toggle for each player in UI
- Updated API endpoint to localhost for development
- Implemented prompt caching to improve performance
- Adjusted game start logic to load prompts initially
- Removed reasoning section from common rules file
- Replace fetch with loadPrompt for prompt loading
- Simplify move processing with helper functions
- Adjust point calculation logic in common rules
- Improve logging for moves and points earned
- Remove redundant code and streamline processMoves function
- Lowered temperature in API request for more consistent responses
- Changed default character type to 'competitive'
- Removed unused playerName variable in functions
- Updated character types with 'competitive' and 'selective-ally'
- Simplified conversation prompt template by removing redundant line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant