Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3] 4

Author Topic: batILLION: a game in a bat file  (Read 9567 times)

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: batILLION: a game in a bat file
« Reply #30 on: January 04, 2012, 06:59:08 pm »

the .BAT language is an interpreted language that consists of calls to the main functions of the OS, and some facilities found in assembly languages. The language has a limited amount of variables and doesn't even have proper loops - you have to use GO for that.
Logged

Eagle0600

  • Bay Watcher
  • Highly Confused
    • View Profile
Re: batILLION: a game in a bat file
« Reply #31 on: January 13, 2012, 05:37:14 am »

It's basically very limiting and arbitrary, and it would be insane to try to make any kind of sophisticated, interactive program in it... which makes this project perfect!  <3

edit:

I've been working on mapping northward from the start location, and here are my results so far:


The green dot is the start location, and the purple dots are unexplored rooms. The grey is passageways confirmed from both sides (and I found no one-way passageways).

I didn't go very far, but already a pretty clear pattern is emerging, and I think you really do need to fix your RNG. Would it be possible to implement the twister in batILLION?
« Last Edit: January 13, 2012, 06:03:44 am by Eagle0600 »
Logged
GENERATION 21:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

PTTG??

  • Bay Watcher
  • Kringrus! Babak crulurg tingra!
    • View Profile
    • http://www.nowherepublishing.com
Re: batILLION: a game in a bat file
« Reply #32 on: January 13, 2012, 10:05:36 am »

The answer is yes, but I'm not sure how. I've kinda broken the random number generator out from the rest of the code, it's all in a little pseudo-function at the bottom.
« Last Edit: January 13, 2012, 11:15:04 am by PTTG?? »
Logged
A thousand million pool balls made from precious metals, covered in beef stock.

Vattic

  • Bay Watcher
  • bibo ergo sum
    • View Profile
Re: batILLION: a game in a bat file
« Reply #33 on: January 13, 2012, 11:33:52 am »

Would it give acceptable results if you simply counted up through a pre-generated string of digits?

Something like this perhaps:
Code: [Select]
@ECHO off

SETLOCAL ENABLEDELAYEDEXPANSION
cls

SET /a count=0

:ROLL
SET numbers=2345675456432133457643237543235543212423
SET output=!numbers:~%count%,1!
ECHO %output%
SET /a count+=1
IF %count%==40 SET count=0

SET repeat=n
SET /P repeat=Hit anything to repeat or X to quit:
IF %repeat%==X GOTO END
IF %repeat%==x GOTO END
GOTO ROLL

:END
cls
Logged
6 out of 7 dwarves aren't Happy.
How To Generate Small Islands

Eagle0600

  • Bay Watcher
  • Highly Confused
    • View Profile
Re: batILLION: a game in a bat file
« Reply #34 on: January 13, 2012, 07:39:20 pm »

Probably not, but I guess we can give it a go and see if any horribly obvious artifacts turn up.

edit:
I've got the Mersenne Twister psuedocode off wikipedia.

This first bit would go in the top of batILLION:
Code: [Select]
// Create a length 624 array to store the state of the generator
 int[0..623] MT
 int index = 0
 
 // Initialize the generator from a seed
 function initialize_generator(int seed) {
     MT[0] := seed
     for i from 1 to 623 { // loop over each other element
         MT[i] := last 32 bits of(1812433253 * (MT[i-1] xor (right shift by 30 bits(MT[i-1]))) + i) // 0x6c078965
     }
 }

