This assignment is a relatively simple program to capture various aspects of programming languages. We will work on versions of the program using 4 different languages. Next we will use Elixir. You may use any modules that are in the default Elixir library.

The application is a simple Bridge Bidding game described here. In addition to the specifications there, the following Elixir-specific parameters will apply:

  1. Do
          cd
          cd cps506
          mkdir A2
          fossil clone .... (paste the line from the account page)
          cd A2
          fossil open ../cps506-A2-...
    to set up your working directory.
  2. Do mix new assign2 to create your package. (This has already been done in your A2 fossil.)
  3. Your Assign2 module must have a withPermutation/1 function that accepts a list of integers represting a deck of up to 52 cards and returns a "game object". Since there are no objects in Elixir, "game object" refers to data of some sort - possibly a tuple, map, process or array - that you choose to represent your game.
  4. Your Assign2 module must have a format/1 function that formats the "game object" as a string.
  5. When run via iex -S mix, the above methods would return results.
  6. Put your ownership information (see the assignment page) in the Assign2/README.md file.
  7. Your code will be tested via iex -S mix.
  8. The marker should be able to run your program by entering the following code:
    $ iex -S mix
    Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help)
    iex(1)> Assign2.withPermutation([1,2,3,4]) |> Assign2.format() |> IO.write()
        North
        S
        H
        D
        C 3
    West     East
    S        S
    H        H
    D        D
    C 2      C 4
        South
        S
        H
        D
        C 5
       South West North East
       Pass  Pass Pass  Pass
       Declarer: None
    :ok
    iex(2)> 
    
    Note that the format function returns a string; it does no I/O. Piping it to IO.write formats it with the newline charater interpreted appropriately.
  9. The Elixir style guide is a good source of guidance on code structuring.

You should do your assignment in the your Fossil CPS506 repository in the Assign2 directory. Every time you have completed a part of the assignment, you should commit it to the repository. You shouldn't wait until everything is complete to do this, it's better to check in regularly. Remember to do fossil status and fossil ext from somewhere within the repository periodically to make sure you're commiting all of your code. Also remember to not add binary files or other files that can be generated from the source. You can use fossil add and fossil rm as many times as you want, but you only have to do it once each time there are new files to be included in the repository. (There is also a fossil addremove command, but there is something unintuitive about it so I rarely use it.) In a terminal/command window simply change to the working directory and check-in, for example:

  cd
  cd cps506/A2
  fossil ci -m "finished code and tests for BidBridge"