Giter Site home page Giter Site logo

e4p-code's People

Contributors

pragdave avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

e4p-code's Issues

Consider putting tally/1 into module Hangman

Hi,

at the end of the chapter (checkpoint 050-start-hangman-complete) you have suggested moving make_move/2 directly under public API module Hangman. Following the same logic, I would suggest that tally/1 should be also there. So the code would read

defmodule Hangman do
  alias Hangman.Game

  defdelegate new_game(), to: Game

  def make_move(game, guess) do
    game = Game.make_move(game, guess)
    { game, tally(game)}
  end

  def tally(game) do
    %{
      game_state: game.game_state,
      turns_left: game.turns_left,
      letters:    game.letters |> reveal_guessed(game.used),
    }
  end

  ############################################################################

  defp reveal_guessed(letters, used) do
    letters |> Enum.map(fn letter -> reveal_letter(letter, MapSet.member?(used, letter)) end)
  end

  defp reveal_letter(letter, _in_word = true), do: letter
  defp reveal_letter(_letter, _not_in_word), do: "_"

end

I've put the reveal_guessed there as well as it seems as a transform function which is used to create a public API (sort of view functionality).

Honestly, I am not really sure if I like it :)

Separated ecto application supervisor strategy

I have a situation where my phoenix layer connects to a postgres ecto layer before connecting to the postgres database. Should the postgres ecto layer supervisor strategy be a simple_one_for_one? Why or why not?

Hangman application supervisor

It Probably runs the error

:simple_one_for_one strategy is deprecated, please use DynamicSupervisor instead

Please update the course to actual versions.

Where's the code ?

Hi Dave, first off thanks for the awesome course.

Just wondering: what happened to the code?

Plenty of links in the course still lead to this repo.

Question about Genservers and Agents

I understand why you used an Agent to handle state in the Dictionary application.

What I don't understand is why you chose to use Genserver to manage state in the Hangman application. Why didn't you use Agents if they can also get the job done?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.