Cleaning up comments
This commit is contained in:
parent
aea82ab765
commit
b1cbe95485
10
apple.go
10
apple.go
@ -6,16 +6,6 @@ import (
|
|||||||
"github.com/gdamore/tcell/v2"
|
"github.com/gdamore/tcell/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// getFoodItem returns an emoji from a string used to represent food
|
|
||||||
// Takes no arguments, but returns an emoji/rune from a predefined string
|
|
||||||
// func getFoodItem() rune {
|
|
||||||
// var foods string = "🐵🐱🐷🐁🐇🐿🦇🐓🐣🐸🦎🍎🍏"
|
|
||||||
// foodsRune := []rune(foods)
|
|
||||||
// randomIndex := rand.Intn(len(foodsRune))
|
|
||||||
// return foodsRune[randomIndex]
|
|
||||||
// }
|
|
||||||
|
|
||||||
// func placeApple(snakex int, snakey int) Apple {
|
|
||||||
func placeApple(snake *Snake) Apple {
|
func placeApple(snake *Snake) Apple {
|
||||||
var x, y int
|
var x, y int
|
||||||
var found bool
|
var found bool
|
||||||
|
45
design.md
45
design.md
@ -1,45 +0,0 @@
|
|||||||
# Snake
|
|
||||||
( Doing it my way. )
|
|
||||||
|
|
||||||
# The game
|
|
||||||
This follows the usual setting:
|
|
||||||
* Field
|
|
||||||
* Snake that cannot hurt itself
|
|
||||||
* Snake that gets wounded by the edges
|
|
||||||
* Score
|
|
||||||
|
|
||||||
The game should look something like this:
|
|
||||||
```
|
|
||||||
╔══════════════════════════════════════════════════════════════════════════════╗
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ │ ║
|
|
||||||
║ │ ║
|
|
||||||
║ └───────o ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ 🍏 ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
║ ║
|
|
||||||
╚════[ Score: 12309 ]══════════════════════════════════════════════════════════╝
|
|
||||||
```
|
|
||||||
|
|
||||||
The minimum and maximum resolution of this game is `80` columes and `24` rows, Anything console larger will have no issues with this setup, anything smaller should pause the game with a message to resize.
|
|
||||||
|
|
||||||
Scoring is done by having a counter _n_, every time an object is eaten, this counter is added to the score and raised by one. So after four apples the score would be (1+2+3+4) 10.
|
|
||||||
|
|
||||||
The objects to eat are a series of emojis Snakes would eat IRL in nature. This is anything from fruits, nuts, frogs, etc.
|
|
||||||
|
|
||||||
Snake cannot eat itself, nor eat the border.
|
|
5
game.go
5
game.go
@ -120,11 +120,6 @@ func keyboardProcessor(screen tcell.Screen, keypresses chan int, gamestate chan
|
|||||||
|
|
||||||
// Fetch the type, and check if any other actions are required.
|
// Fetch the type, and check if any other actions are required.
|
||||||
switch ev := ev.(type) {
|
switch ev := ev.(type) {
|
||||||
//case *tcell.EventResize:
|
|
||||||
// x, y := screen.Size()
|
|
||||||
// drawBox(screen, 0, 0, x-1, y-1, style)
|
|
||||||
// updateScore(screen, style, snakex)
|
|
||||||
// screen.Sync()
|
|
||||||
case *tcell.EventKey:
|
case *tcell.EventKey:
|
||||||
if ev.Key() == tcell.KeyEscape || ev.Key() == tcell.KeyCtrlC {
|
if ev.Key() == tcell.KeyEscape || ev.Key() == tcell.KeyCtrlC {
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user