Coder Social home page Coder Social logo

clj-starlanes's People

Contributors

oubiwann avatar quixoticduck avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

clj-starlanes's Issues

Calling the "ticker" command causes exception

What is your move? ticker
Exception in thread "main" clojure.lang.ArityException: 
  Wrong number of args (0) passed to: finance$-display-companies-values
    at clojure.lang.AFn.throwArity(AFn.java:437)
    at clojure.lang.AFn.invoke(AFn.java:35)
    at starlanes.finance$display_companies_values.invoke(finance.clj:48)

Stock purchasing logic doesn't execute

The new functionality put in place for issue #18 has a bug: the options for purchasing stock never display, even during a turn when a player can afford to purchase at lease one company's shares.

When merging companies, current move is missing

After a merge, the smaller company does get relabeled with the bigger company's letter. However, the move that caused the two companies to join does not get recorded (it's still displayed as empty space).

Account for outpost growth when max companies are in play

Right now, when a player expands a company's reach by annexing a neighboring outpost, only the immediate neighbors of the coordinate for the move is checked. This would be sufficient if outposts only ever existed with no neighbors.

Once the max company count is hit, two outposts can exist side-by-side, and in fact, could span a significant portion of the board. The way the code is right now, only immediate neighbors would be annexed, leaving the rest of the contiguous outposts as outposts. In that scenario, all adjoining outposts need to be annexed.

Add lein-kibit and check code

This codebase is old and wasn't originally very idiomatic. Some bits have been updated, but it would be good to check everything.

Player does not accrue cash at each turn

Players need a means of earning cash with each turn. From the instructions:

"Next the computer adds stock dividends to the player's
cash on hand (5% of the market value of the stock in
their possession)..."

This is blocking issue #18.

Cash accrues even when move count doesn't increment

Currently, when a player enters any command that doesn't advance the game (i.e., doesn't enter an actual move coordinate, but instead does something like "help" or "stock"), the logic for adding cash to the current player's bank account still executes, causing that player's cash to increase with every non-move command entry.

Players need to be able to buy stock at each turn

  • List companies
  • Prompt: "Current cash: XXX Buy how many shares of YYY? (hit to skip) "
  • Iterate until all companies are presented
  • If player runs low on cash, only present companies whose share prices are affordable (player could buy one or more)
  • If player runs out of cash (can't afford any stocks for any company), end query and proceed to next player move

Typos in the instructions

In section 4, this:

"Each
player's stock in the defunct company is exchanged for
shares kn the survivor on a ratio of 2 for 1."

Should be this:

"Each
player's stock in the defunct company is exchanged for
shares in the survivor on a ratio of 2 for 1."

This:

, and offers them the opportunity to
purchase stock kn any of the active companies on the board.

Should be this:

, and offers them the opportunity to
purchase stock kn any of the active companies on the board.

Add "bank" data

To make it easier to update player data, create "bank" data structure, analogous to the "stock exchange" data structure.

This is currently blocking issue #25.

Sometimes when merging, null pointer exception is thrown

Here was board right before the error:

       Star Traders
       ============

    a | b | c | d | e
  +-------------------+
1 | C   .   .   B   B |
2 | C   C   .   B   B |
3 | C   .   *   .   . |
4 | .   .   A   A   A |
5 | A   A   A   A   A |
  +-------------------+

Carol, here are your legal moves for this turn:
  3e 4a 3d 1b 2c

What is your move? 3e

This was the error:

Merging companies ...
Exception in thread "main" java.lang.NullPointerException
    at clojure.lang.Numbers.ops(Numbers.java:942)
    at clojure.lang.Numbers.add(Numbers.java:126)
    at clojure.core$_PLUS_.invoke(core.clj:944)
    at clojure.core.protocols$fn__6034.invoke(protocols.clj:143)
    at clojure.core.protocols$fn__6005$G__6000__6014.invoke(protocols.clj:19)
    at clojure.core.protocols$seq_reduce.invoke(protocols.clj:27)
    at clojure.core.protocols$fn__6026.invoke(protocols.clj:53)
    at clojure.core.protocols$fn__5979$G__5974__5992.invoke(protocols.clj:13)
    at clojure.core$reduce.invoke(core.clj:6175)
    at starlanes.finance.stock$get_company_shares.invoke(stock.clj:30)
    at starlanes.finance.company$get_company_value.invoke(company.clj:156)
    at starlanes.finance.company$get_companies_values$fn__309.invoke(company.clj:169)
    at clojure.core$map$fn__4207.invoke(core.clj:2487)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core.protocols$seq_reduce.invoke(protocols.clj:30)
    at clojure.core.protocols$fn__6026.invoke(protocols.clj:54)
    at clojure.core.protocols$fn__5979$G__5974__5992.invoke(protocols.clj:13)
    at clojure.core$reduce.invoke(core.clj:6177)
    at clojure.core$into.invoke(core.clj:6229)
    at starlanes.finance.company$get_companies_values.invoke(company.clj:168)
    at starlanes.finance.company$get_greatest_company.invoke(company.clj:184)
    at starlanes.finance.company$_merge_companies.invoke(company.clj:238)
    at starlanes.finance.company$merge_companies.invoke(company.clj:248)
    at starlanes.game.movement$update_map_with_move.invoke(movement.clj:62)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$process_command.invoke(game.clj:123)
    at starlanes.game$validate_move.invoke(game.clj:174)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$process_command.invoke(game.clj:123)
    at starlanes.game$validate_move.invoke(game.clj:174)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$process_command.invoke(game.clj:123)
    at starlanes.game$validate_move.invoke(game.clj:174)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$process_command.invoke(game.clj:123)
    at starlanes.game$validate_move.invoke(game.clj:174)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$process_command.invoke(game.clj:123)
    at starlanes.game$validate_move.invoke(game.clj:174)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$process_command.invoke(game.clj:123)
    at starlanes.game$validate_move.invoke(game.clj:174)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$process_command.invoke(game.clj:123)
    at starlanes.game$validate_move.invoke(game.clj:174)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$process_command.invoke(game.clj:123)
    at starlanes.game$validate_move.invoke(game.clj:174)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$process_command.invoke(game.clj:123)
    at starlanes.game$validate_move.invoke(game.clj:174)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.game$process_move.invoke(game.clj:133)
    at starlanes.game$validate_move.invoke(game.clj:172)
    at starlanes.game$do_player_turn.invoke(game.clj:188)
    at starlanes.game$do_player_turn.invoke(game.clj:181)
    at starlanes.trader$_main.invoke(trader.clj:14)
    at clojure.lang.AFn.applyToHelper(AFn.java:159)
    at clojure.lang.AFn.applyTo(AFn.java:151)
    at starlanes.trader.main(Unknown Source)
make: *** [run-jar-standalone] Error 1

Implement a company merger solution

The company with the largest number of held shares (summed over all players in the game) should win.

In the event of a tie, the company with the greatest number of pieces on the board should win.

In the even of that tieing, a company should be selected at random as the winner.

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.