This is a SCRIPT-8 cassette.
Created
June 23, 2019 04:35
-
-
Save MarkGamed7794/e399cbed9bd328b0161ddf3126b78c57 to your computer and use it in GitHub Desktop.
SCRIPT-8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lower = 0; | |
var upper = 0; | |
var dice = [1,2,3,4,5]; | |
var held = [false,false,false,false,false]; | |
var combos = ["Ones","Twos","Threes","Fours","Fives","Sixes","3 of a Kind","4 of a Kind","Full House","Small Straight","Large Straight","Yahtzee","Chance"]; | |
var descriptions = [ | |
["Sum of all","ones"], | |
["Sum of all","twos"], | |
["Sum of all","threes"], | |
["Sum of all","fours"], | |
["Sum of all","fives"], | |
["Sum of all","sixes"], | |
["Three of the","same, worth","the sum of","all dice"], | |
["Four of the","same, worth","the sum of","all dice"], | |
["A pair and 3","of a kind,","worth 25"], | |
["4 ascending","dice, worth","30"], | |
["5 ascending","dice, worth","30"], | |
["Five of the","same, worth","50"], | |
["No pattern,","worth the","sum of all","dice"] | |
] | |
var rollingTimer = 0; | |
var mouseX = 0; | |
var mouseY = 0; | |
var scores = { | |
"Ones":0, | |
"Twos":0, | |
"Threes":0, | |
"Fours":0, | |
"Fives":0, | |
"Sixes":0, | |
"3 of a Kind":0, | |
"4 of a Kind":0, | |
"Full House":0, | |
"Small Straight":0, | |
"Large Straight":0, | |
"Yahtzee":0, | |
"Chance":0, | |
} | |
function count(a,b){ | |
var c = 0; | |
for(var i = 0; i < a.length; ++i){ | |
if(a[i] == b) | |
c++; | |
} | |
return c; | |
} | |
function checkCombos(b){ | |
var possibleCombos = []; | |
var a = b.sort(); | |
if(a[0] == a[1] && a[1] == a[2] && a[2] == a[3] && a[3] == a[4]){possibleCombos.push("Yahtzee");} | |
if(a[0] == a[1]-1 && a[1] == a[2]-1 && a[2] == a[3]-1 && a[3] == a[4]-1){possibleCombos.push("Large Straight");} | |
if((a[0] == a[1]-1 && a[1] == a[2]-1 && a[2] == a[3]-1 && a[3]) || (a[3] == a[4]-1 && a[1] == a[2]-1 && a[2] == a[3]-1 && a[3])){possibleCombos.push("Small Straight");} | |
if((a[0] == a[1] && a[1] == a[2] && a[2] == a[3]) || (a[3] == a[4] && a[1] == a[2] && a[2] == a[3])){possibleCombos.push("4 of a Kind");} | |
if((a[0] == a[1] && a[1] == a[2]) || (a[1] == a[2] && a[2] == a[3]) || (a[2] == a[3] && a[3] == a[4])){possibleCombos.push("3 of a Kind");} | |
if(a[0] == a[1] && a[1] == a[2] && a[2] != a[3] && a[3] == a[4]){possibleCombos.push("Full House");} | |
if(a[0] == a[1] && a[1] != a[2] && a[2] == a[3] && a[3] == a[4]){possibleCombos.push("Full House");} | |
return possibleCombos; | |
} | |
update = (dummy,input) => { | |
if(input.left){mouseX = clamp(mouseX-1,0,127);} | |
if(input.right){mouseX = clamp(mouseX+1,0,127);} | |
if(input.up){mouseY = clamp(mouseY-1,0,127);} | |
if(input.down){mouseY = clamp(mouseY+1,0,127);} | |
if(input.aPressed){ | |
for(var i = 0;i < 5;i++){ | |
if(mouseX >= 20+i*20 && mouseX <= 28+i*20 && mouseY >= 27 && mouseY <= 35){held[i] = !held[i];} | |
} | |
} | |
} | |
draw = () => { | |
upper++; | |
clear(6) | |
for(var i = 0;i < 10;i++){ | |
sprite(20+i*20,27,dice[i]-1,held[i]*-2); | |
} | |
rectFill(0,41,128,87,5); | |
line(0,40,128,40); | |
line(75,40,75,128); | |
var hoveringOver = -1; | |
for(var i = 0;i < 12;i++){ | |
sprite(10+(32*(Math.floor(i/6))),46+(i%6)*12,16+i); | |
print(19+(32*(Math.floor(i/6))),48+(i%6)*12,scores[combos[i]]) | |
if(mouseX >= 10+(32*(Math.floor(i/6))) && mouseX <= 18+(32*(Math.floor(i/6)) && mouseY >= 46+(i%6)*12,16+i && mouseY <= 54+(i%6)*12,16+i){ | |
hoveringOver = i; | |
} | |
} | |
if(hoveringOver >= 999){ | |
for(var i = 0;i < descriptions[hoveringOver].length;i++){ | |
print(80,48+7*i,descriptions[hoveringOver][i]); | |
} | |
} | |
if(rollingTimer > 0){ | |
for(var i = 0;i < 5;i++){ | |
if(!held[i]){ | |
dice[i] = random(1,6); | |
} | |
} | |
rollingTimer--; | |
} | |
sprite(mouseX,mouseY,30); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"iframeVersion": "0.1.255", | |
"lines": [ | |
111, | |
0, | |
0, | |
0, | |
0, | |
0, | |
0, | |
0 | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"0": [ | |
" ", | |
"1111111 ", | |
"1000001 ", | |
"1000001 ", | |
"1007001 ", | |
"1000001 ", | |
"1000001 ", | |
"1111111 " | |
], | |
"1": [ | |
" ", | |
"1111111 ", | |
"1000071 ", | |
"1000001 ", | |
"1000001 ", | |
"1000001 ", | |
"1700001 ", | |
"1111111 " | |
], | |
"2": [ | |
" ", | |
"1111111 ", | |
"1000071 ", | |
"1000001 ", | |
"1007001 ", | |
"1000001 ", | |
"1700001 ", | |
"1111111 " | |
], | |
"3": [ | |
" ", | |
"1111111 ", | |
"1700071 ", | |
"1000001 ", | |
"1000001 ", | |
"1000001 ", | |
"1700071 ", | |
"1111111 " | |
], | |
"4": [ | |
" ", | |
"1111111 ", | |
"1700071 ", | |
"1000001 ", | |
"1007001 ", | |
"1000001 ", | |
"1700071 ", | |
"1111111 " | |
], | |
"5": [ | |
" ", | |
"1111111 ", | |
"1700071 ", | |
"1000001 ", | |
"1700071 ", | |
"1000001 ", | |
"1700071 ", | |
"1111111 " | |
], | |
"6": [ | |
" ", | |
"1111111 ", | |
"1700071 ", | |
"1000001 ", | |
"1707071 ", | |
"1000001 ", | |
"1700071 ", | |
"1111111 " | |
], | |
"7": [ | |
" ", | |
"1111111 ", | |
"1707071 ", | |
"1000001 ", | |
"1700071 ", | |
"1000001 ", | |
"1707071 ", | |
"1111111 " | |
], | |
"8": [ | |
" ", | |
"1111111 ", | |
"1707071 ", | |
"1000001 ", | |
"1707071 ", | |
"1000001 ", | |
"1707071 ", | |
"1111111 " | |
], | |
"9": [ | |
" ", | |
"1111111 ", | |
"1707071 ", | |
"1070701 ", | |
"1000001 ", | |
"1070701 ", | |
"1707071 ", | |
"1111111 " | |
], | |
"10": [ | |
" ", | |
"1111111 ", | |
"1700071 ", | |
"1070701 ", | |
"1707071 ", | |
"1070701 ", | |
"1700071 ", | |
"1111111 " | |
], | |
"11": [ | |
" ", | |
"1111111 ", | |
"1707071 ", | |
"1070701 ", | |
"1700071 ", | |
"1070701 ", | |
"1707071 ", | |
"1111111 " | |
], | |
"12": [ | |
" ", | |
"1111111 ", | |
"1707071 ", | |
"1070701 ", | |
"1707071 ", | |
"1070701 ", | |
"1707071 ", | |
"1111111 " | |
], | |
"13": [ | |
" ", | |
"1111111 ", | |
"1070771 ", | |
"1707071 ", | |
"1070701 ", | |
"1707071 ", | |
"1770701 ", | |
"1111111 " | |
], | |
"14": [ | |
" ", | |
"1111111 ", | |
"1707071 ", | |
"1770771 ", | |
"1007001 ", | |
"1770771 ", | |
"1707071 ", | |
"1111111 " | |
], | |
"15": [ | |
" ", | |
"1111111 ", | |
"1707071 ", | |
"1077701 ", | |
"1770771 ", | |
"1077701 ", | |
"1707071 ", | |
"1111111 " | |
], | |
"16": [ | |
" ", | |
"3333333 ", | |
"3222223 ", | |
"3222223 ", | |
"3220223 ", | |
"3222223 ", | |
"3222223 ", | |
"3333333 " | |
], | |
"17": [ | |
" ", | |
"3333333 ", | |
"3222203 ", | |
"3222223 ", | |
"3222223 ", | |
"3222223 ", | |
"3022223 ", | |
"3333333 " | |
], | |
"18": [ | |
" ", | |
"3333333 ", | |
"3222203 ", | |
"3222223 ", | |
"3220223 ", | |
"3222223 ", | |
"3022223 ", | |
"3333333 " | |
], | |
"19": [ | |
" ", | |
"3333333 ", | |
"3022203 ", | |
"3222223 ", | |
"3222223 ", | |
"3222223 ", | |
"3022203 ", | |
"3333333 " | |
], | |
"20": [ | |
" ", | |
"3333333 ", | |
"3022203 ", | |
"3222223 ", | |
"3220223 ", | |
"3222223 ", | |
"3022203 ", | |
"3333333 " | |
], | |
"21": [ | |
" ", | |
"3333333 ", | |
"3022203 ", | |
"3222223 ", | |
"3022203 ", | |
"3222223 ", | |
"3022203 ", | |
"3333333 " | |
], | |
"22": [ | |
" ", | |
"3333333 ", | |
"3000003 ", | |
"3222203 ", | |
"3200003 ", | |
"3222203 ", | |
"3000003 ", | |
"3333333 " | |
], | |
"23": [ | |
" ", | |
"3333333 ", | |
"3022023 ", | |
"3022023 ", | |
"3022023 ", | |
"3000003 ", | |
"3222023 ", | |
"3333333 " | |
], | |
"24": [ | |
" ", | |
"3333333 ", | |
"3220223 ", | |
"3200023 ", | |
"3000003 ", | |
"3202023 ", | |
"3200023 ", | |
"3333333 " | |
], | |
"25": [ | |
" ", | |
"3333333 ", | |
"3222223 ", | |
"3222023 ", | |
"3000003 ", | |
"3222023 ", | |
"3222223 ", | |
"3333333 " | |
], | |
"26": [ | |
" ", | |
"3333333 ", | |
"3220223 ", | |
"3222023 ", | |
"3000003 ", | |
"3222023 ", | |
"3220223 ", | |
"3333333 " | |
], | |
"27": [ | |
" ", | |
"3333333 ", | |
"3022203 ", | |
"3022203 ", | |
"3000003 ", | |
"3220223 ", | |
"3220223 ", | |
"3333333 " | |
], | |
"28": [ | |
" ", | |
"3333333 ", | |
"3000003 ", | |
"3222203 ", | |
"3220003 ", | |
"3222223 ", | |
"3202223 ", | |
"3333333 " | |
], | |
"29": [ | |
" ", | |
"3333333 ", | |
"3002003 ", | |
"3022203 ", | |
"3002003 ", | |
"3002203 ", | |
"3002003 ", | |
"3333333 " | |
], | |
"30": [ | |
"2222 ", | |
"20022 ", | |
"200022 ", | |
"2000022 ", | |
"2000002 ", | |
"2020022 ", | |
"2222002 ", | |
" 2222 " | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment