jbrains / trivia Goto Github PK
View Code? Open in Web Editor NEWThis project forked from caradojo/trivia
Legacy Code Retreat - Trivia Game codebase
Home Page: https://www.jbrains.ca/legacy-code-retreat/
License: GNU General Public License v3.0
This project forked from caradojo/trivia
Legacy Code Retreat - Trivia Game codebase
Home Page: https://www.jbrains.ca/legacy-code-retreat/
License: GNU General Public License v3.0
Javascript versions (including Js, node and typescript) have the word "correct" spelled correctly. this console log should have it spelled "corrent"
Lines 143 to 148 in f639bdb
They should match the Java version.
trivia/java/src/main/java/com/adaptionsoft/games/uglytrivia/Game.java
Lines 138 to 142 in f639bdb
This is a comment from someone who attended a workshop. I'm not sure what it means yet.
Typescript code did not contain dependencies for file system and editing. I believe making the repo for Typescript as a Node project is going to fix it..
I don't know whether this is something we should do or if not doing it contributes to the "legacy experience" feeling.
I recently animated a training on this kata and I had some trouble running tests with coverage with windows machines. I said windows machines cause running the kata on my linux machine worked perfectly.
It threw a very weird error :
> nyc mocha --recursive --require ts-node/register "tests/**/*.test.ts"
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module 'C:\Users\Ubald\IdeaProjects\trivia\typescript\node'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
After almost loosing all my hair, I found the culprit. When running mocha directly with the following command :
> mocha --recursive --require ts-node/register "tests/**/*.test.ts"
Tests properly run. Adding nyc
, causes the issue. I'm not sure why for now and I would need to dig deeper into nyc
to understand the issue but it seems this particular version of nyc
has some trouble with windows paths.
So upgrading nyc
to the latest version fixed the issue in this particular case. It also don't seem to cause regressions on linux machines so I'll propose a pull request to update nyc
version to avoid people running in this kind of issues in the future.
It can be related to #58 : my first reaction was to try upgrading dependencies and typescript changed a lot in 3.x : in order to upgrade typescript version it needs to add some @type/[package]
dependencies in the project.
Anyway the issue do not come from Typescript in this particular case, so no need to change version for now (but an update may be nice?)
Lines 59 to 61 in f639bdb
In the javascript, typescript and node versions (possibly more) the one-off error on the player initial states are working as expected. This was an intentional bug
Actual
players.push(playerName);
places[this.howManyPlayers() - 1] = 0;
purses[this.howManyPlayers() - 1] = 0;
inPenaltyBox[this.howManyPlayers() - 1] = false;
Expected
players.push(playerName);
places[this.howManyPlayers()] = 0;
purses[this.howManyPlayers()] = 0;
inPenaltyBox[this.howManyPlayers()] = false;
Additional Notes
JS, unlike some of the original languages in this repo, like Java, have dynamic size arrays. Therefore the same error wont occur when the 6th player is added. Javascript will simply add it to the array. This should be taken into consideration if this ticket moves forward as the same bug may not be reproducible (at least easily) in the JS world.
Here is a way to have Javascript enforce the array size limits. Not sure if this fits well into the context of the repo
let a = new Array(15)
a.fill(undefined)
Object.seal(a)
a.push("Hello") //Errors because the object is sealed.
a[15] = "World" //Silently doesn't add to the array
We need a C++ version that works on a wider variety of systems, so it needs to use an older C++ standard. At a minimum, it should build with g++ 4.2.1, which jbrains has successfully installed on Lion.
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.