Skip to content

Instantly share code, notes, and snippets.

Ringotron5000 ringodin

View GitHub Profile
@ringodin
ringodin / turn bar and highlight win lines
Created May 19, 2020
this python code for connect 4 shows a turn bar for each player and highlights the winning 4 pieces.
View turn bar and highlight win lines
from pyglet import app
from pyglet import clock
from pyglet.window import Window
from pyglet.window import mouse
from pyglet.window import key
from pyglet import graphics
from pyglet import gl
from pyglet import text
from math import sin, cos, pi
@ringodin
ringodin / diagonal win lines
Created May 17, 2020
Now the python connect 4 code can determine if 4 in line (in any direction) has been achieved.
View diagonal win lines
from pyglet import app
from pyglet import clock
from pyglet.window import Window
from pyglet.window import mouse
from pyglet.window import key
from pyglet import graphics
from pyglet import gl
from pyglet import text
from math import sin, cos, pi
@ringodin
ringodin / horizontal and vertical win lines
Created May 12, 2020
connect 4 code detects horizontal and vertical win lines, but does not yet detect diagonal win lines.
View horizontal and vertical win lines
from pyglet import app
from pyglet import clock
from pyglet.window import Window
from pyglet.window import mouse
from pyglet.window import key
from pyglet import graphics
from pyglet import gl
from pyglet import text
from math import sin, cos, pi
@ringodin
ringodin / Draw all pieces connect 4
Created May 11, 2020
Draws all the pieces by red and blue player in connect 4, for python.
View Draw all pieces connect 4
from pyglet import app
from pyglet import clock
from pyglet.window import Window
from pyglet.window import mouse
from pyglet.window import key
from pyglet import graphics
from pyglet import gl
from pyglet import text
from math import sin, cos, pi
@ringodin
ringodin / Grid and lists added to Connect 4
Created May 6, 2020
This python code allows you to store info in a grid, or set of lists, about where each connect 4 game piece is placed.
View Grid and lists added to Connect 4
from pyglet import app
from pyglet import clock
from pyglet.window import Window
from pyglet.window import mouse
from pyglet.window import key
from pyglet import graphics
from pyglet import gl
from pyglet import text
from math import sin, cos, pi
@ringodin
ringodin / drawing a piece connect 4
Created May 5, 2020
this lets you draw one connect 4 piece.
View drawing a piece connect 4
from pyglet import app
from pyglet import clock
from pyglet.window import Window
from pyglet.window import mouse
from pyglet.window import key
from pyglet import graphics
from pyglet import gl
from pyglet import text
from math import sin, cos, pi
@ringodin
ringodin / Connect 4, Grid Shows Up
Created May 4, 2020
This python code makes a 7 x 6 grid show up for Connect 4.
View Connect 4, Grid Shows Up
from pyglet import app
from pyglet import clock
from pyglet.window import Window
from pyglet.window import mouse
from pyglet.window import key
from pyglet import graphics
from pyglet import gl
from pyglet import text
from math import sin, cos, pi
@ringodin
ringodin / connect 4 starter imports
Created Apr 28, 2020
For starting connect 4, here are the initial lines of code
View connect 4 starter imports
from pyglet import app
from pyglet import clock
from pyglet.window import Window
from pyglet.window import mouse
from pyglet.window import key
from pyglet import graphics
from pyglet import gl
from pyglet import text
from math import sin, cos, pi
@ringodin
ringodin / Snake, finished w no sounds yet
Created Apr 27, 2020
This snake game works fine, but doesn't have cool sounds yet.
View Snake, finished w no sounds yet
from pyglet import app
from pyglet import gl
from pyglet import clock
from pyglet.window import Window
from pyglet.window import key
from pyglet import graphics
from pyglet import image
from pyglet import text
from random import randint
import sys
@ringodin
ringodin / Snake with growing tail
Created Apr 24, 2020
This python code allows the snake to grow a tail segment each time it eats food.
View Snake with growing tail
from pyglet import app
from pyglet import gl
from pyglet import clock
from pyglet.window import Window
from pyglet.window import key
from pyglet import graphics
from pyglet import image
from pyglet import text
from random import randint
import sys
You can’t perform that action at this time.