我創建國際象棋的方式比賽,但不知道如何保存和載入遊戲狀態是我有這樣的代碼的一部分如何在遊戲中保存/加載遊戲的狀態?
(define-struct piece(color nove? type))
;;tablero lista de listas de fichas
(define-struct estado (board turn fichaSel))
(define bpawn (bitmap "b-peon.png"))
(define brook (bitmap "b-torre.png"))
(define bcaballo (bitmap "b-caballo.png"))
(define bbish (bitmap "b-arfil.png"))
(define bquee (bitmap "b-reina.png"))
(define bking (bitmap "b-rey.png"))
(define wpawn (bitmap "w-peon.png"))
(define wrook (bitmap "w-torre.png"))
(define wcaballo (bitmap "w-caballo.png"))
(define wbish (bitmap "w-arfil.png"))
(define wquee (bitmap "w-reina.png"))
(define wking (bitmap "w-rey.png"))
(define board (bitmap "board.jpg"))
這是董事會是名單
列表(define board1 (list (list torreb caballob arfilb reinab reyb arfilb caballob torreb)
(list peonb peonb peonb peonb peonb peonb peonb peonb)
(list empty empty empty empty empty empty empty empty)
(list empty empty empty empty empty empty empty empty)
(list empty empty empty empty empty empty empty empty)
(list empty empty empty empty empty empty empty empty)
(list pawnw pawnw pawnw pawnw pawnw pawnw pawnw pawnw)
(list rookw knightw bishopw queenw kingw bishopw knightw rookw)))
我這樣做是爲了保存遊戲的狀態:
(define (save file)
(write-file (string-append Subcarpeta archivo ".txt")
"game state" ))
但並不像你插入遊戲狀態的「遊戲狀態」對我來說,保存遊戲
我該怎麼做?
這是球拍?我會假設你可以使用一些序列化過程。 – leppie
是的,是球拍。我可以使用什麼流程? – user3672728