Yes I was surprised too! It runs smooth and physical condition is great. The battery is dead tho haha
And I think it doesn't have a parallel port unfortunately.
Yes I was surprised too! It runs smooth and physical condition is great. The battery is dead tho haha
And I think it doesn't have a parallel port unfortunately.
Ohh yeah I'm following the exact same video haha but didn't know about the game, looks really cool! Thanks for sharing
Not a technique per se but I'm trying to memorize the notes on the fretboard
Hmm yes maybe. I do remember a paywall bypass extension was removed from there because publishers were complaining to Vercel. Worst case scenario I guess your website gets taken down
You can create a simple static website and deploy it to Vercel for free. You can buy a domain name and attach it pretty easily, but it's not needed (by default website will have .vercel.app domain).
Thanks everyone!! This is more than I expected. Lots of promising stuff! I will look into each and every one of your suggestions.
(Since it's a bit silly to reply to every single comment the same thing, I'm just putting this one here)
I wouldn't say it's a bad thing. If it works for you, good. But if the book is in your native language, my advice would be read it in that language.
I tend to favor my native language for a few reasons though. I live in a foreign country so it helps me keep in touch with my language. Also if the book is old (like 100+ years) a translation in my language would make it easier to understand. Finally if it's an audiobook, I find it easier to follow without zoning out if it's in my language.
Avoided recursion by having an array of "pending paths". Whenever I hit a splitter, I follow one of the paths straight away, and push the starting point and direction of the other path to the array.
First time I ran it, hit an infinite loop. Handled it by skipping "|" and "-" if they have been visited already.
Part 2 is the same code as part 1 but I just check all the possible starting points.
Code
package main
import (
"bufio"
"fmt"
"os"
)
type Direction int
const (
UP Direction = 0
DOWN Direction = 1
LEFT Direction = 2
RIGHT Direction = 3
)
type LightPoint struct {
row int
col int
dir Direction
}
func solve(A [][]rune, start LightPoint) int {
m := len(A)
n := len(A[0])
visited := make([]bool, m*n)
points := []LightPoint{}
points = append(points, start)
for len(points) > 0 {
current := points[0]
points = points[1:]
i := current.row
j := current.col
dir := current.dir
for {
if i < 0 || i >= m || j < 0 || j >= n {
break
}
if visited[i*n+j] && (A[i][j] == '-' || A[i][j] == '|') {
break
}
visited[i*n+j] = true
if A[i][j] == '.' ||
(A[i][j] == '-' && (dir == LEFT || dir == RIGHT)) ||
(A[i][j] == '|' && (dir == UP || dir == DOWN)) {
switch dir {
case UP:
i--
case DOWN:
i++
case LEFT:
j--
case RIGHT:
j++
}
continue
}
if A[i][j] == '\\' {
switch dir {
case UP:
dir = LEFT
j--
case DOWN:
dir = RIGHT
j++
case LEFT:
dir = UP
i--
case RIGHT:
dir = DOWN
i++
}
continue
}
if A[i][j] == '/' {
switch dir {
case UP:
dir = RIGHT
j++
case DOWN:
dir = LEFT
j--
case LEFT:
dir = DOWN
i++
case RIGHT:
dir = UP
i--
}
continue
}
if A[i][j] == '-' && (dir == UP || dir == DOWN) {
points = append(points, LightPoint{row: i, col: j + 1, dir: RIGHT})
dir = LEFT
j--
continue
}
if A[i][j] == '|' && (dir == LEFT || dir == RIGHT) {
points = append(points, LightPoint{row: i + 1, col: j, dir: DOWN})
dir = UP
i--
}
}
}
energized := 0
for _, v := range visited {
if v {
energized++
}
}
return energized
}
func part1(A [][]rune) {
start := LightPoint{row: 0, col: 0, dir: RIGHT}
energized := solve(A, start)
fmt.Println(energized)
}
func part2(A [][]rune) {
m := len(A)
n := len(A[0])
max := -1
for i := 0; i < m; i++ {
start := LightPoint{row: i, col: 0, dir: RIGHT}
energized := solve(A, start)
if energized > max {
max = energized
}
start = LightPoint{row: 0, col: n - 1, dir: LEFT}
energized = solve(A, start)
if energized > max {
max = energized
}
}
for j := 0; j < n; j++ {
start := LightPoint{row: 0, col: j, dir: DOWN}
energized := solve(A, start)
if energized > max {
max = energized
}
start = LightPoint{row: m - 1, col: j, dir: UP}
energized = solve(A, start)
if energized > max {
max = energized
}
}
fmt.Println(max)
}
func main() {
// file, _ := os.Open("sample.txt")
file, _ := os.Open("input.txt")
defer file.Close()
scanner := bufio.NewScanner(file)
var lines []string
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
var A [][]rune
for _, line := range lines {
A = append(A, []rune(line))
}
// part1(A)
part2(A)
}
On Dream on (Aerosmith), I've always wondered if the couple "missing" notes from the arpeggio in 2:33 are intentional or a mistake.
I crafted a simple counter-example (single letters for brevity). The way the sequence goes totally depends on the instructions, and we don't have any guarantees on that. It could be anything. Of course, looking at the input data we could find what the instructions are, but the assumption doesn't hold in general.
A = (B, X)
B = (C, X)
C = (X, Z)
Z = (A, C)
X = (X, X)
L L R L L L R R R -> A B C Z A B C Z C Z
L L R R R L L L R -> A B C Z C Z A B C Z
Here the distance of Z cycling back into itself could be 2 or 4, depending on what the instruction string is doing.
Yeah I got annoyed too. Because this is not implied in the problem statement and it definitely doesn't hold up in general...
Sounds like JavaScript