Giter VIP home page Giter VIP logo

jbrains / trivia Goto Github PK

View Code? Open in Web Editor NEW

This project forked from caradojo/trivia

503.0 503.0 690.0 1.34 MB

Legacy Code Retreat - Trivia Game codebase

Home Page: https://www.jbrains.ca/legacy-code-retreat/

License: GNU General Public License v3.0

C# 5.35% C++ 3.88% C 9.36% COBOL 7.06% PowerShell 3.60% CoffeeScript 3.17% D 3.60% F# 4.88% Go 3.90% Groovy 3.65% Java 4.10% JavaScript 7.52% Lua 4.08% Objective-C 4.72% Perl 5.14% PHP 4.15% Python 8.57% Shell 5.16% Ruby 4.39% Scala 3.73%

trivia's People

Contributors

alexboly avatar bastiankoetsier avatar carols10cents avatar cedricrup avatar cngzhnp avatar danprager avatar divinedominion avatar esandre avatar felixble avatar gaspardpo avatar ggalmazor avatar guidodechamps avatar jbrains avatar johnnonolan avatar jrglee avatar jthurne avatar kevinloken avatar kirschstein avatar kjetiljd avatar marckk avatar marcpmichel avatar meatballhat avatar mlainez avatar paulroho avatar paytonrules avatar rarous avatar roamingthings avatar schmonz avatar slfitch avatar stej 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

trivia's Issues

(Javascript) Correct is spelled correctly

Javascript versions (including Js, node and typescript) have the word "correct" spelled correctly. this console log should have it spelled "corrent"

trivia/javascript/game.js

Lines 143 to 148 in f639bdb

}else{
console.log("Answer was correct!!!!");
purses[currentPlayer] += 1;
console.log(players[currentPlayer] + " now has " +

They should match the Java version.

} else {
System.out.println("Answer was corrent!!!!");
purses[currentPlayer]++;
System.out.println(players.get(currentPlayer)

Typescript code did not contain dependencies for file system and editing...

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.

Cannot run tests with typescript version

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?)

(Javascript) Off By one Error not off by one

places[this.howManyPlayers() - 1] = 0;
purses[this.howManyPlayers() - 1] = 0;
inPenaltyBox[this.howManyPlayers() - 1] = false;

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

C++ version uses C++11 feature

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.

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.