Add initial implementation of Hopfield and Hamming networks with web interface
- Create Dockerfile and entrypoint script for application setup - Implement pattern loading from Excel and weight caching - Develop core functions for Hopfield and Hamming networks - Add Sinatra web server for user interaction - Create HTML interface for displaying patterns and results - Include necessary gems in Gemfile and lockfile - Add .dockerignore and .gitignore files
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
require 'roo'
|
||||
|
||||
def load_patterns(file)
|
||||
xlsx = Roo::Spreadsheet.open(file)
|
||||
xlsx.sheets.each_with_object({}) do |sheet_name, patterns|
|
||||
xlsx.default_sheet = sheet_name
|
||||
matrix = (1..8).map { |row| (1..8).map { |col| xlsx.cell(row, col).to_s.strip.downcase == 'x' ? 1 : -1 } }
|
||||
patterns[sheet_name.to_sym] = matrix
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user