clojusc / clj-starlanes Goto Github PK
View Code? Open in Web Editor NEWA Clojure Implementation of the Classic BASIC Game
License: BSD 3-Clause "New" or "Revised" License
A Clojure Implementation of the Classic BASIC Game
License: BSD 3-Clause "New" or "Revised" License
This will require lots of file/namespace tweaking, but it will be cleaner in the end.
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)
Right now, the logic doesn't support neighboring outposts to become part of a new company when next to company that forms as a result of being next to a star.
FAIL in (test-merge-companies) (company_test.clj:172)
expected: (= "B" (star-map :a5))
actual: (not (= "B" "C"))
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.
This is described in the instructions, section 4:
"...each player is paid a cash bonus proportional to the
percentage of outstanding stock they held in the defunct
company...."
Split it out into multiple modules.
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).
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.
The game state :company and :companies-queue keys need to be updated.
This codebase is old and wasn't originally very idiomatic. Some bits have been updated, but it would be good to check everything.
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.
When issue #10 is completed, this will become priority:high.
This was removed a while ago. Need to put it back.
Also need to add functions for updating cash amount and getting cash amount.
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.
Because it's ASCII, it will always have lines (look gridded). Not nice visually.
Looks like an off-by-one error...
In other words, use thrushing where applicable (and where code readability is improved by it).
The in-game 'help' command is asking if any player needs instructions.
The values for the :companies and :companies-queue keys in the game state data structure are not being updated when one or more companies are merged with another.
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.
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.
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
Check for smells, unused requires, etc.
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.
Too many nested function calls.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.