View Source HanoiWeb.HanoiGameControllerLive (Towers of Hanoi v1.0.0)

Controller that renders the main Hanoi game page

Receives liveview events from the page and updates state accordingly

Main page furniture is rendered here. The main board visual rendering functions are in RenderBoard.

Algo

Server

Web

Session

App

Controller

View

Model

per game

Application

IdPlug

Purger

Hanoi_GameControllerLive

Hanoi_GameView

CoreComponents

TowerGame

TowerState

Board

Algo

Phoenix Webserver

ETS 

Summary

Functions

Handle the auto_mode, move_stone & reset clicks from page

Handle the refresh_board messages triggered by auto_mode

Set up initial liveview state

Render the page based on current state

Functions

Link to this function

handle_event(binary, arg2, socket)

View Source
@spec handle_event(
  event :: binary(),
  Phoenix.LiveView.unsigned_params(),
  socket :: Phoenix.LiveView.Socket.t()
) :: {:noreply, Phoenix.LiveView.Socket.t()}

Handle the auto_mode, move_stone & reset clicks from page

Link to this function

handle_info(atom, socket)

View Source
@spec handle_info(msg :: term(), socket :: Phoenix.LiveView.Socket.t()) ::
  {:noreply, Phoenix.LiveView.Socket.t()}

Handle the refresh_board messages triggered by auto_mode

Link to this function

mount(params, session, socket)

View Source
@spec mount(
  params :: Phoenix.LiveView.unsigned_params(),
  session :: map(),
  socket :: Phoenix.LiveView.Socket.t()
) :: {:ok, Phoenix.LiveView.Socket.t()}

Set up initial liveview state

Render the page based on current state