Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Harsányi alex-hhh

View GitHub Profile
View format-selection.rkt
#lang racket/base
(require quickscript racket/string)
(define prefix-rx #px"^\\s*;+\\s*")
(define fill-column 78)
(define (determine-prefix line)
(define m (regexp-match prefix-rx line))
(if m (car m) ""))
@alex-hhh
alex-hhh / ishido.rkt
Created Jul 2, 2020
Ishido Game Impementation
View ishido.rkt
#lang racket
;; Ishido Game Implementation
;; Copyright (c) 2020 Alex Harsányi (AlexHarsanyi@gmail.com)
;; Permission is hereby granted, free of charge, to any person obtaining a
;; copy of this software and associated documentation files (the "Software"),
;; to deal in the Software without restriction, including without limitation
;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
;; and/or sell copies of the Software, and to permit persons to whom the
@alex-hhh
alex-hhh / md-view.rkt
Last active Jul 4, 2020
markdown view demo
View md-view.rkt
#lang racket
;; Markdown Viewer
;; Copyright (c) 2020 Alex Harsányi (AlexHarsanyi@gmail.com)
;; Permission is hereby granted, free of charge, to any person obtaining a
;; copy of this software and associated documentation files (the "Software"),
;; to deal in the Software without restriction, including without limitation
;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
;; and/or sell copies of the Software, and to permit persons to whom the
View numbers.rkt
#lang racket
(define width 6)
(define height 6)
(define field (make-vector (* width height) 0))
(define (field-ref field x y)
(vector-ref field (+ (* width y) x)))
(define (field-set! field x y val)
@alex-hhh
alex-hhh / tetris-5.rkt
Created Mar 28, 2020
Full program for the "A Game of Tetris" blog posts.
View tetris-5.rkt
;; A tetris game -- partial implementation, part 5
;; Copyright (c) 2020 Alex Harsányi (AlexHarsanyi@gmail.com)
;; Permission is hereby granted, free of charge, to any person obtaining a
;; copy of this software and associated documentation files (the "Software"),
;; to deal in the Software without restriction, including without limitation
;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
;; and/or sell copies of the Software, and to permit persons to whom the
;; Software is furnished to do so, subject to the following conditions:
@alex-hhh
alex-hhh / tetris-4.rkt
Last active Mar 11, 2020
Tetris Game, Final Version
View tetris-4.rkt
;; A tetris game -- partial implementation, part 4
;; Copyright (c) 2020 Alex Harsányi (AlexHarsanyi@gmail.com)
;; Permission is hereby granted, free of charge, to any person obtaining a
;; copy of this software and associated documentation files (the "Software"),
;; to deal in the Software without restriction, including without limitation
;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
;; and/or sell copies of the Software, and to permit persons to whom the
;; Software is furnished to do so, subject to the following conditions:
@alex-hhh
alex-hhh / tetris-3.rkt
Last active Apr 3, 2020
Tetris Game -- Third Version
View tetris-3.rkt
;; A tetris game -- partial implementation, part 3
;; Copyright (c) 2020 Alex Harsányi (AlexHarsanyi@gmail.com)
;; Permission is hereby granted, free of charge, to any person obtaining a
;; copy of this software and associated documentation files (the "Software"),
;; to deal in the Software without restriction, including without limitation
;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
;; and/or sell copies of the Software, and to permit persons to whom the
;; Software is furnished to do so, subject to the following conditions:
@alex-hhh
alex-hhh / tetris-2.rkt
Last active Mar 7, 2020
Tetris Game -- Second Implementation
View tetris-2.rkt
;; A tetris game -- partial implementation, part 2
;; Copyright (c) 2020 Alex Harsányi (AlexHarsanyi@gmail.com)
;; Permission is hereby granted, free of charge, to any person obtaining a
;; copy of this software and associated documentation files (the "Software"),
;; to deal in the Software without restriction, including without limitation
;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
;; and/or sell copies of the Software, and to permit persons to whom the
;; Software is furnished to do so, subject to the following conditions:
@alex-hhh
alex-hhh / tetris-1.rkt
Created Mar 7, 2020
Tetris Game -- First Interactive Application
View tetris-1.rkt
;; A tetris game -- partial implementation, part 1
;; Copyright (c) 2020 Alex Harsányi (AlexHarsanyi@gmail.com)
;; Permission is hereby granted, free of charge, to any person obtaining a
;; copy of this software and associated documentation files (the "Software"),
;; to deal in the Software without restriction, including without limitation
;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
;; and/or sell copies of the Software, and to permit persons to whom the
;; Software is furnished to do so, subject to the following conditions:
@alex-hhh
alex-hhh / racket-gui-157-demo.rkt
Created Jan 22, 2020
Snip instances with copy - paste functionality -- note that snips are pasted on top of each other, so you need to drag them around with the mouse to see that they were copied
View racket-gui-157-demo.rkt
#lang racket/gui
(define chess-piece-snip-class
(make-object
(class snip-class%
(super-new)
(send this set-classname "chess-piece-snip"))))
(send (get-the-snip-class-list) add chess-piece-snip-class)
You can’t perform that action at this time.