post your mesecons builds (screenshots)
- thomasthespacefox
- Member
- Posts: 100
- Joined: Sun Aug 02, 2015 15:00
- GitHub: ThomasTheSpaceFox
- IRC: ThomasJaguar1212
- In-game: thomasthespacefox
- Contact:
post your mesecons builds (screenshots)
I'm curious what other people have been making with mesecons.
(underside of my 4x5 disco floor)
(4x4x3 3D printer)
(underside of my 4x5 disco floor)
(4x4x3 3D printer)
- Attachments
-
- screenshot_34516207.jpg (59.45 KiB) Viewed 1702 times
-
- screenshot_20151001_205043.png (179.68 KiB) Viewed 1702 times
- Tmanyo
- Member
- Posts: 196
- Joined: Mon Sep 29, 2014 01:20
- GitHub: Tmanyo
- IRC: Tmanyo
- In-game: tmanyo
- Location: United States
- Contact:
Re: post your mesecons builds (screenshots)
I tried making an elevator normal and one of those people use to load straw or hay into a barn. Neither worked though sadly.... My favorite thing I made was using command blocks to make a question maze, where you travel through answering questions from a choice of 3 buttons. But I have made a lot with Mesecon...
Tmanyo
http://www.rrhmsservers.ml
Servers I Host:
Tmanyo-Realism
Mods of mine that I don't totally hate:
Bank Accounts
T-Rating
Tmusic Player
http://www.rrhmsservers.ml
Servers I Host:
Tmanyo-Realism
Mods of mine that I don't totally hate:
Bank Accounts
T-Rating
Tmusic Player
Re: post your mesecons builds (screenshots)
I build a 2x2, 3x3 and 4x4 piston doors and this is my triple piston extender.
- Attachments
-
- triple_piston.we
- (56.22 KiB) Downloaded 352 times
Sorry if my english isn't good.
I love making mesecon mechanisms. If you want a system, just tell it to me and I will try to make it.
I love making mesecon mechanisms. If you want a system, just tell it to me and I will try to make it.
Re: post your mesecons builds (screenshots)
T Flip-Flop:
I am okay with using the screenshots in all my posts for the website of Minetest (http://minetest.net).
Re: post your mesecons builds (screenshots)
An other type of flip flop:
flip
flop
PS:sorry for the uggly background
flip
flop
PS:sorry for the uggly background
- Attachments
-
- flip_flop_2.png (941.11 KiB) Viewed 1702 times
Sorry if my english isn't good.
I love making mesecon mechanisms. If you want a system, just tell it to me and I will try to make it.
I love making mesecon mechanisms. If you want a system, just tell it to me and I will try to make it.
- cheapie
- Member
- Posts: 316
- Joined: Mon May 14, 2012 00:59
- GitHub: cheapie
- IRC: cheapie
- In-game: cheapie
Re: post your mesecons builds (screenshots)
Do digilines and other mesecons/digilines-related mods count? I suppose the Luacontroller is from mesecons...
"Minetest", a clock, and Tic-Tac-Toe, one LuaC, lots of rgblightstone and buttons from digistuff
The monitoring screen of my LTC-4000 traffic light controller, showing off some of the capabilities of the touchscreen from digistuff
"Gas Pump", supports up to 8 pumps, settable price, prepay or pay-at-the-pump, etc.
"Minetest", a clock, and Tic-Tac-Toe, one LuaC, lots of rgblightstone and buttons from digistuff
The monitoring screen of my LTC-4000 traffic light controller, showing off some of the capabilities of the touchscreen from digistuff
"Gas Pump", supports up to 8 pumps, settable price, prepay or pay-at-the-pump, etc.
- thomasthespacefox
- Member
- Posts: 100
- Joined: Sun Aug 02, 2015 15:00
- GitHub: ThomasTheSpaceFox
- IRC: ThomasJaguar1212
- In-game: thomasthespacefox
- Contact:
Re: post your mesecons builds (screenshots)
This nifty contraption is a 3-tier, dual sided, piston gate, that is powered by a single switch.
here is a basic version of the mechanism:
The idea is, the inner tier rails are powered first, and then through a delayer, the inner tier powers the middle tier, then, the same for the outer tier, and through another repeater, the outer tier, powers the middle tier when it retracts, that way, the inner tier is retracted to its open position.
- thomasthespacefox
- Member
- Posts: 100
- Joined: Sun Aug 02, 2015 15:00
- GitHub: ThomasTheSpaceFox
- IRC: ThomasJaguar1212
- In-game: thomasthespacefox
- Contact:
Re: post your mesecons builds (screenshots)
figured id share this little tip someplace:
(note the button going into the side, and the switches that don't match the output lights)
using the normal microcontroller, (not the luacontroller or fpga) and punching in this line of code:
creates a pule-updated memory cell component.
how it works:
A is the pulse-line input
C is the pulse-line output (for chaining them. i.e. registers)
B is the input. it is only read upon a mese signal on the pulse-line input (A in example code)
D is the output of the "memory cell" (microcontroller)
(note the button going into the side, and the switches that don't match the output lights)
using the normal microcontroller, (not the luacontroller or fpga) and punching in this line of code:
Code: Select all
sbi(A,C);if(A)sbi(B,D);
how it works:
A is the pulse-line input
C is the pulse-line output (for chaining them. i.e. registers)
B is the input. it is only read upon a mese signal on the pulse-line input (A in example code)
D is the output of the "memory cell" (microcontroller)
-
- Member
- Posts: 186
- Joined: Sat May 06, 2017 17:45
- GitHub: Parasitoid
Re: post your mesecons builds (screenshots)
Another flip-flop
Here you have the front view:
here you have the back view:
This is the gated S-R latch. Two buttons S, R switch the light to yellow or red. This can be considered as system input. The state of the system on the input can be remembered at the time selected by the player and frozen for as long as the player wishes. The player does this with lever E. In a real system of this type, it is not the man who controls it, but the pulse of the clock. But this is a minetest. Alternatively, the system can be expanded and automated to select one of two possibilities at a certain time or event. For example, did someone else visit your base on the server when you were off-line. But it's easier to build something like that with a luacontroller, I guess. Here you can find a diagram and a table explaining how this S-R latch works in real.
Here you have the front view:
here you have the back view:
This is the gated S-R latch. Two buttons S, R switch the light to yellow or red. This can be considered as system input. The state of the system on the input can be remembered at the time selected by the player and frozen for as long as the player wishes. The player does this with lever E. In a real system of this type, it is not the man who controls it, but the pulse of the clock. But this is a minetest. Alternatively, the system can be expanded and automated to select one of two possibilities at a certain time or event. For example, did someone else visit your base on the server when you were off-line. But it's easier to build something like that with a luacontroller, I guess. Here you can find a diagram and a table explaining how this S-R latch works in real.
- Attachments
-
- The Gated S-R Latch 800px back.png (398.95 KiB) Viewed 1702 times
-
- The Gated S-R Latch 800px front.png (139.01 KiB) Viewed 1702 times
- thomasthespacefox
- Member
- Posts: 100
- Joined: Sun Aug 02, 2015 15:00
- GitHub: ThomasTheSpaceFox
- IRC: ThomasJaguar1212
- In-game: thomasthespacefox
- Contact:
Re: post your mesecons builds (screenshots)
2-state Lightstone Disco floor with custom pattern
How it works:
- a grid of straight insulated wires, with not gates strewn in where inversions in each row are needed.
- Blinky Power plant toggles the rows,
- mesecons torches convey the power state of the piece below them to the disco floor lightstone blocks.
- in this example, each odd row has an initial inversion.
- a not gate will match its above lightstone.
- a insulated wire will NOT match its above lightstone.
Figured id post this here as its simple enough to understand from the screenshot.
- Attachments
-
- screenshot_20190513_221615.png (225.27 KiB) Viewed 1702 times
- benrob0329
- Member
- Posts: 1341
- Joined: Thu Aug 06, 2015 22:39
- GitHub: Benrob0329
- IRC: benrob0329
- In-game: benrob03
- Location: Michigan
- Contact:
Re: post your mesecons builds (screenshots)
Current Fastest Piston Elevator Design: https://youtu.be/WRcRdHtBBMU
Sequel To "The Mese House" (similar to a piston house): https://youtu.be/N0BoP3zY6wU
Tutorial On Basic Circuits: https://youtu.be/i9mUI7ZV7I0
Automatic Tree Farm: https://youtu.be/7YqcDmvgNrY
Lot's of little things beyond that, mostly scattered throughout VE-Creative.
Sequel To "The Mese House" (similar to a piston house): https://youtu.be/N0BoP3zY6wU
Tutorial On Basic Circuits: https://youtu.be/i9mUI7ZV7I0
Automatic Tree Farm: https://youtu.be/7YqcDmvgNrY
Lot's of little things beyond that, mostly scattered throughout VE-Creative.
- cheapie
- Member
- Posts: 316
- Joined: Mon May 14, 2012 00:59
- GitHub: cheapie
- IRC: cheapie
- In-game: cheapie
Re: post your mesecons builds (screenshots)
Since benrob0329 seems to like building elevators that don't use Luacontrollers, here's a 3-stop movestone elevator, with working doors, that doesn't use any Luacontrollers or even the logic gates: https://www.youtube.com/watch?v=FFMTDol5KvE - the video is a bit old and was taken before the actual building was built or the car buttons were put in. The picture below was taken later.
-
- New member
- Posts: 1
- Joined: Sat Aug 19, 2017 00:40
- GitHub: g-dg
- In-game: garnetdegelder
- Location: Hamilton, Canada
- Contact:
Re: post your mesecons builds (screenshots)
I managed to create a memory cell that uses only one FPGA gate.
Inputs/outputs:
Notes:
If both B and D are on, it will set the state to the input signal (not the inverse, i.e. B overrides D)
If the input signal changes while B or D are on, the state will update accordingly
Gate configuration:
Note that it relies on being able to read an write an output in each update which I'm not sure is "documented" behavior.
(To make this, I used a Karnaugh map with all the inputs and desired output and did simple boolean optimizations, such as De Morgan's law.)
Inputs/outputs:
Code: Select all
A: Input signal
B: Set state to input
C: State (output signal)
D: Set state to inverse of input
If both B and D are on, it will set the state to the input signal (not the inverse, i.e. B overrides D)
If the input signal changes while B or D are on, the state will update accordingly
Gate configuration:
Code: Select all
A AND B -> 0
A OR B -> 1
NOT 1 -> 2
2 AND D -> 3
B OR D -> 4
NOT 4 -> 5
5 AND C -> 6
3 OR 6 -> 7
0 OR 7 -> C
(To make this, I used a Karnaugh map with all the inputs and desired output and did simple boolean optimizations, such as De Morgan's law.)
-
- Member
- Posts: 366
- Joined: Tue May 07, 2019 12:59
- GitHub: y5nw
- IRC: y5nw
- In-game: ywang
- Location: Germany
Re: post your mesecons builds (screenshots)
I made a (very) simple rocket and I can't stop it now...
(Solution: Settings > Reset singleplayer world...)
(Solution: Settings > Reset singleplayer world...)
- Attachments
-
- 20190609_221354.jpg (29.54 KiB) Viewed 1702 times
- Miniontoby
- Member
- Posts: 616
- Joined: Fri Mar 01, 2019 19:25
- GitHub: Miniontoby
- IRC: Miniontoby
- In-game: Miniontoby
- Location: The Netherlands
Re: post your mesecons builds (screenshots)
I have made three "20 color" slots in minetest to secure my door (now it's a normal steel door)
Frontside:
Backside:
P.S. There is coming a tutorial video
Frontside:
Backside:
P.S. There is coming a tutorial video
- Attachments
-
- screenshot2
- screenshot_20190626_183836.png (953.61 KiB) Viewed 1702 times
-
- screenshot1
- screenshot_20190626_183800.png (557.07 KiB) Viewed 1702 times
Re: post your mesecons builds (screenshots)
I made a device that detects and saves the names of players who came within a 9 node distance of the player detector. It also saves the time in seconds that each player was in the area. The parts consist of a lua controller in the center, two buttons on two ports, one additional port having the digistuff player detector, and the other port having a scifi screen. The first number is the "page" number; one of the buttons increases an integer value, which is associated with a player. Each time a new player is found, the value is increased, so one of the buttons increases the value and the other button/ switch decreases the value.
I recently got a new computer, and I am looking forward to adding a video showing the function.
Here it is:
https://youtu.be/Qr4LoYF6W-M
I recently got a new computer, and I am looking forward to adding a video showing the function.
Here it is:
https://youtu.be/Qr4LoYF6W-M
- Attachments
-
- sc3.PNG (153.28 KiB) Viewed 1702 times
-
- sc2.PNG (212.25 KiB) Viewed 1702 times
-
- sc1.PNG (97.36 KiB) Viewed 1702 times
- Miniontoby
- Member
- Posts: 616
- Joined: Fri Mar 01, 2019 19:25
- GitHub: Miniontoby
- IRC: Miniontoby
- In-game: Miniontoby
- Location: The Netherlands
Re: post your mesecons builds (screenshots)
Hey cheapie,
how to program the touchscreen of your digistuff mod??
I really need it, so I hope you answer fast
how to program the touchscreen of your digistuff mod??
I really need it, so I hope you answer fast
- Miniontoby
- Member
- Posts: 616
- Joined: Fri Mar 01, 2019 19:25
- GitHub: Miniontoby
- IRC: Miniontoby
- In-game: Miniontoby
- Location: The Netherlands
Re: post your mesecons builds (screenshots)
I did made a three way piston door with digistuff pistons and a lua controller
]
More pictures in next post
]
More pictures in next post
- Attachments
-
- Up
- Screenshot_2020-01-14-19-50-56.png (125.98 KiB) Viewed 1702 times
-
- Down
- Screenshot_2020-01-14-19-50-47.png (139.29 KiB) Viewed 1702 times
-
- Straight
- Screenshot_2020-01-14-19-50-23.png (146.4 KiB) Viewed 1702 times
Last edited by Miniontoby on Tue Jan 14, 2020 19:01, edited 1 time in total.
- Miniontoby
- Member
- Posts: 616
- Joined: Fri Mar 01, 2019 19:25
- GitHub: Miniontoby
- IRC: Miniontoby
- In-game: Miniontoby
- Location: The Netherlands
Re: post your mesecons builds (screenshots)
More pictures
The black nodes are the digipistons (some white (but not really white) blocks are also digipistons)
The black nodes are the digipistons (some white (but not really white) blocks are also digipistons)
- Attachments
-
- Under
- Screenshot_2020-01-14-19-51-59.png (462.23 KiB) Viewed 1702 times
-
- The "behind the scenes"
- Screenshot_2020-01-14-19-51-46.png (769.89 KiB) Viewed 1702 times
Re: post your mesecons builds (screenshots)
Hi,
I have try to do the same like this
I don't undestand how is it working.
go a code like that
but the username isn't read or saved ?
Can i have some help to undestand this ?
I have try to do the same like this
but that can't work.Mathias wrote:I made a device that detects and saves the names of players
https://youtu.be/Qr4LoYF6W-M
I don't undestand how is it working.
go a code like that
Code: Select all
local var
if event.type == "digiline" and event.channel == "username" then
local var = event.msg
digiline_send("lcd", var)
end
Can i have some help to undestand this ?
Re: post your mesecons builds (screenshots)
Hi, I save the name values inside a table. I can create a table using for j=1,100 do var[j]=0 end. Then every time a new player comes up I would do "username" which has the name of the person, and then do var[j]= "username". Then I would do j=j+1 when there is a new player. Does this help? Also, looking at your code, try event.msg[0] or event.msg[1]. Because I think this type of player detector as of the mod can detect multiple players at once, so it would make sense that itself/ the data is stored in a table.
- Miniontoby
- Member
- Posts: 616
- Joined: Fri Mar 01, 2019 19:25
- GitHub: Miniontoby
- IRC: Miniontoby
- In-game: Miniontoby
- Location: The Netherlands
Re: post your mesecons builds (screenshots)
I helped already by changing the code that it don't add the player into a table but that the detector sends the players, but I think yours will also work
- Miniontoby
- Member
- Posts: 616
- Joined: Fri Mar 01, 2019 19:25
- GitHub: Miniontoby
- IRC: Miniontoby
- In-game: Miniontoby
- Location: The Netherlands
Re: post your mesecons builds (screenshots)
I made a 8x8 draw screen:
Front:
Above/all mesecons:
After the buttons/behind them there are microcontrollers with code like an f-flop
I am at the limit rn with an 9x9 one but thats a bit not needed rn because i dont have a picture with 9x9 pixels but when vertical insulated mesecons will be added i can make bigger ones
Front:
Above/all mesecons:
After the buttons/behind them there are microcontrollers with code like an f-flop
I am at the limit rn with an 9x9 one but thats a bit not needed rn because i dont have a picture with 9x9 pixels but when vertical insulated mesecons will be added i can make bigger ones
- Attachments
-
- Above
- Screenshot_2020-07-24-14-46-04.png (963.57 KiB) Viewed 1702 times
-
- Front
- Screenshot_2020-07-24-14-38-15.png (401.68 KiB) Viewed 1702 times
- MisterE
- Member
- Posts: 693
- Joined: Sun Feb 16, 2020 21:06
- GitHub: MisterE123
- IRC: MisterE
- In-game: MisterE
Re: post your mesecons builds (screenshots)
2 player CONNECT FOUR.
to build this, you need MESECONS and this mod: viewtopic.php?t=20651 and this mod: viewtopic.php?t=21518 (optional) you could use the LCD, by adjusting messages to fit
build this setup:
if you want, it is easy to replace the keyboards on ch.2 and ch.4 with a row of buttons connected to luacontrollers that send out the messages like so for the ch.2 keyboard replacement:
and so on up to 7.
You also need a button/luacontroller that sends 'ready' and one that sends 'reset'
Thats what I have done on the screenshots.
In the main luacontroller, put the below program:
To play assuming you are using the keyboards, the buttons follow similarly, each player should type 'reset' and send it via their keyboard. Then the code will randomly choose one player to go first, and send a message saying eg. Pl 1 goes first. That player should type in a number 1 - 7 to indicate the row to place their checker. The game checks to see if the requested move is possible, if it is, the game then drops the checker down the row until it hits the bottom of the screen or another checker. Get FOUR in a ROW to win! the game will tell you if a player won. Then, the only thing you can do is send the message 'reset' on one of the keyboards to play again.
code and design is licensed under CC0, but attribution is appreciated, though not req'd. The program works, but contributions to enhance it are welcome!
Also, I'd love to see what other similar games are possible with mesecons!
If you want to try this out without building it yourself, Join MisterE's SurvivalX server, its right at spawn. You may have to press the reset button to play.
to build this, you need MESECONS and this mod: viewtopic.php?t=20651 and this mod: viewtopic.php?t=21518 (optional) you could use the LCD, by adjusting messages to fit
build this setup:
if you want, it is easy to replace the keyboards on ch.2 and ch.4 with a row of buttons connected to luacontrollers that send out the messages like so for the ch.2 keyboard replacement:
Code: Select all
if event.type == 'on' then
digiline_send('2','1')
end
Code: Select all
if event.type == 'on' then
digiline_send('2','2')
end
Code: Select all
if event.type == 'on' then
digiline_send('2','3')
end
You also need a button/luacontroller that sends 'ready' and one that sends 'reset'
Thats what I have done on the screenshots.
In the main luacontroller, put the below program:
Code: Select all
--setup
if event.type == 'program' or (event.type == 'digiline' and (event.msg == 'RESET' or event.msg == 'Reset' or event.msg == 'reset' )) then
mem.pl1_ready = false --is pl1 ready to start the game?
mem.pl2_ready = false --is pl2 ready to start the game?
mem.state = 'pregame' -- can be: pregame, turn, settle, win
mem.board = {} -- a table with 42 entries. Every 7 entries count as 1 row, giving 6 rows and 7 columns.
-- 0= empty, 1 = player 1's checker, -1 = pl2's checker
for i = 1,36,7 do
for j = i,i+6 do
mem.board[j] = 0
end
end
mem.turn = math.random(1,2) --whose turn is it?
mem.switch = {2,1} -- for switching the turn
-- here we store the channels of the hardware
mem.player_key = {'2','4'} -- this means that player 1's keyboard is channel 2, and player 2's keyboard is channel 4
mem.player_scr = {'1','3'} -- this means that player 1's keyboard is channel 1, and player 2's keyboard is channel 3
mem.large_screen = "5"
digiline_send(mem.player_scr[1],'\n\n\n\nPress READY to play\nas player 1')
digiline_send(mem.player_scr[2],'\n\n\n\nPress READY to play\nas player 2')
digiline_send(mem.large_screen,'/fCONNECT/0O /f4 /8OO/fPRESS/0OO/fREADY/8OO /f2 /0OO/fBEGIN/8O')
digiline_send('t',"-")
end
--get player's ready messages, switch state to turn if they are ready
if event.type == 'digiline' and (event.msg == 'ready' or event.msg == 'READY' or event.msg == 'Ready') and mem.state == 'pregame' then
--here we get players ready states and set them, and send waiting messages if the other player isnt ready.
if event.channel == mem.player_key[1] then -- if the ready message came from pl1
if mem.pl1_ready == false and mem.pl2_ready == false then -- update message if and only if it hasnt been updated already, and if the other player isnt ready.
digiline_send(mem.player_scr[1],"\nWaiting for player\n2.")
digiline_send(mem.player_scr[2],"\nPlayer 1 is ready,\nwaiting for you.")
digiline_send(mem.large_screen,'/fWAITING/0O /f4 /8O/fPLAYER2/0O/f 2 /8OO/fPRESS/0OO/fREADY/8O')
end
mem.pl1_ready = true
end
if event.channel == mem.player_key[2] then -- if the ready message came from pl2
if mem.pl2_ready == false and mem.pl1_ready == false then -- update message if and only if it hasnt been updated already and if the other player isnt ready.
digiline_send(mem.player_scr[1],"\nPlayer 2 is ready,\nwaiting for you.")
digiline_send(mem.player_scr[2],"\nWaiting for player\n1.")
digiline_send(mem.large_screen,'/fWAITING/0O /f4 /8O/fPLAYER1/0O/f 2 /8OO/fPRESS/0OO/fREADY/8O')
end
mem.pl2_ready = true
end
if mem.pl1_ready == true and mem.pl2_ready == true then
-- everybody's ready, the board is initialized, the turn is inited already too, setting up the game state...
mem.state = 'turn'
digiline_send(mem.player_scr[mem.turn],"\nGame is starting,\nYou go first.")
digiline_send('t',mem.turn)
digiline_send(mem.player_scr[mem.switch[mem.turn]],"\nGame is starting,\nPlayer "..mem.turn.." goes first.")
mem.string = ''
for i=1,42 do
local val = mem.board[i]
if val == 0 then
mem.string = mem.string .. ' '
end
if val == 1 then
mem.string = mem.string ..'/0O'
end
if val == -1 then
mem.string = mem.string ..'/8O'
end
end
digiline_send(mem.large_screen,mem.string)
--interrupt(.1)
end
end
--accept input from the player whose turn it is, call the settle function
if event.type == 'digiline' and event.msg == '1' or event.msg == '2' or event.msg == '3' or event.msg == '4' or event.msg == '5' or event.msg == '6' or event.msg == '7' and mem.state == 'turn' then --I hope that this will allow me to check if the input is
if event.channel == mem.player_key[mem.turn] then
digiline_send('6', 'we got here...78')
if (mem.board[tonumber(event.msg)] == 0) then -- if the input is coming from the player whose turn it is, and the checker can be placed,
digiline_send('6', 'we got here...80')
--add the player's checker to the board, at the top
if mem.turn == 1 then
mem.board[tonumber(event.msg)] = 1
end
if mem.turn == 2 then
mem.board[tonumber(event.msg)] = -1
end
--lets try implementing the switch turn here...
mem.turn = mem.switch[mem.turn]
--now we will call the settle function...
interrupt(.5,'settle')
digiline_send('6','settle was called')
end
end
end
-- if event.type == 'interrupt' and event.iid == 'drawboard' then
-- mem.string = ''
-- for i in mem.board do
-- if i = 0 then
-- mem.string = mem.string .. ' '
-- end
-- if i = 1 then
-- mem.string = mem.string ..'\0O'
-- end
-- if i = 1 then
-- mem.string = mem.string ..'\8O'
-- end
-- end
-- digiline_send(mem.large_screen,mem.string)
-- end
if event.type == 'interrupt' and event.iid == 'settle' then
--drop checkers
local move = false
for i = 35,1,-1 do
if mem.board[i] ~= 0 and mem.board[i+7] == 0 then -- if the location has a checker, and the location under it is empty
mem.board[i+7] = mem.board[i]
mem.board[i] = 0
move = true
end
end
--update board
mem.string = ''
for i=1,42 do
local val = mem.board[i]
if val == 0 then
mem.string = mem.string .. ' '
end
if val == 1 then
mem.string = mem.string ..'/0O'
end
if val == -1 then
mem.string = mem.string ..'/8O'
end
end
digiline_send(mem.large_screen,mem.string)
--if we moved a checker, we will run this again. (and we shouldnt do anything else - check that)
if move == true then
interrupt(.5,'settle')
end
--if we didnt move a checker, then, check for a win. if there is a win, go to the win state and code.
--If there is not a win,
--switch mem.turn and change state to turn so we can wait for input
if move == false then
-- check for a win
winner = 0 -- no winner detected yet - changed to player number if win
-- check all horiz combos
for i = 1,36,7 do
for j = i,i+3 do
count = 0
for k = j, j+3 do
count = count + mem.board[k]
end
if count == 4 then
winner = 1
end
if count == -4 then
winner = 2
end
end
end
--check all vert combos
for i = 1,7 do
for j = i,i+14,7 do
local count = 0
for k = j,j+21,7 do
count = count + mem.board[k]
end
if count == 4 then
winner = 1
end
if count == -4 then
winner = 2
end
end
end
--check all diagonal combos up and to the right, from the bottom left corner
for i = 22,36,7 do
for j = i,i+3 do
local count = 0
for k = j,j-18,-6 do
count = count + mem.board[k]
end
if count == 4 then
winner = 1
end
if count == -4 then
winner = 2
end
end
end
--check all diagonal combos down and to the right from the top left corner
for i = 1, 15, 7 do
for j = i, i+3 do
local count = 0
for k = j, j+24, 8 do
count = count + mem.board[k]
end
if count == 4 then
winner = 1
end
if count == -4 then
winner = 2
end
end
end
if winner ~= 0 then
mem.state = 'win'
interrupt(.5,'winner'..winner)
digiline_send(mem.player_scr[winner],"\n\n\n\n\nYou Won!")
digiline_send(mem.player_scr[mem.switch[winner]],"\n\n\n\n\nPlayer "..winner.."has won!")
else
digiline_send('6',"turn switching now")
digiline_send(mem.player_scr[mem.switch[mem.turn]],"\n\n\n\nIt is the other\nplayer's turn.")
--mem.turn = mem.switch[mem.turn]
mem.state = 'turn'
digiline_send(mem.player_scr[mem.turn],"\n\n\n\nIt is your turn.")
digiline_send('t',mem.turn)
end
end
end
--[[
digiline_send('6','the code was run bc: '..event.type) --debug channel
if event.iid then
digiline_send('6','with iid: '..event.iid) --debug channel
end
if event.channel then
digiline_send('6','with channel: '..event.channel) --debug channel
digiline_send('6','and msg: '..event.msg) --debug channel
end
if mem.state then
digiline_send('6','game state:'..mem.state) --debug channel
end
]]--
code and design is licensed under CC0, but attribution is appreciated, though not req'd. The program works, but contributions to enhance it are welcome!
Also, I'd love to see what other similar games are possible with mesecons!
If you want to try this out without building it yourself, Join MisterE's SurvivalX server, its right at spawn. You may have to press the reset button to play.
Who is online
Users browsing this forum: No registered users and 15 guests