Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ximula #655

Merged
merged 6 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/game_of_life/lib/game_of_life/grid.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule GameOfLife.Grid do
alias Sim.Torus, as: Grid
alias Ximula.Torus, as: Grid

defdelegate height(grid), to: Sim.Torus
defdelegate height(grid), to: Ximula.Torus

def toggle(grid, x, y) do
current = Grid.get(grid, x, y)
Expand Down
3 changes: 2 additions & 1 deletion apps/game_of_life/lib/game_of_life/sim_service.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ defmodule GameOfLife.SimService do
@behaviour Sim.CommandHandler

alias GameOfLife.Simulation
alias Ximula.Grid

@impl true
def execute(:tick, []) do
change_data(fn grid ->
changes = grid |> Simulation.sim()
grid = Sim.Grid.apply_changes(grid, changes)
grid = Grid.apply_changes(grid, changes)
{grid, [{:changed, changes: changes}]}
end)
end
Expand Down
2 changes: 1 addition & 1 deletion apps/game_of_life/lib/game_of_life/simulation.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule GameOfLife.Simulation do
alias Sim.Torus, as: Grid
alias Ximula.Torus, as: Grid

def sim(grid) do
Enum.reduce(0..(Grid.width(grid) - 1), %{}, fn x, changes ->
Expand Down
3 changes: 2 additions & 1 deletion apps/game_of_life/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule GameOfLife.MixProject do
def project do
[
app: :game_of_life,
version: "0.6.0",
version: "0.7.0",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand Down Expand Up @@ -32,6 +32,7 @@ defmodule GameOfLife.MixProject do
defp deps do
[
{:sim, in_umbrella: true},
{:ximula, github: "grrrisu/Ximula"},
{:phoenix_pubsub, "~> 2.0"},
{:credo, "~> 1.5", only: [:dev, :test], runtime: false}
]
Expand Down
2 changes: 1 addition & 1 deletion apps/game_of_life/test/game_of_life/simulation_test.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule GameOfLife.SimulationTest do
use ExUnit.Case, async: true

alias Sim.Torus, as: Grid
alias Ximula.Torus, as: Grid
alias GameOfLife.Simulation

# https://de.wikipedia.org/wiki/Conways_Spiel_des_Lebens#Die_Spielregeln
Expand Down
2 changes: 1 addition & 1 deletion apps/game_of_life/test/game_of_life_test.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule GameOfLifeTest do
use ExUnit.Case, async: false

alias Sim.Torus, as: Grid
alias Ximula.Torus, as: Grid

setup do
Phoenix.PubSub.subscribe(ThundermoonWeb.PubSub, "GameOfLife")
Expand Down
112 changes: 0 additions & 112 deletions apps/sim/lib/sim/object/grid.ex

This file was deleted.

41 changes: 0 additions & 41 deletions apps/sim/lib/sim/object/torus.ex

This file was deleted.

168 changes: 0 additions & 168 deletions apps/sim/lib/sim/realm/access_proxy.ex

This file was deleted.

2 changes: 1 addition & 1 deletion apps/sim/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Sim.MixProject do
def project do
[
app: :sim,
version: "0.10.0",
version: "0.11.0",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand Down
Loading
Loading