Hopscotch Programming Puzzles


#83

Should this topics title be:

Hopscotch Programing Puzzles & Recreational Mathematics

That might be good, so it covers programming and maths

BAS: still reading it! It’s super fascinating


#84

So math in Hopscotch as well then?


#85

Yeah, I guess. It’d make sense since programming basically is math. But with computers. Idk, only if we want to have both things in one topic. We could make recreational math a topic for itself. But rec math is like math puzzles and such, so sort of similar


#86

How far do Hopscotchs computers go before they just say inf?

If anybody can figure out a way to find out that would be great! Thank you!


#87

Inf?


#88

Short for infinite.


#89

Ah, ok

Let me check..

I believe it’s when it prints _ * Ex
And Ex means (_)^x

And I believe it becomes infinity at 100. But I’m probably wrong


#90

im bored so here’s the fibonacci thing in 24 lines of code with comments and prompt: https://repl.it/Ke2N/9
and here’s it sorta minified and stuff w no prompt: https://repl.it/Ke2a/0

How it works:
So it takes the input, and does a while loop for when the input is more than or equal to 0, it then make the temporary value as a, which is the number before before. Then it adds a to b, makes b the temp and that’s the output. Then it adds the output to the string and subtracts the num by 1
then it repeats

:D


#91

Not sure if people look at this anymore, but try to make some kind of connect four game with the ability to:

  • Render the board
  • Check for winning player
  • And place the things on a numbered column.

You should have a array with the data in it, and a few functions that are: displayBoard(board), checkWinner(board) and place(board, col, player).

Oh yeah, don’t do this in hopscotch. I mean you can, but doing it in other programming languages would be easier :p

Here’s my solution: https://repl.it/LM73/1

Have fun Hoscotching! (or not :p)

USE THIS DATA:

const board = [
    [`0`, `0`, `0`, `0`, `0`, `0`, `0`],
    [`0`, `0`, `0`, `0`, `0`, `0`, `0`],
    [`2`, `0`, `1`, `0`, `2`, `1`, `0`],
    [`1`, `0`, `2`, `2`, `1`, `2`, `1`],
    [`1`, `1`, `2`, `1`, `2`, `2`, `1`],
    [`1`, `1`, `2`, `2`, `2`, `2`, `1`]
]

(yeah gl with making this in hs)