Add harmony to projects
This commit is contained in:
parent
09b22d132e
commit
ee026bcbaa
|
@ -1,8 +1,10 @@
|
|||
---
|
||||
title: "Textris - Part 1: Pieces and playfield - Creating a terminal-based Tetris clone"
|
||||
title: "Textris - Creating a terminal-based Tetris clone - Part 1: Pieces and playfield"
|
||||
#date: 2019-11-26T01:42:18-07:00
|
||||
categories: [tutorial]
|
||||
draft: true
|
||||
aliases:
|
||||
- /post/textris-1/
|
||||
---
|
||||
|
||||
This is the first in a series of tutorials on creating a [terminal-based](https://en.wikipedia.org/wiki/Text-based_user_interface) [Tetris](https://en.wikipedia.org/wiki/Tetris) clone with [Go](https://golang.org).
|
||||
|
@ -245,7 +247,7 @@ func (p Point) Neighborhood() []Point {
|
|||
}
|
||||
```
|
||||
|
||||
NewPoints calculates the neighborhood of each point of a mino and returns only new points.
|
||||
NewPoints calculates the neighborhood of each point of a mino and returns only the new points.
|
||||
|
||||
```go
|
||||
func (m Mino) HasPoint(p Point) bool {
|
||||
|
@ -263,9 +265,11 @@ func (m Mino) NewPoints() []Point {
|
|||
|
||||
for _, p := range m {
|
||||
for _, np := range p.Neighborhood() {
|
||||
if !m.HasPoint(np) {
|
||||
newPoints = append(newPoints, np)
|
||||
if m.HasPoint(np) {
|
||||
continue
|
||||
}
|
||||
|
||||
newPoints = append(newPoints, np)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
title: harmony
|
||||
summary: Voice and text communications platform
|
||||
tags:
|
||||
- Go
|
||||
|
||||
external_link: "https://git.sr.ht/~tslocum/harmony"
|
||||
---
|
Loading…
Reference in New Issue