And this next bit would go in the :ROLL section.
Code: [Select]
// Extract a tempered pseudorandom number based on the index-th value,
 // calling generate_numbers() every 624 numbers
 function extract_number() {
     if index == 0 {
         generate_numbers()
     }
 
     int y := MT[index]
     y := y xor (right shift by 11 bits(y))
     y := y xor (left shift by 7 bits(y) and (2636928640)) // 0x9d2c5680
     y := y xor (left shift by 15 bits(y) and (4022730752)) // 0xefc60000
     y := y xor (right shift by 18 bits(y))

     index := (index + 1) mod 624
     return y
 }
 
 // Generate an array of 624 untempered numbers
 function generate_numbers() {
     for i from 0 to 623 {
         int y := 32nd bit of(MT[i]) + last 31 bits of(MT[(i+1) mod 624])
         MT[i] := MT[(i + 397) mod 624] xor (right shift by 1 bit(y))
         if (y mod 2) != 0 { // y is odd
             MT[i] := MT[i] xor (2567483615) // 0x9908b0df
         }
     }
 }
« Last Edit: January 13, 2012, 07:43:52 pm by Eagle0600 »
Logged
GENERATION 21:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Vattic

  • Bay Watcher
  • bibo ergo sum
    • View Profile
Re: batILLION: a game in a bat file
« Reply #35 on: January 13, 2012, 09:51:31 pm »

I had a look at the wiki page you got that from earlier. I'd try and make a batch version of it but it's well beyond me. What I last posted in here was one of the only things I've ever written in a .bat file.

One thing to keep in mind about using a long string like I suggested is that it can be pretty long. From what I've read one line in cmd can be at most 2047 characters long. If that wasn't enough we could use an extra count variable and have as many long strings of digits as necessary.
Logged
6 out of 7 dwarves aren't Happy.
How To Generate Small Islands

Eagle0600

  • Bay Watcher
  • Highly Confused
    • View Profile
Re: batILLION: a game in a bat file
« Reply #36 on: January 14, 2012, 05:53:08 am »

Still, it would end up repeating itself in (relatively) short order, and I'm not okay with that. That said, is the code in the first post updated to be the most recent, because I just realised that I might have been mapping an older version.

edit: Yeah, I've been mapping an out-of-date version. Sorry about that. Here's a newer map, with far less wrong with it:
« Last Edit: January 15, 2012, 12:37:58 am by Eagle0600 »
Logged
GENERATION 21:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Yannanth

  • Guest
.
« Reply #37 on: January 21, 2012, 10:21:03 am »

.
« Last Edit: November 22, 2016, 05:05:46 am by Yannanth »
Logged

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: batILLION: a game in a bat file
« Reply #38 on: January 21, 2012, 12:42:39 pm »

Nice, you release it under the "GNU" (you probably mean the GPL, but I'll let that slide) but make it exclusively work as a BAT file, a file that can is only executable under the locked-in Microsoft Windows operating system. You just betrayed the very idea of free software by programming exclusively under this operating system. Congratulations, sir, I salute you.

You could still do this in bash and then get users to download Cygwin which emulates it. And then everyone will be happy and able to play your game which would be truly free. Because currently, the game would probably be incompatible with the GPLv3.
I'm not sure you understand what the word "free" means. It's not free because someone has to own Windows to use it? Unless you sneak onto the library computer every day with a pirated game on a stolen flash drive, every bit of software you've ever downloaded has cost you something by your definition of "free".
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU

Yannanth

  • Guest
.
« Reply #39 on: January 21, 2012, 03:38:49 pm »

.
« Last Edit: November 22, 2016, 05:05:54 am by Yannanth »
Logged

Eagle0600

  • Bay Watcher
  • Highly Confused
    • View Profile
Re: batILLION: a game in a bat file
« Reply #40 on: January 21, 2012, 05:15:53 pm »

A) Free has two meanings, even in a software context. You cannot solely enforce the one you want to.

B) He's releasing the source code and letting people to pretty-much whatever they want with it. If you have to get around some technical limitations to do so, that isn't his job to deal with. Stop acting so goddamn entitled and trying to create more work for him, especially since he's doing this as a hobby. If you were paying for anything, you would maybe have a right to feel the way you do. As is, I suggest you work on your own version if you are unsatisfied.
Logged
GENERATION 21:The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

SolarShado

  • Bay Watcher
  • Psi-Blade => Your Back
    • View Profile
Re: batILLION: a game in a bat file
« Reply #41 on: January 21, 2012, 06:37:17 pm »

