Skip to content

Commit 2273b42

Browse files
add buttons for scrambling and solving
1 parent d258521 commit 2273b42

File tree

12 files changed

+5725
-7
lines changed

12 files changed

+5725
-7
lines changed

.DS_Store

6 KB
Binary file not shown.

floppysolver

84.6 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd> <plist version=1.0> <dict> <key>CFBundleExecutable</key> <string>my_app</string> </dict> </plist>
1.1 MB
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleIdentifier</key>
8+
<string>com.apple.xcode.dsym.floppysolver</string>
9+
<key>CFBundleInfoDictionaryVersion</key>
10+
<string>6.0</string>
11+
<key>CFBundlePackageType</key>
12+
<string>dSYM</string>
13+
<key>CFBundleSignature</key>
14+
<string>????</string>
15+
<key>CFBundleShortVersionString</key>
16+
<string>1.0</string>
17+
<key>CFBundleVersion</key>
18+
<string>1</string>
19+
</dict>
20+
</plist>
341 KB
Binary file not shown.

floppysolver.dSYM/Contents/Resources/Relocations/aarch64/floppysolver.yml

Lines changed: 155 additions & 0 deletions
Large diffs are not rendered by default.

makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,18 @@ time:
2424
make compile
2525
time ./floppysolver
2626

27+
macBuild:
28+
make compile
29+
rm -rf floppysolver.app
30+
31+
mkdir floppysolver.app
32+
mkdir floppysolver.app/Contents
33+
mkdir floppysolver.app/Contents/MacOS
34+
mkdir floppysolver.app/Contents/Resources
35+
touch floppysolver.app/Contents/Info.plist
36+
37+
mv floppysolver floppysolver.app/Contents/MacOS
38+
39+
echo "<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleExecutable</key> <string>my_app</string> </dict> </plist>" >> floppysolver.app/Contents/Info.plist
40+
41+

src/floppy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ void DoTurn(FloppyCube cube, int turn){
317317
FloppyCube RandomScramble(FloppyCube cube){
318318
int previous;
319319

320-
for(int i = 0; i < 7; i++){
320+
for(int i = 0; i < 9; i++){
321321
int num = RandomRange(3);
322322

323323
while(previous == num){

src/main.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include <time.h>
33

44
#include "raylib.h"
5+
#define RAYGUI_IMPLEMENTATION
6+
#include "raygui.h"
57
#include "floppy.h"
68
#include "moves.h"
79

@@ -87,13 +89,17 @@ int main(){
8789
/*floppy = */DoTurn(floppy, L);
8890
}
8991
if(IsKeyReleased(KEY_B)){
90-
/*floppy =*/ DoTurn(floppy, B);
91-
}
92-
if(IsKeyReleased(KEY_S)){
93-
floppy = RandomScramble(floppy);
92+
// /*floppy =*/ DoTurn(floppy, B);
93+
94+
floppy = SolveCube(floppy);
9495
}
95-
if(IsKeyReleased(KEY_A)){
96+
97+
if(GuiButton((Rectangle){ 155, 375, 150, 75 }, "Solve")){
9698
floppy = SolveCube(floppy);
99+
// printf("hello world");
100+
}
101+
if(GuiButton((Rectangle){ 0, 375, 150, 75 }, "Scramble")){
102+
floppy = RandomScramble(floppy);
97103
}
98104
}
99105

0 commit comments

Comments
 (0)