Skip to content

Instantly share code, notes, and snippets.

View inspector-ambitious's full-sized avatar

inspector-ambitious

View GitHub Profile
// Step 1: Create a function that will return the number of words in a text
const countWords = (text) => {
}
console.log(countWords("")); // 0
console.log(countWords(" ")); // 0
console.log(countWords("JavaScript !!! ")); // 1
console.log(countWords(" JavaScript")); // 1
console.log(countWords(" JavaScript is cool ")); // 3
// Step 1: Create a function that will return the number of words in a text
const countWords = (text) => {
}
console.log(countWords(""));
console.log(countWords(" "));
console.log(countWords("JavaScript!!! "));
console.log(countWords(" JavaScript"));
console.log(countWords(" JavaScript is cool "));

Poker Hand Ranking

In this challenge, you have to establish which kind of Poker combination is present in a deck of five cards. Every card is a string containing the card value (with the upper-case initial for face-cards) and the lower-case initial for suits, as in the examples below:

  • "Ah" ➞ Ace of hearts
  • "Ks" ➞ King of spades
  • "3d" ➞ Three of diamonds
  • "Qc" ➞ Queen of clubs

Largest Island

An island is a region of contiguous ones. A contiguous one is a 1 that is touched by at least one other 1, either horizontally, vertically or diagonally. Given a piece of the map, represented by a 2-D array, create a function that returns the area of the largest island.

To illustrate, if we were given the following piece of the map, we should return 4.

[
  [0, 0, 0],
  [0, 1, 1],
  [0, 1, 1]
]

Minesweeper

Given a 2D array of mines, replace the question mark with the number of mines that immediately surround it. This includes the diagonals, meaning it is possible for it to be surrounded by 8 mines maximum.

The key is as follows:

  • An empty space: "-"
  • A mine: "#"
  • Number showing number of mines surrounding it: "?"
@inspector-ambitious
inspector-ambitious / Scene.js
Created December 17, 2016 03:18
Example of generated ouput
export default {
assets: [
'sprites/Level1_0.json',
'sprites/Level1_1.json'
],
name: 'Level1',
width: 3750,
height: 1024,
bounds: {
left: 32,