DOSbox, possibly with FreeDOS installed in it, could work if you don't have (access to) Windows. Wine might have a cmd.exe implementation as well.
Logged
Avid (rabid?) Linux user. Preferred flavor: Arch

SirAaronIII

  • Bay Watcher
  • Western Romanticist
    • View Profile
Re: batILLION: a game in a bat file
« Reply #42 on: January 22, 2012, 03:23:50 am »

Quote
- The freedom to run the program, for any purpose (freedom 0).
- The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.
- The freedom to redistribute copies so you can help your neighbor (freedom 2).
- The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.
1. He didn't specify any limits on what you could use it for, so the first point is true.
2. Again, no specifications, so it appears we're free to study and edit it as we wish. The source code is available so that's fulfilled.
3. It's welcome and possibly even encouraged to share modified versions and improvements in this thread.
4. See 3
It meets the four requirements from the first link, so to quote the site: "A program is free software if users have all of these freedoms." We do, so it is.
Logged
"I want to watch the sun setting below the horizon, thinking about my significance in this world. That's my dream."

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: batILLION: a game in a bat file
« Reply #43 on: January 22, 2012, 12:33:47 pm »

Nice, you release it under the "GNU" (you probably mean the GPL, but I'll let that slide) but make it exclusively work as a BAT file, a file that can is only executable under the locked-in Microsoft Windows operating system. You just betrayed the very idea of free software by programming exclusively under this operating system. Congratulations, sir, I salute you.

You could still do this in bash and then get users to download Cygwin which emulates it. And then everyone will be happy and able to play your game which would be truly free. Because currently, the game would probably be incompatible with the GPLv3.
I'm not sure you understand what the word "free" means. It's not free because someone has to own Windows to use it? Unless you sneak onto the library computer every day with a pirated game on a stolen flash drive, every bit of software you've ever downloaded has cost you something by your definition of "free".
No, you do not understand because this (click) is what "free software" means. You are not speaking in the software context when you use "free" with that meaning. Please clarify your language better from now on.

Here (click) is an essay by Richard Stallman on why "open source" is bad terminology. I urge you to change the wording in the first post. Here (click) are several other pages among the many that have been written about free software.
Oh, I misinterpreted what you were saying. You mean that the fact that this software is coded in the proprietary batch script language (which only works on DOS or Windows) makes it incompatible with the GNU license. Is that what you meant? Because as SirAaron pointed out, it meets all the requirements. It's open software, the platform it's designed for shouldn't matter.

Also, people probably wouldn't be so eager to correct you if you didn't act so abrasive and confrontational. Please amplify your relaxed state, as The Toad would put it.
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU

PTTG??

  • Bay Watcher
  • Kringrus! Babak crulurg tingra!
    • View Profile
    • http://www.nowherepublishing.com
Re: batILLION: a game in a bat file
« Reply #44 on: January 22, 2012, 09:04:08 pm »

Nice, you release it under the "GNU" (you probably mean the GPL, but I'll let that slide) but make it exclusively work as a BAT file, a file that can is only executable under the locked-in Microsoft Windows operating system. You just betrayed the very idea of free software by programming exclusively under this operating system. Congratulations, sir, I salute you.

You could still do this in bash and then get users to download Cygwin which emulates it. And then everyone will be happy and able to play your game which would be truly free. Because currently, the game would probably be incompatible with the GPLv3.

How about I get you a rake and you can go explore your internal organs?

To everyone else; Yannanth is either a troll or a moron, and probably both. The entire point of this program is to be poorly written on a bad platform and yet still function, making the poorly-optimized poorly-supported bat format a natural choice, and I can't think of a better name anyway. Ignore him.

Back on topic, I haven't updated this thing for a while. I'm working on real projects, and classwork from time to time. Perhaps I'll try to make a better RNG next time I'm sitting in a lecture. I would deeply appreciate anyone's ideas and contributions.
Logged
A thousand million pool balls made from precious metals, covered in beef stock.
Pages: 1 2 [3] 4